openml.OpenMLFlow

class openml.OpenMLFlow(name, description, model, components, parameters, parameters_meta_info, external_version, tags, language, dependencies, class_name=None, custom_name=None, binary_url=None, binary_format=None, binary_md5=None, uploader=None, upload_date=None, flow_id=None, extension=None, version=None)

OpenML Flow. Stores machine learning models.

Flows should not be generated manually, but by the function openml.flows.create_flow_from_model(). Using this helper function ensures that all relevant fields are filled in.

Implements https://github.com/openml/website/blob/master/openml_OS/ views/pages/api_new/v1/xsd/openml.implementation.upload.xsd.

Parameters
namestr

Name of the flow. Is used together with the attribute external_version as a unique identifier of the flow.

descriptionstr

Human-readable description of the flow (free text).

modelobject

ML model which is described by this flow.

componentsOrderedDict

Mapping from component identifier to an OpenMLFlow object. Components are usually subfunctions of an algorithm (e.g. kernels), base learners in ensemble algorithms (decision tree in adaboost) or building blocks of a machine learning pipeline. Components are modeled as independent flows and can be shared between flows (different pipelines can use the same components).

parametersOrderedDict

Mapping from parameter name to the parameter default value. The parameter default value must be of type str, so that the respective toolbox plugin can take care of casting the parameter default value to the correct type.

parameters_meta_infoOrderedDict

Mapping from parameter name to dict. Stores additional information for each parameter. Required keys are data_type and description.

external_versionstr

Version number of the software the flow is implemented in. Is used together with the attribute name as a uniquer identifier of the flow.

tagslist

List of tags. Created on the server by other API calls.

languagestr

Natural language the flow is described in (not the programming language).

dependenciesstr

A list of dependencies necessary to run the flow. This field should contain all libraries the flow depends on. To allow reproducibility it should also specify the exact version numbers.

class_namestr

The development language name of the class which is described by this flow.

custom_namestr

Custom name of the flow given by the owner.

binary_urlstr, optional

Url from which the binary can be downloaded. Added by the server. Ignored when uploaded manually. Will not be used by the python API because binaries aren’t compatible across machines.

binary_formatstr, optional

Format in which the binary code was uploaded. Will not be used by the python API because binaries aren’t compatible across machines.

binary_md5str, optional

MD5 checksum to check if the binary code was correctly downloaded. Will not be used by the python API because binaries aren’t compatible across machines.

uploaderstr, optional

OpenML user ID of the uploader. Filled in by the server.

upload_datestr, optional

Date the flow was uploaded. Filled in by the server.

flow_idint, optional

Flow ID. Assigned by the server.

versionstr, optional

OpenML version of the flow. Assigned by the server.

get_structure(self, key_item: str) → Dict[str, List[str]]

Returns for each sub-component of the flow the path of identifiers that should be traversed to reach this component. The resulting dict maps a key (identifying a flow by either its id, name or fullname) to the parameter prefix.

Parameters
key_item: str

The flow attribute that will be used to identify flows in the structure. Allowed values {flow_id, name}

Returns
dict[str, List[str]]

The flow structure

get_subflow(self, structure)

Returns a subflow from the tree of dependencies.

Parameters
structure: list[str]

A list of strings, indicating the location of the subflow

Returns
OpenMLFlow

The OpenMLFlow that corresponds to the structure

property id

The id of the entity, it is unique for its entity type.

open_in_browser(self)

Opens the OpenML web page corresponding to this object in your default browser.

property openml_url

The URL of the object on the server, if it was uploaded, else None.

publish(self, raise_error_if_exists: bool = False) → 'OpenMLFlow'

Publish this flow to OpenML server.

Raises a PyOpenMLError if the flow exists on the server, but self.flow_id does not match the server known flow id.

Parameters
raise_error_if_existsbool, optional (default=False)

If True, raise PyOpenMLError if the flow exists on the server. If False, update the local flow to match the server flow.

Returns
selfOpenMLFlow
push_tag(self, tag: str)

Annotates this entity with a tag on the server.

Parameters
tagstr

Tag to attach to the flow.

remove_tag(self, tag: str)

Removes a tag from this entity on the server.

Parameters
tagstr

Tag to attach to the flow.

classmethod url_for_id(id_: int) → str

Return the OpenML URL for the object of the class entity with the given id.