Limit the number of neighbors based on the dataframe

This commit is contained in:
2024-06-21 16:03:54 +02:00
parent 3c5f6849f8
commit d4aeb87f75
2 changed files with 5 additions and 2 deletions

View File

@@ -130,6 +130,10 @@ class KNNStrategy(MVStrategy):
df.fillna(usable_data, inplace=True)
return df
def count_max(self, df: DataFrame, label: str) -> int:
usable_data = df.dropna(subset=self.training_features)
return usable_data[label].count()
def __str__(self) -> str:
return "kNN"