From 77a9f3ccd211774e965acbbd134dc7c13be79149 Mon Sep 17 00:00:00 2001 From: sronilsson Date: Fri, 30 Aug 2024 15:43:43 -0400 Subject: [PATCH] cuda docs --- simba/data_processors/cuda/is_inside_rectangle.py | 13 ++++++++++++- simba/mixins/train_model_mixin.py | 3 ++- .../target_feature_importance_log.csv | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/data/test_projects/two_c57/models/generated_models/target_feature_importance_log.csv diff --git a/simba/data_processors/cuda/is_inside_rectangle.py b/simba/data_processors/cuda/is_inside_rectangle.py index ccf62d6b5..8b91b9659 100644 --- a/simba/data_processors/cuda/is_inside_rectangle.py +++ b/simba/data_processors/cuda/is_inside_rectangle.py @@ -24,9 +24,20 @@ def is_inside_rectangle(x: np.ndarray, y: np.ndarray) -> np.ndarray: :return np.ndarray: 2d numeric boolean (N, 1) with 1s representing the point being inside the rectangle and 0 if the point is outside the rectangle. .. csv-table:: Function Performance Table with Markup - :file: ../_tables/is_inside_rectangle.csv + :file: ../../_tables/is_inside_rectangle.csv :widths: 30, 70 :header-rows: 1 + + .. csv-table:: Function Performance Table with Markup + :file: ../../../_tables/is_inside_rectangle.csv + :widths: 30, 70 + :header-rows: 1 + + .. csv-table:: Function Performance Table with Markup + :file: /_tables/is_inside_rectangle.csv + :widths: 30, 70 + :header-rows: 1 + """ diff --git a/simba/mixins/train_model_mixin.py b/simba/mixins/train_model_mixin.py index cd36fc502..773d22713 100644 --- a/simba/mixins/train_model_mixin.py +++ b/simba/mixins/train_model_mixin.py @@ -676,11 +676,12 @@ def create_x_importance_log(self, self.f_importance_save_path = os.path.join(save_dir, f"{clf_name}_{save_file_no}_feature_importance_log.csv") else: self.f_importance_save_path = os.path.join(save_dir, f"{clf_name}_feature_importance_log.csv") - if cuRF is not None and isinstance(rf_clf, cuRF): + if cuRF is not None and isinstance(rf_clf, cuRF) and hasattr(rf_clf, 'get_json'): cuml_tree_nodes = loads(rf_clf.get_json()) importances = list(self.cuml_rf_x_importances(nodes=cuml_tree_nodes, n_features=len(x_names))) std_importances = [np.nan] * len(importances) else: + print('s') importances_per_tree = np.array([tree.feature_importances_ for tree in rf_clf.estimators_]) importances = list(np.mean(importances_per_tree, axis=0)) std_importances = list(np.std(importances_per_tree, axis=0)) diff --git a/tests/data/test_projects/two_c57/models/generated_models/target_feature_importance_log.csv b/tests/data/test_projects/two_c57/models/generated_models/target_feature_importance_log.csv new file mode 100644 index 000000000..455b85b8c --- /dev/null +++ b/tests/data/test_projects/two_c57/models/generated_models/target_feature_importance_log.csv @@ -0,0 +1,3 @@ +FEATURE,FEATURE_IMPORTANCE_MEAN,FEATURE_IMPORTANCE_STDEV +1,0.5053268795706305,0.1650058251884446 +0,0.4946731204293695,0.16500582518844456