Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional unit test for NeurIPS benchmarking paper #26

Open
janvanrijn opened this issue Oct 26, 2021 · 0 comments
Open

additional unit test for NeurIPS benchmarking paper #26

janvanrijn opened this issue Oct 26, 2021 · 0 comments

Comments

@janvanrijn
Copy link
Member

TODO: add unit test

package openmlweka;

import org.apache.commons.lang3.tuple.Pair;
import org.junit.Test;
import org.openml.apiconnector.io.OpenmlConnector;
import org.openml.apiconnector.xml.Run;
import org.openml.apiconnector.xml.Study;
import org.openml.apiconnector.xml.Task;
import org.openml.weka.algorithm.InstancesHelper;
import org.openml.weka.algorithm.WekaConfig;
import org.openml.weka.experiment.RunOpenmlJob;

import weka.classifiers.Classifier;
import weka.classifiers.trees.REPTree;
import weka.core.Instances;


public class TestOpenMLBenchmarkingSuites extends BaseTestFramework {

	
	@Test
	public void NeurIPSBenchmarkPaperCodeSample() throws Exception {
		OpenmlConnector openml = client_write_test; // OpenmlConnector openml = new OpenMLConnector();
		  Study benchmarksuite = openml.studyGet("OpenML100", "tasks"); // OpenML-CC18          // obtain the benchmark suite
		  Classifier tree = new REPTree();                                          // build a Weka classifier
		  for (Integer taskId : benchmarksuite.getTasks()) {                        // iterate over all tasks
		    Task t = openml.taskGet(taskId);                                        // download the OpenML task
		    if (t.getTask_id() > 10) { break; }
		    Instances d = InstancesHelper.getDatasetFromTask(openml, t);            // obtain the dataset
		    // openml.setApiKey("FILL_IN_OPENML_API_KEY");
		    Pair<Integer, Run> result = RunOpenmlJob.executeTask(openml, new WekaConfig("skip_jvm_benchmark=true; avoid_duplicate_runs=false"), taskId, tree);
		    Run run = openml.runGet(result.getLeft());}                             // retrieve the uploaded run
	}
} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant