Merge remote-tracking branch 'origin/master' into SPM-14
This commit is contained in:
commit
0c3b480023
|
@ -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();
|
||||||
|
}
|
Loading…
Reference in New Issue