EPM
EPM
The EPM (Empirical Performance Model) class is a wrapper for machine learning models that includes preprocessing, normalization, and optional inverse transformation of predictions.
Attributes:
Name | Type | Description |
---|---|---|
predictor_class |
Type[AbstractPredictor] | Type[RegressorMixin]
|
The class of the predictor to use. |
normalization_class |
Type[AbstractNormalization]
|
The normalization class to apply to the target variable. |
transform_back |
bool
|
Whether to apply inverse transformation to predictions. |
features_preprocessing |
Union[str, TransformerMixin]
|
Preprocessing pipeline for features. |
predictor_config |
Optional[dict]
|
Configuration for the predictor. |
predictor_kwargs |
Optional[dict]
|
Additional keyword arguments for the predictor. |
Source code in asf/epm/epm.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 |
|
__init__(predictor_class, normalization_class=LogNormalization, transform_back=True, features_preprocessing='default', categorical_features=None, numerical_features=None, predictor_config=None, predictor_kwargs=None)
Initialize the EPM model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
predictor_class
|
Type[AbstractPredictor] | Type[RegressorMixin]
|
The class of the predictor to use. |
required |
normalization_class
|
Type[AbstractNormalization]
|
The normalization class to apply to the target variable. |
LogNormalization
|
transform_back
|
bool
|
Whether to apply inverse transformation to predictions. |
True
|
features_preprocessing
|
Union[str, TransformerMixin]
|
Preprocessing pipeline for features. |
'default'
|
categorical_features
|
Optional[list]
|
List of categorical feature names. |
None
|
numerical_features
|
Optional[list]
|
List of numerical feature names. |
None
|
predictor_config
|
Optional[dict]
|
Configuration for the predictor. |
None
|
predictor_kwargs
|
Optional[dict]
|
Additional keyword arguments for the predictor. |
None
|
Source code in asf/epm/epm.py
fit(X, y, sample_weight=None)
Fit the EPM model to the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Union[DataFrame, Series, list]
|
Features. |
required |
y
|
Union[Series, list]
|
Target variable. |
required |
sample_weight
|
Optional[list]
|
Sample weights (optional). |
None
|
Returns:
Name | Type | Description |
---|---|---|
EPM |
EPM
|
The fitted EPM model. |
Source code in asf/epm/epm.py
predict(X)
Predict using the fitted EPM model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Union[DataFrame, Series, list]
|
Features. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
Predicted values. |
Source code in asf/epm/epm.py
tune_epm(X, y, model_class, normalization_class=LogNormalization, features_preprocessing='default', categorical_features=None, numerical_features=None, groups=None, cv=5, timeout=3600, runcount_limit=100, output_dir='./smac_output', seed=0, smac_metric=mean_squared_error, smac_scenario_kwargs={}, smac_kwargs={}, predictor_kwargs={})
Tune the Empirical Performance Model (EPM) using SMAC (Sequential Model-based Algorithm Configuration).
Parameters:
X : np.ndarray Feature matrix for training and validation. y : np.ndarray Target values corresponding to the feature matrix. model_class : Type[AbstractPredictor] The predictor class to be tuned. normalization_class : Type[AbstractNormalization], optional The normalization class to be applied to the data. Defaults to LogNormalization. features_preprocessing : Union[str, TransformerMixin], optional Preprocessing method for features. Defaults to "default". categorical_features : Optional[list], optional List of categorical feature names. Defaults to None. numerical_features : Optional[list], optional List of numerical feature names. Defaults to None. groups : Optional[np.ndarray], optional Group labels for cross-validation. Defaults to None. cv : int, optional Number of cross-validation folds. Defaults to 5. timeout : int, optional Time limit for the tuning process in seconds. Defaults to 3600. runcount_limit : int, optional Maximum number of configurations to evaluate. Defaults to 100. output_dir : str, optional Directory to store SMAC output. Defaults to "./smac_output". seed : int, optional Random seed for reproducibility. Defaults to 0. smac_metric : callable, optional Metric function to evaluate model performance. Defaults to mean_squared_error. smac_scenario_kwargs : Optional[dict], optional Additional keyword arguments for the SMAC scenario. Defaults to None. smac_kwargs : Optional[dict], optional Additional keyword arguments for SMAC optimization. Defaults to None. predictor_kwargs : Optional[dict], optional Additional keyword arguments for the predictor. Defaults to None.
Returns:
EPM The tuned Empirical Performance Model instance.
Source code in asf/epm/epm_tuner.py
16 17 18 19 20 21 22 23 24 25 26 27 28 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 |
|