Limit the number of neighbors based on the dataframe

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

View File

@@ -16,9 +16,8 @@ if "data" in st.session_state:
key=f"mv-{column}",
)
if isinstance(option, KNNStrategy):
print(option.available_features)
option.training_features = st.multiselect("Training columns", option.training_features, default=option.available_features, key=f"cols-{column}")
option.n_neighbors = st.number_input("Number of neighbors", min_value=1, value=option.n_neighbors, key=f"neighbors-{column}")
option.n_neighbors = st.number_input("Number of neighbors", min_value=1, max_value=option.count_max(data, column), value=option.n_neighbors, key=f"neighbors-{column}")
# Always re-get the series to avoid reusing an invalidated series pointer
data = option.apply(data, column, data[column])