Skip to content

Commit

Permalink
22064: Adds rebalance_features to analyze(), MINOR
Browse files Browse the repository at this point in the history
  • Loading branch information
howsoRes committed Oct 31, 2024
1 parent ae1849b commit 44ce417
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
13 changes: 13 additions & 0 deletions howso/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[Collection[str]] = None,
targeted_model: t.Optional[TargetedModel] = None,
use_case_weights: t.Optional[bool] = None,
use_deviations: t.Optional[bool] = None,
Expand Down Expand Up @@ -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 of 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:
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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[Collection[str]] = None,
targeted_model: t.Optional[TargetedModel] = None,
use_deviations: t.Optional[bool] = None,
use_case_weights: t.Optional[bool] = None,
Expand Down Expand Up @@ -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 of 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:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions howso/engine/trainee.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[Collection[str]] = None,
targeted_model: t.Optional[TargetedModel] = None,
use_case_weights: t.Optional[bool] = None,
use_deviations: t.Optional[bool] = None,
Expand Down Expand Up @@ -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 of 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:
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"howso-engine": "89.0.2"
"howso-engine": "89.1.0"
}
}

0 comments on commit 44ce417

Please sign in to comment.