openml.runs
.OpenMLRun¶
- class openml.runs.OpenMLRun(task_id: int, flow_id: int | None, dataset_id: int | None, setup_string: str | None = None, output_files: dict[str, int] | None = None, setup_id: int | None = None, tags: list[str] | None = None, uploader: int | None = None, uploader_name: str | None = None, evaluations: dict | None = None, fold_evaluations: dict | None = None, sample_evaluations: dict | None = None, data_content: list[list] | None = None, trace: OpenMLRunTrace | None = None, model: object | None = None, task_type: str | None = None, task_evaluation_measure: str | None = None, flow_name: str | None = None, parameter_settings: list[dict[str, Any]] | None = None, predictions_url: str | None = None, task: OpenMLTask | None = None, flow: OpenMLFlow | None = None, run_id: int | None = None, description_text: str | None = None, run_details: str | None = None)¶
OpenML Run: result of running a model on an OpenML dataset.
- Parameters:
- task_id: int
The ID of the OpenML task associated with the run.
- flow_id: int
The ID of the OpenML flow associated with the run.
- dataset_id: int
The ID of the OpenML dataset used for the run.
- setup_string: str
The setup string of the run.
- output_files: Dict[str, int]
Specifies where each related file can be found.
- setup_id: int
An integer representing the ID of the setup used for the run.
- tags: List[str]
Representing the tags associated with the run.
- uploader: int
User ID of the uploader.
- uploader_name: str
The name of the person who uploaded the run.
- evaluations: Dict
Representing the evaluations of the run.
- fold_evaluations: Dict
The evaluations of the run for each fold.
- sample_evaluations: Dict
The evaluations of the run for each sample.
- data_content: List[List]
The predictions generated from executing this run.
- trace: OpenMLRunTrace
The trace containing information on internal model evaluations of this run.
- model: object
The untrained model that was evaluated in the run.
- task_type: str
The type of the OpenML task associated with the run.
- task_evaluation_measure: str
The evaluation measure used for the task.
- flow_name: str
The name of the OpenML flow associated with the run.
- parameter_settings: list[OrderedDict]
Representing the parameter settings used for the run.
- predictions_url: str
The URL of the predictions file.
- task: OpenMLTask
An instance of the OpenMLTask class, representing the OpenML task associated with the run.
- flow: OpenMLFlow
An instance of the OpenMLFlow class, representing the OpenML flow associated with the run.
- run_id: int
The ID of the run.
- description_text: str, optional
Description text to add to the predictions file. If left None, is set to the time the arff file is generated.
- run_details: str, optional (default=None)
Description of the run stored in the run meta-data.
- classmethod from_filesystem(directory: str | Path, expect_model: bool = True) OpenMLRun ¶
The inverse of the to_filesystem method. Instantiates an OpenMLRun object based on files stored on the file system.
- Parameters:
- directorystr
a path leading to the folder where the results are stored
- expect_modelbool
if True, it requires the model pickle to be present, and an error will be thrown if not. Otherwise, the model might or might not be present.
- Returns:
- runOpenMLRun
the re-instantiated run object
- get_metric_fn(sklearn_fn: Callable, kwargs: dict | None = None) np.ndarray ¶
Calculates metric scores based on predicted values. Assumes the run has been executed locally (and contains run_data). Furthermore, it assumes that the ‘correct’ or ‘truth’ attribute is specified in the arff (which is an optional field, but always the case for openml-python runs)
- Parameters:
- sklearn_fnfunction
a function pointer to a sklearn function that accepts
y_true
,y_pred
and**kwargs
- kwargsdict
kwargs for the function
- Returns:
- scoresndarray of scores of length num_folds * num_repeats
metric results
- property id: int | None¶
The ID of the run, None if not uploaded to the server yet.
- open_in_browser() None ¶
Opens the OpenML web page corresponding to this object in your default browser.
- property openml_url: str | None¶
The URL of the object on the server, if it was uploaded, else None.
- property predictions: DataFrame¶
Return a DataFrame with predictions for this run
- publish() OpenMLBase ¶
Publish the object on the OpenML server.
- push_tag(tag: str) None ¶
Annotates this entity with a tag on the server.
- Parameters:
- tagstr
Tag to attach to the flow.
- remove_tag(tag: str) None ¶
Removes a tag from this entity on the server.
- Parameters:
- tagstr
Tag to attach to the flow.
- to_filesystem(directory: str | Path, store_model: bool = True) None ¶
The inverse of the from_filesystem method. Serializes a run on the filesystem, to be uploaded later.
- Parameters:
- directorystr
a path leading to the folder where the results will be stored. Should be empty
- store_modelbool, optional (default=True)
if True, a model will be pickled as well. As this is the most storage expensive part, it is often desirable to not store the model.
- classmethod url_for_id(id_: int) str ¶
Return the OpenML URL for the object of the class entity with the given id.