public class ScikitLearnWrapper extends java.lang.Object implements IInstancesClassifier, weka.classifiers.Classifier
| Modifier and Type | Class and Description |
|---|---|
static class |
ScikitLearnWrapper.ProblemType |
| Constructor and Description |
|---|
ScikitLearnWrapper(java.lang.String constructInstruction,
java.lang.String imports)
Starts a new wrapper and creates its underlying script with the given parameters.
|
ScikitLearnWrapper(java.lang.String constructInstruction,
java.lang.String imports,
boolean withoutModelDump)
Starts a new wrapper and creates its underlying script with the given parameters.
|
ScikitLearnWrapper(java.lang.String constructInstruction,
java.lang.String imports,
java.io.File trainedModelPath) |
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(weka.core.Instances data) |
double |
classifyInstance(weka.core.Instance instance) |
double[] |
classifyInstances(weka.core.Instances data) |
static java.lang.String |
createImportStatementFromImportFolder(java.io.File importsFolder,
boolean keepNamespace)
Makes the given folder a module to be usable as an import for python and creates a string that adds the folder to the python environment and then imports the folder itself as a module.
|
double[] |
distributionForInstance(weka.core.Instance instance) |
weka.core.Capabilities |
getCapabilities() |
static java.lang.String |
getImportString(java.util.Collection<java.lang.String> imports) |
java.io.File |
getModelPath() |
java.util.List<java.util.List<java.lang.Double>> |
getRawLastClassificationResults() |
void |
setModelPath(java.io.File modelFile) |
void |
setProblemType(ScikitLearnWrapper.ProblemType problemType) |
void |
setTargets(int... targetColumns) |
java.lang.String |
toString() |
public ScikitLearnWrapper(java.lang.String constructInstruction,
java.lang.String imports,
boolean withoutModelDump)
throws java.io.IOException
constructInstruction - String that defines what constructor to call for the classifier and with which parameters to call it.imports - Imports that are appended to the beginning of the script. Normally only the necessary imports for the constructor instruction must be added here.java.io.IOException - The script could not be created.public ScikitLearnWrapper(java.lang.String constructInstruction,
java.lang.String imports)
throws java.io.IOException
constructInstruction - String that defines what constructor to call for the classifier and with which parameters to call it.imports - Imports that are appended to the beginning of the script. Normally only the necessary imports for the constructor instruction must be added here.java.io.IOException - The script could not be created.public ScikitLearnWrapper(java.lang.String constructInstruction,
java.lang.String imports,
java.io.File trainedModelPath)
throws java.io.IOException
java.io.IOExceptionpublic void buildClassifier(weka.core.Instances data)
throws java.lang.Exception
buildClassifier in interface weka.classifiers.Classifierjava.lang.Exceptionpublic double[] classifyInstances(weka.core.Instances data)
throws java.lang.Exception
classifyInstances in interface IInstancesClassifierjava.lang.Exceptionpublic double classifyInstance(weka.core.Instance instance)
throws java.lang.Exception
classifyInstance in interface weka.classifiers.Classifierjava.lang.Exceptionpublic static java.lang.String createImportStatementFromImportFolder(java.io.File importsFolder,
boolean keepNamespace)
throws java.io.IOException
importsFolder - Folder to be added as a module.keepNamespace - If true, a class must be called by the modules' name plus the class name. This is only important if multiple modules are imported and the classes' names are
ambiguous. Keep in mind that the constructor call for the classifier must be created accordingly.java.io.IOException - The __init__.py couldn't be created in the given folder (which is necessary to declare it as a module).public static java.lang.String getImportString(java.util.Collection<java.lang.String> imports)
public java.util.List<java.util.List<java.lang.Double>> getRawLastClassificationResults()
public void setProblemType(ScikitLearnWrapper.ProblemType problemType)
public void setTargets(int... targetColumns)
public void setModelPath(java.io.File modelFile)
public java.io.File getModelPath()
public double[] distributionForInstance(weka.core.Instance instance)
throws java.lang.Exception
distributionForInstance in interface weka.classifiers.Classifierjava.lang.Exceptionpublic weka.core.Capabilities getCapabilities()
getCapabilities in interface weka.classifiers.Classifierpublic java.lang.String toString()
toString in class java.lang.Object