From 08d511b94c7b0c39b915f36d52095516709dd3a8 Mon Sep 17 00:00:00 2001 From: howsoRes <144272317+howsoRes@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:09:32 -0400 Subject: [PATCH] 22064: Adds rebalance_features to analyze(), MINOR (#317) --- howso/client/base.py | 13 +++++++++++++ howso/engine/trainee.py | 6 ++++++ version.json | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/howso/client/base.py b/howso/client/base.py index 883562eb..50f5dcee 100644 --- a/howso/client/base.py +++ b/howso/client/base.py @@ -3639,6 +3639,7 @@ def analyze( num_analysis_samples: t.Optional[int] = None, num_samples: t.Optional[int] = None, p_values: t.Optional[Collection[float]] = None, + rebalance_features: t.Optional[t.Collection[str]] = None, targeted_model: t.Optional[TargetedModel] = None, use_case_weights: t.Optional[bool] = None, use_deviations: t.Optional[bool] = None, @@ -3683,6 +3684,10 @@ def analyze( The number of samples used in calculating feature residuals. p_values : Collection of float, optional The p value hyperparameters to analyze with. + rebalance_features : Collection[str], optional + The list of features whose values to use to rebalance case + weighting of the data and to store into weight_feature. + Cannot be used with ablation. targeted_model : {"omni_targeted", "single_targeted", "targetless"}, optional Type of hyperparameter targeting. Valid options include: @@ -3711,6 +3716,7 @@ def analyze( util.validate_list_shape(context_features, 1, "context_features", "str") util.validate_list_shape(action_features, 1, "action_features", "str") + util.validate_list_shape(rebalance_features, 1, "rebalance_features", "str") util.validate_list_shape(p_values, 1, "p_values", "int") util.validate_list_shape(k_values, 1, "k_values", "float") util.validate_list_shape(dt_values, 1, "dt_values", "float") @@ -3761,6 +3767,7 @@ def analyze( num_samples=num_samples, analysis_sub_model_size=analysis_sub_model_size, p_values=p_values, + rebalance_features=rebalance_features, targeted_model=targeted_model, use_deviations=use_deviations, weight_feature=weight_feature, @@ -3829,6 +3836,7 @@ def set_auto_analyze_params( num_analysis_samples: t.Optional[int] = None, num_samples: t.Optional[int] = None, p_values: t.Optional[Collection[float]] = None, + rebalance_features: t.Optional[t.Collection[str]] = None, targeted_model: t.Optional[TargetedModel] = None, use_deviations: t.Optional[bool] = None, use_case_weights: t.Optional[bool] = None, @@ -3873,6 +3881,10 @@ def set_auto_analyze_params( When True, bypasses calculation of feature weights. bypass_hyperparameter_analysis : bool, optional When True, bypasses hyperparameter analysis. + rebalance_features : Collection[str], optional + The list of features whose values to use to rebalance case + weighting of the data and to store into weight_feature. + Cannot be used with ablation. targeted_model : Literal["omni_targeted", "single_targeted", "targetless"], optional Type of hyperparameter targeting. Valid options include: @@ -3982,6 +3994,7 @@ def set_auto_analyze_params( "bypass_hyperparameter_analysis": bypass_hyperparameter_analysis, "bypass_calculate_feature_residuals": bypass_calculate_feature_residuals, "bypass_calculate_feature_weights": bypass_calculate_feature_weights, + "rebalance_features": rebalance_features, "targeted_model": targeted_model, "num_analysis_samples": num_analysis_samples, "analysis_sub_model_size": analysis_sub_model_size, diff --git a/howso/engine/trainee.py b/howso/engine/trainee.py index 228362e6..a3e33da9 100644 --- a/howso/engine/trainee.py +++ b/howso/engine/trainee.py @@ -960,6 +960,7 @@ def analyze( num_samples: t.Optional[int] = None, analysis_sub_model_size: t.Optional[int] = None, p_values: t.Optional[Collection[float]] = None, + rebalance_features: t.Optional[t.Collection[str]] = None, targeted_model: t.Optional[TargetedModel] = None, use_case_weights: t.Optional[bool] = None, use_deviations: t.Optional[bool] = None, @@ -1001,6 +1002,10 @@ def analyze( randomly held-out and not included in calculations. p_values : Collection of float, optional The p value hyperparameters to analyze with. + rebalance_features : Collection[str], optional + The list of features whose values to use to rebalance case + weighting of the data and to store into weight_feature. + Cannot be used with ablation. targeted_model : {"omni_targeted", "single_targeted", "targetless"}, optional Type of hyperparameter targeting. Valid options include: @@ -1043,6 +1048,7 @@ def analyze( num_samples=num_samples, analysis_sub_model_size=analysis_sub_model_size, p_values=p_values, + rebalance_features=rebalance_features, targeted_model=targeted_model, use_deviations=use_deviations, weight_feature=weight_feature, diff --git a/version.json b/version.json index 28bd6c79..29c43470 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { "dependencies": { - "howso-engine": "89.0.2" + "howso-engine": "89.1.0" } }