All Downloads are FREE. Search and download functionalities are using the official Maven repository.

moa.evaluation.preview.Preview Maven / Gradle / Ivy

Go to download

Massive On-line Analysis is an environment for massive data mining. MOA provides a framework for data stream mining and includes tools for evaluation and a collection of machine learning algorithms. Related to the WEKA project, also written in Java, while scaling to more demanding problems.

The newest version!
/*
 *    Preview.java
 *    Copyright (C) 2017 Otto-von-Guericke-University, Magdeburg, Germany
 *    @author Tuan Pham Minh ([email protected])
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program. If not, see .
 *    
 */
package moa.evaluation.preview;

import java.util.ArrayList;
import java.util.List;

import moa.AbstractMOAObject;

/**
 * Abstract class which is used to define the methods needed from a preview
 *
 * @author Tuan Pham Minh ([email protected])
 * @version $Revision: 1 $
 */
public abstract class Preview extends AbstractMOAObject{
	private static final long serialVersionUID = 1L;

	// TODO add methods to return a 2D double array
	public abstract int getMeasurementNameCount();

	public abstract String getMeasurementName(int measurementIndex);

	public abstract int numEntries();

	public abstract String entryToString(int entryIndex);

	public abstract Class getTaskClass();

	public abstract double[] getEntryData(int entryIndex);
	
	public String[] getMeasurementNames() {
		int numNames = getMeasurementNameCount();
		String[] names = new String[numNames];
		for (int i = 0; i < numNames; i++) {
			names[i] = getMeasurementName(i);
		}
		return names;
	}

	public List getData()
	{
		// create list to store all entries
		List data = new ArrayList<>();
		// add all entries in the list above
        for (int entryIdx = 0; entryIdx < numEntries(); entryIdx++) {
            data.add(getEntryData(entryIdx));
        }
		
		return data;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy