sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
295 stars 141 forks source link

Trouble calculating SHAP scores #398

Open GKNM995 opened 12 hours ago

GKNM995 commented 12 hours ago

Hi! I am trying to train classifiers for my project but I keep getting an error when trying to calculate SHAP scores. I tried both single and multicore runs but I get the same error either way. I can train the classifier if I completely skip over the SHAP calculations but I would love to have them.

The Simba screen freezes here: SIMBA_screenshot

The error message in the command line shown here: Error_message

Here are the model parameters used: pose_estimation_body_parts = 8 classifier = Body_groom train_test_size = 0.2 under_sample_setting = None under_sample_ratio = NaN over_sample_setting = None over_sample_ratio = NaN rf_n_estimators = 2000 rf_min_sample_leaf = 1 rf_max_features = sqrt rf_n_jobs = -1 rf_criterion = entropy generate_rf_model_meta_data_file = None generate_example_decision_tree = False generate_example_decision_tree_fancy = False generate_features_importance_log = False generate_features_importance_bar_graph = False compute_feature_permutation_importance = False generate_sklearn_learning_curves = False generate_precision_recall_curves = True n_feature_importance_bars = 0 learning_curve_k_splits = 0 learningcurve_shuffle_data_splits = None model_to_run = RF train_test_split_type = BOUTS rf_meta_data = True generate_classification_report = True learning_curve_data_splits = 0 generate_shap_scores = True shap_target_present_no = 100 shap_target_absent_no = 100 shap_save_iteration = 100 shap_multiprocess = False partial_dependency = False class_weights = custom class_custom_weights = {0: '1', 1: '2'}

Thank you for your help!

sronilsson commented 6 hours ago

Thanks for reporting @GKNM995 - I can see what is happening. Seems like shap package version in Python 3.10 wants an older numpy version or vice versa.

What version of shap (pip show shap) and numpy (pip show numpy) are you running?

sronilsson commented 4 hours ago

... PS. It should be shap version 0.42.0 if you are running python version above 3.6 (I think).

If you do pip install shap==0.42.0 and then try again, how does it look on your end?

GKNM995 commented 1 hour ago

Shap version is 0.35.0, and numpy version is 1.26.4. Gonna update the shap version and let you know how it goes.

GKNM995 commented 1 hour ago

I get this error when I install shap 0.42.0. image

sronilsson commented 1 hour ago

Yes, it should just be a warning that I will remove, let me know if it runs anyways?

GKNM995 commented 1 hour ago

It seems to be running now. No new error at the moment

sronilsson commented 53 minutes ago

thanks for letting me know!