OpenmlWeka

Library for connecting Weka algorithms to OpenML.

License

License

GroupId

GroupId

org.openml
ArtifactId

ArtifactId

openmlweka
Last Version

Last Version

0.9.7
Release Date

Release Date

Type

Type

jar
Description

Description

OpenmlWeka
Library for connecting Weka algorithms to OpenML.
Project URL

Project URL

https://openml.org/
Project Organization

Project Organization

Leiden University, NL
Source Code Management

Source Code Management

https://github.com/openml/openml-weka

Download openmlweka

How to add to project

<!-- https://jarcasting.com/artifacts/org.openml/openmlweka/ -->
<dependency>
    <groupId>org.openml</groupId>
    <artifactId>openmlweka</artifactId>
    <version>0.9.7</version>
</dependency>
// https://jarcasting.com/artifacts/org.openml/openmlweka/
implementation 'org.openml:openmlweka:0.9.7'
// https://jarcasting.com/artifacts/org.openml/openmlweka/
implementation ("org.openml:openmlweka:0.9.7")
'org.openml:openmlweka:jar:0.9.7'
<dependency org="org.openml" name="openmlweka" rev="0.9.7">
  <artifact name="openmlweka" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.openml', module='openmlweka', version='0.9.7')
)
libraryDependencies += "org.openml" % "openmlweka" % "0.9.7"
[org.openml/openmlweka "0.9.7"]

Dependencies

compile (6)

Group / Artifact Type Version
org.openml : apiconnector jar 1.0.23
org.json : json jar 20140107
org.apache.commons : commons-lang3 jar 3.1
org.apache.commons : commons-math3 jar 3.6.1
nz.ac.waikato.cms.weka : weka-dev jar [3.9.0,)
com.github.fracpete : multisearch-weka-package jar [2018.9.2,)

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

OpenML Weka Connector

License Build Status Coverage Status

Package for uploading Weka experiments to OpenML. Works in combination with the OpenML Apiconnector (available on Maven Central; version >= 1.0.14) and Weka (available on Maven Central; version >= 3.9.0)

Downloading datasets from OpenML

The following code example downloads a specific set of OpenML datasets and loads them into the Weka data format (weka.core.Instances), that can be used trivially for off line development and experimenting.

public static void downloadData() throws Exception {
  // Fill in the API key (obtainable from your OpenML profile)
  String apikey = "<FILL_IN_OPENML_API_KEY>";
  
  // Instantiate the OpenmlConnector object 
  // requires artifact org.openml.apiconnector (version 1.0.14) from Maven central
  OpenmlConnector openml = new OpenmlConnector(apikey);
  
  // Download the OpenML object containing the `OpenML100' benchmark set
  Study s = openml.studyGet("OpenML100", "data");
  
  // Loop over all the datasets
  for (Integer dataId : s.getDataset()) {
    // DataSetDescription is an OpenML object containing meta-information about the dataset
    DataSetDescription dsd = openml.dataGet(dataId);
    
    // datasetFile downloads the raw dataset file from openml
    File datasetFile = dsd.getDataset(apikey);
    
    // Converts this file into the Weka format
    Instances dataset = new Instances(new FileReader(datasetFile));
    System.out.println("Downloaded " + dsd.getName());
    System.out.println("numObservations = " + dataset.numInstances() + "; numFeatures = " + dataset.numAttributes());
  }
}

Uploading Weka experiments

The following code example downloads a specific set of OpenML tasks (dubbed: the OpenML100) and executes a NaiveBayes classifier on it.

public static void runTasksAndUpload() throws Exception {
  // Fill in the API key (obtainable from your OpenML profile)
  String apikey = "<FILL_IN_APIKEY>";
  
  // The WekaConfig module gives us the possibilities to enable or disable various Weka Specific options
  WekaConfig config = new WekaConfig();
  
  // Instantiate the OpenmlConnector object 
  // requires artifact org.openml.apiconnector (version >= 1.0.14) from Maven central
  OpenmlConnector openml = new OpenmlConnector(apikey);
  
  // Download the OpenML object containing the `OpenML100' benchmark set
  Study s = openml.studyGet("OpenML100", "tasks");
  
  // Loop over all the tasks
  for (Integer taskId : s.getTasks()) {
    // create a Weka classifier to run on the task
    Classifier tree = new NaiveBayes();
    
    // execute the task (can take a while, depending on the classifier / dataset combination)
    int runId = RunOpenmlJob.executeTask(openml, config, taskId, tree);
    
    // After several minutes, the evaluation measures will be available on the server
    System.out.println("Available on " + openml.getApiUrl() + "run/" + runId);
    
    // Download the run from the server:
    Run run = openml.runGet(runId);
  }
}

Obtaining experimental results from OpenML

OpenML contains a large number of experiments, conveniently available for everyone. In order to obtain and analyse these results, the OpenML Apiconnector could be of use. Please follow the demonstration depicted on the respective Github page.

How to cite

If you found this package useful, please cite: J. N. van Rijn, Massively Collaborative Machine Learning, Leiden University, 2016. If you used OpenML in a scientific publication, please check out the OpenML citation policy.

org.openml

OpenML

Open, Networked Machine Learning

Versions

Version
0.9.7
0.9.6
0.9.5