EPM
EPM
Empirical Performance Model wrapper.
The EPM (Empirical Performance Model) class is a wrapper for machine learning models that includes preprocessing, normalization, and optional inverse transformation of predictions.
Parameters
predictor_class : type[AbstractPredictor] or type[RegressorMixin], default=RandomForestRegressorWrapper The class of the predictor to use. normalization_class : type[AbstractNormalization], default=LogNormalization The normalization class to apply to the target variable. transform_back : bool, default=True Whether to apply inverse transformation to predictions. features_preprocessing : str or TransformerMixin, default="default" Preprocessing pipeline for features. categorical_features : list or None, default=None List of categorical feature names. numerical_features : list or None, default=None List of numerical feature names. predictor_config : dict or None, default=None Configuration for the predictor. predictor_kwargs : dict or None, default=None Additional keyword arguments for the predictor. imputer : Callable or None, default=None Optional imputer function for target variables.
Source code in asf/epm/epm.py
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 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 | |
fit(X, y, sample_weight=None)
Fit the EPM model.
Parameters
X : pd.DataFrame, pd.Series, np.ndarray, or list Input features. y : pd.Series, np.ndarray, or list Target values. sample_weight : list, np.ndarray, or None, default=None Sample weights.
Returns
EPM The fitted model.
Source code in asf/epm/epm.py
predict(X)
Predict targets.
Parameters
X : pd.DataFrame, pd.Series, np.ndarray, or list Input features.
Returns
np.ndarray 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=None, smac_kwargs=None, predictor_kwargs=None)
Tune the Empirical Performance Model (EPM) using SMAC.
Parameters
X : np.ndarray or pd.DataFrame Feature matrix for training and validation. y : np.ndarray or pd.Series Target values corresponding to the feature matrix. model_class : type[AbstractPredictor] The predictor class to be tuned. normalization_class : type[AbstractNormalization], default=LogNormalization The normalization class to be applied to the data. features_preprocessing : str or TransformerMixin, default="default" Preprocessing method for features. categorical_features : list or None, default=None List of categorical feature names. numerical_features : list or None, default=None List of numerical feature names. groups : np.ndarray or None, default=None Group labels for cross-validation. cv : int, default=5 Number of cross-validation folds. timeout : int, default=3600 Time limit for the tuning process in seconds. runcount_limit : int, default=100 Maximum number of configurations to evaluate. output_dir : str, default="./smac_output" Directory to store SMAC output. seed : int, default=0 Random seed for reproducibility. smac_metric : Callable, default=mean_squared_error Metric function to evaluate model performance. smac_scenario_kwargs : dict or None, default=None Additional keyword arguments for the SMAC scenario. smac_kwargs : dict or None, default=None Additional keyword arguments for SMAC optimization. predictor_kwargs : dict or None, default=None Additional keyword arguments for the predictor.
Returns
EPM The tuned Empirical Performance Model instance.
Raises
RuntimeError If SMAC is not installed.
Source code in asf/epm/epm_tuner.py
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 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 | |