Log Grid Search#
- class abil.log_grid_search.LogGridSearch(m, verbose, cv, param_grid, scoring, regions=None)#
Bases:
object
Perform grid search with optional logarithmic transformation of the target variable.
Supports evaluating models with no transformation, log-transformation, or both.
- do_exp(x)#
Apply exponential transformation to the input values.
- Parameters:
x (array-like) – Input values.
- Returns:
y – Exponentially transformed values.
- Return type:
array-like
- do_log(x)#
Apply natural logarithm transformation to the input values.
- Parameters:
x (array-like) – Input values.
- Returns:
y – Log-transformed values.
- Return type:
array-like
- do_nothing(x)#
Apply no transformation to the input values.
- Parameters:
x (array-like) – Input values.
- Returns:
y – Non-transformed values.
- Return type:
array-like
- transformed_fit(X, y, log, predictors)#
Perform grid search with optional log transformation on the target variable.
- Parameters:
X (pd.DataFrame or np.ndarray) – Feature matrix.
y (pd.Series or np.ndarray) – Target variable.
log (str) – Transformation mode: “yes” (log transform), “no” (no transform), or “both” (test both).
predictors (list) – Predictors used for training (not directly used in the function).
- Returns:
Fitted grid search instance for the best-performing model.
- Return type:
GridSearchCV
Notes
Applies log transformation using TransformedTargetRegressor when log=”yes”.
If log=”both”, compares models with and without log transformation.
Uses self.param_grid, self.scoring, and self.cv for grid search.
- Raises:
ValueError – If log is not “yes”, “no”, or “both”.