|
4 | 4 |
|
5 | 5 | import numpy as np |
6 | 6 | import scipy.sparse |
7 | | -import pandas as pd |
8 | 7 |
|
9 | 8 | # Avoid import cycles: https://mypy.readthedocs.io/en/latest/common_issues.html#import-cycles |
10 | 9 | if TYPE_CHECKING: |
@@ -151,49 +150,50 @@ def _run_model_on_fold( |
151 | 150 | self, |
152 | 151 | model: Any, |
153 | 152 | task: 'OpenMLTask', |
154 | | - X_train: Union[np.ndarray, scipy.sparse.spmatrix, pd.DataFrame], |
155 | | - y_train: np.ndarray, |
| 153 | + X_train: Union[np.ndarray, scipy.sparse.spmatrix], |
156 | 154 | rep_no: int, |
157 | 155 | fold_no: int, |
158 | | - X_test: Optional[Union[np.ndarray, scipy.sparse.spmatrix, pd.DataFrame]] = None, |
159 | | - n_classes: Optional[int] = None, |
160 | | - ) -> Tuple[List[List], List[List], 'OrderedDict[str, float]', Optional['OpenMLRunTrace']]: |
| 156 | + y_train: Optional[np.ndarray] = None, |
| 157 | + X_test: Optional[Union[np.ndarray, scipy.sparse.spmatrix]] = None, |
| 158 | + classes: Optional[List] = None, |
| 159 | + ) -> Tuple[np.ndarray, np.ndarray, 'OrderedDict[str, float]', Any]: |
161 | 160 | """Run a model on a repeat,fold,subsample triplet of the task and return prediction information. |
162 | 161 |
|
163 | 162 | Returns the data that is necessary to construct the OpenML Run object. Is used by |
164 | | - run_task_get_arff_content. |
| 163 | + :func:`openml.runs.run_flow_on_task`. |
165 | 164 |
|
166 | 165 | Parameters |
167 | 166 | ---------- |
168 | 167 | model : Any |
169 | 168 | The UNTRAINED model to run. The model instance will be copied and not altered. |
170 | 169 | task : OpenMLTask |
171 | 170 | The task to run the model on. |
| 171 | + X_train : array-like |
| 172 | + Training data for the given repetition and fold. |
172 | 173 | rep_no : int |
173 | 174 | The repeat of the experiment (0-based; in case of 1 time CV, always 0) |
174 | 175 | fold_no : int |
175 | 176 | The fold nr of the experiment (0-based; in case of holdout, always 0) |
176 | | - sample_no : int |
177 | | - In case of learning curves, the index of the subsample (0-based; in case of no |
178 | | - learning curve, always 0) |
179 | | - add_local_measures : bool |
180 | | - Determines whether to calculate a set of measures (i.e., predictive accuracy) locally, |
181 | | - to later verify server behaviour. |
| 177 | + y_train : Optional[np.ndarray] (default=None) |
| 178 | + Target attributes for supervised tasks. In case of classification, these are integer |
| 179 | + indices to the potential classes specified by dataset. |
| 180 | + X_test : Optional, array-like (default=None) |
| 181 | + Test attributes to test for generalization in supervised tasks. |
| 182 | + classes : List |
| 183 | + List of classes for supervised classification tasks (and supervised data stream |
| 184 | + classification). |
182 | 185 |
|
183 | 186 | Returns |
184 | 187 | ------- |
185 | | - arff_datacontent : List[List] |
186 | | - Arff representation (list of lists) of the predictions that were |
187 | | - generated by this fold (required to populate predictions.arff) |
188 | | - arff_tracecontent : List[List] |
189 | | - Arff representation (list of lists) of the trace data that was generated by this fold |
190 | | - (will be used to populate trace.arff, leave it empty if the model did not perform any |
191 | | - hyperparameter optimization). |
| 188 | + predictions : np.ndarray |
| 189 | + Model predictions. |
| 190 | + probabilities : Optional, np.ndarray |
| 191 | + Predicted probabilities (only applicable for supervised classification tasks). |
192 | 192 | user_defined_measures : OrderedDict[str, float] |
193 | 193 | User defined measures that were generated on this fold |
194 | | - model : Any |
195 | | - The model trained on this repeat,fold,subsample triple. Will be used to generate trace |
196 | | - information later on (in ``obtain_arff_trace``). |
| 194 | + trace : Optional, OpenMLRunTrace |
| 195 | + Hyperparameter optimization trace (only applicable for supervised tasks with |
| 196 | + hyperparameter optimization). |
197 | 197 | """ |
198 | 198 |
|
199 | 199 | @abstractmethod |
|
0 commit comments