Java
The Java API allows you connect to OpenML from Java applications.
Java Docs¶
Download¶
Stable releases of the Java API are available from Maven Central Or, you can check out the developer version from GitHub
Include the jar file in your projects as usual, or install via Maven.
Quick Start¶
- Create an
OpenmlConnector
instance with your authentication details. This will create a client with all OpenML functionalities.OpenmlConnector client = new OpenmlConnector("api_key")
All functions are described in the Java Docs.
Downloading¶
To download data, flows, tasks, runs, etc. you need the unique id of that resource. The id is shown on each item's webpage and in the corresponding url. For instance, let's download Data set 1. The following returns a DataSetDescription object that contains all information about that data set.
You can also search for the items you need online, and click the icon to get all id's that match a search.
Uploading¶
To upload data, flows, runs, etc. you need to provide a description of the object. We provide wrapper classes to provide this information, e.g. DataSetDescription
, as well as to capture the server response, e.g. UploadDataSet
, which always includes the generated id for reference:
More details are given in the corresponding functions below. Also see the Java Docs for all possible inputs and return values.
Data download¶
dataGet(int data_id)
¶
Retrieves the description of a specified data set.
dataFeatures(int data_id)
¶
Retrieves the description of the features of a specified data set.
dataQuality(int data_id)
¶
Retrieves the description of the qualities (meta-features) of a specified data set.
dataQuality(int data_id, int start, int end, int interval_size)
¶
For data streams. Retrieves the description of the qualities (meta-features) of a specified portion of a data stream.
dataQualityList()
¶
Retrieves a list of all data qualities known to OpenML.
Data upload¶
dataUpload(DataSetDescription description, File dataset)
¶
Uploads a data set file to OpenML given a description. Throws an exception if the upload failed, see openml.data.upload for error codes.
dataUpload(DataSetDescription description)
¶
Registers an existing dataset (hosted elsewhere). The description needs to include the url of the data set. Throws an exception if the upload failed, see openml.data.upload for error codes.
Flow download¶
flowGet(int flow_id)
¶
Retrieves the description of the flow/implementation with the given id.
Flow management¶
flowOwned()
¶
Retrieves an array of id's of all flows/implementations owned by you.
flowExists(String name, String version)
¶
Checks whether an implementation with the given name and version is already registered on OpenML.
flowDelete(int id)
¶
Removes the flow with the given id (if you are its owner).
Flow upload¶
flowUpload(Implementation description, File binary, File source)
¶
Uploads implementation files (binary and/or source) to OpenML given a description.
Task download¶
taskGet(int task_id)
¶
Retrieves the description of the task with the given id.
taskEvaluations(int task_id)
¶
Retrieves all evaluations for the task with the given id.
taskEvaluations(int task_id, int start, int end, int interval_size)
¶
For data streams. Retrieves all evaluations for the task over the specified window of the stream.
Run download¶
runGet(int run_id)
¶
Retrieves the description of the run with the given id.
Run management¶
runDelete(int run_id)
¶
Deletes the run with the given id (if you are its owner).
Run upload¶
runUpload(Run description, Map<String,File> output_files)
¶
Uploads a run to OpenML, including a description and a set of output files depending on the task type.