RegressionCV
Auto-tuned regression with Bayesian optimization. For practical examples, see the API Guide.
regression_cv
Definition for RegressionCV.
RegressionCV
Bases: BaseAutoCV, RegressorMixin, ExplainerMixIn
Defines an auto regression tree, based on the bayesian optimization base class.
Source code in src/tree_machine/regression_cv.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
scorer
property
scorer
Returns correct scorer to use when scoring with RegressionCV.
__init__
__init__(metric, cv, n_trials, timeout, config, backend='xgboost')
Constructor for RegressionCV.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
AcceptableRegression
|
Loss metric to use as base for the estimation process. |
required |
cv
|
BaseCrossValidator
|
Splitter object to use when estimating the model. |
required |
n_trials
|
NonNegativeInt
|
Number of optimization trials to use when finding a model. |
required |
timeout
|
NonNegativeInt
|
Timeout in seconds to stop the optimization. |
required |
config
|
RegressionCVConfig
|
Configuration to use when fitting the model. |
required |
backend
|
str
|
Backend to use for the model. Either "xgboost" or "catboost". |
'xgboost'
|
Source code in src/tree_machine/regression_cv.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
explain
explain(X, **explainer_params)
Explains the inputs.
Source code in src/tree_machine/regression_cv.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
fit
fit(X, y, **fit_params)
Fits RegressionCV.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Inputs
|
input data to use in fitting trees. |
required |
y
|
GroundTruth
|
actual targets for fitting. |
required |
Source code in src/tree_machine/regression_cv.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
predict
predict(X)
Returns model predictions.
Source code in src/tree_machine/regression_cv.py
190 191 192 193 194 195 | |
RegressionCVConfig
Available config to use when fitting a regression model.
dictionary containing monotonicity direction allowed for each
variable. 0 means no monotonicity, 1 means increasing and -1 means decreasing monotonicity.
interactions: list of lists containing permitted relationships in data. n_jobs: Number of jobs to use when fitting the model. parameters: dictionary with distribution bounds for each hyperparameter to search on during optimization. return_train_score: whether to return the train score when fitting the model. quantile_alpha: Quantile alpha to use when fitting the model, if fitting a quantile model.
Source code in src/tree_machine/regression_cv.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_kwargs
get_kwargs(feature_names, backend='xgboost')
Returns parsed and validated constraint configuration for a RegressionCV model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_names
|
list[str]
|
list of feature names. If empty, will return empty constraints dictionaries and lists. |
required |
backend
|
str
|
Backend to use for the model. Either "xgboost" or "catboost". |
'xgboost'
|
Source code in src/tree_machine/regression_cv.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |