Comment code sections and change to pd.concatinate method.

ml_pipeline
Primoz 2023-02-06 11:31:21 +01:00
parent 08e81610a9
commit 93a34986d9
1 changed files with 7 additions and 7 deletions

View File

@ -291,15 +291,15 @@ plot_sequential_progress_of_feature_addition_scores(xs, y_recall, y_fscore, reca
best_sensor_group = sensor_groups_importance_scores[0][0] # take the highest rated sensor group best_sensor_group = sensor_groups_importance_scores[0][0] # take the highest rated sensor group
best_sensor_features = [col for col in model_input if col.startswith(best_sensor_group)] best_sensor_features = [col for col in model_input if col.startswith(best_sensor_group)]
best_sensor_features_scores = find_sensor_group_features_importance(model_input, best_sensor_features) # best_sensor_features_scores = find_sensor_group_features_importance(model_input, best_sensor_features)
xs, y_recall, y_fscore, recall_std, fscore_std = sort_tuples_to_lists(best_sensor_features_scores) # xs, y_recall, y_fscore, recall_std, fscore_std = sort_tuples_to_lists(best_sensor_features_scores)
# %% [markdown] # %% [markdown]
# ### Visualize best sensor's F1 and recall scores # ### Visualize best sensor's F1 and recall scores
print(best_sensor_features_scores) # print(best_sensor_features_scores)
plot_sequential_progress_of_feature_addition_scores(xs, y_recall, y_fscore, recall_std, fscore_std, # plot_sequential_progress_of_feature_addition_scores(xs, y_recall, y_fscore, recall_std, fscore_std,
title="Best sensor addition it's features with F1 and recall scores") # title="Best sensor addition it's features with F1 and recall scores")
# %% # %%
# This section iterates over all sensor groups and investigates sequential feature importance feature-by-feature # This section iterates over all sensor groups and investigates sequential feature importance feature-by-feature
@ -311,8 +311,8 @@ for i, sensor_group in enumerate(sensor_groups_importance_scores):
current_sensor_features = [col for col in model_input if col.startswith(sensor_group[0])] current_sensor_features = [col for col in model_input if col.startswith(sensor_group[0])]
current_sensor_features_scores = find_sensor_group_features_importance(model_input, current_sensor_features) current_sensor_features_scores = find_sensor_group_features_importance(model_input, current_sensor_features)
xs, y_recall, y_fscore, recall_std, fscore_std = sort_tuples_to_lists(current_sensor_features_scores) xs, y_recall, y_fscore, recall_std, fscore_std = sort_tuples_to_lists(current_sensor_features_scores)
feature_sequence = feature_sequence.append(pd.DataFrame({"sensor_name":sensor_group[0], "feature_sequence": [xs], "recall": [y_recall], feature_sequence = pd.concatinate([feature_sequence, pd.DataFrame({"sensor_name":sensor_group[0], "feature_sequence": [xs], "recall": [y_recall],
"f1_score": [y_fscore], "recall_std": [recall_std], "f1_std": [fscore_std]})) "f1_score": [y_fscore], "recall_std": [recall_std], "f1_std": [fscore_std]})])
plot_sequential_progress_of_feature_addition_scores(xs, y_recall, y_fscore, recall_std, fscore_std, plot_sequential_progress_of_feature_addition_scores(xs, y_recall, y_fscore, recall_std, fscore_std,
title=f"Sequential addition of features for {sensor_group[0]} and its F1, and recall scores") title=f"Sequential addition of features for {sensor_group[0]} and its F1, and recall scores")