SPM-29: done

This commit is contained in:
Johannes Theiner 2019-04-13 10:03:27 +02:00
parent 5530829841
commit 62ea2fc1b7
1 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,45 @@
package de.hsel.spm.baudas.analysis;
import org.jetbrains.annotations.Nullable;
import weka.core.Instances;
import weka.core.converters.CSVLoader;
import java.io.File;
import java.io.IOException;
/**
* base interface for analysis
*
* @author Johannes Theiner
* @version 0.1
* @since 0.1
* @param <T> Type the chosen analysis returns as a result
*/
public interface Analysis<T> {
/**
* loads data from csv file
*
* @param file File to analyze
* @return loaded data in weka format
*/
@Nullable
default Instances load(File file) {
CSVLoader loader = new CSVLoader();
try {
loader.setSource(file);
return loader.getDataSet();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
/**
* result of the analysis
*
* @return result as T
*/
T getResult();
}