public class ClassificationPythonModel extends Object implements com.feedzai.openml.model.ClassificationMLModel
id.
This representation is used for any Python based model including Scikit models and Generic user made models.
Some use cases can reuse this implementation and simply instantiate it with custom function names passed to
the constructor.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CLASSIFY_FUNCTION_NAME
Default name for the Python function that returns the index of the class for the prediction on a
given instance.
|
static String |
DEFAULT_GETCLASSDISTRIBUTION_FUNCTION_NAME
Default name for the Python function that returns the probability distribution array for the prediction on a
given instance.
|
| Constructor and Description |
|---|
ClassificationPythonModel(JepInstance jepInstance,
com.feedzai.openml.data.schema.DatasetSchema schema,
String id)
Constructor for this model's representation using default names for
classification and scoring. |
ClassificationPythonModel(JepInstance jepInstance,
com.feedzai.openml.data.schema.DatasetSchema schema,
String id,
String classifyFunctionName,
String getClassDistributionFunctionName)
Constructor for this model's representation.
|
| Modifier and Type | Method and Description |
|---|---|
int |
classify(com.feedzai.openml.data.Instance instance) |
void |
close() |
double[] |
getClassDistribution(com.feedzai.openml.data.Instance instance) |
com.feedzai.openml.data.schema.DatasetSchema |
getSchema() |
boolean |
save(Path dir,
String name) |
void |
validate(JepInstance jepInstance,
String id)
Validates that the model's Jep environment has everything loaded and available.
|
public static final String DEFAULT_CLASSIFY_FUNCTION_NAME
public static final String DEFAULT_GETCLASSDISTRIBUTION_FUNCTION_NAME
public ClassificationPythonModel(JepInstance jepInstance, com.feedzai.openml.data.schema.DatasetSchema schema, String id, String classifyFunctionName, String getClassDistributionFunctionName)
jepInstance - Jep instance where this model is loaded.schema - Schema of the instances this model receives.id - Name of the variable that stores this model in the Jep instance.classifyFunctionName - Name of the Python function in the loaded model that returns the index
of the class for the prediction on a given instance.getClassDistributionFunctionName - Name of the Python function in the loaded model that returns the
probability distribution array for the prediction on a given instance.public ClassificationPythonModel(JepInstance jepInstance, com.feedzai.openml.data.schema.DatasetSchema schema, String id)
classification and scoring.jepInstance - Jep instance where this model is loaded.schema - Schema of the instances this model receives.id - Name of the variable that stores this model in the Jep instance.public boolean save(Path dir, String name)
save in interface com.feedzai.openml.model.MachineLearningModelpublic com.feedzai.openml.data.schema.DatasetSchema getSchema()
getSchema in interface com.feedzai.openml.model.MachineLearningModelpublic double[] getClassDistribution(com.feedzai.openml.data.Instance instance)
getClassDistribution in interface com.feedzai.openml.model.ClassificationMLModelpublic int classify(com.feedzai.openml.data.Instance instance)
classify in interface com.feedzai.openml.model.ClassificationMLModelpublic void validate(JepInstance jepInstance, String id) throws com.feedzai.openml.provider.exception.ModelLoadingException
jepInstance - The Jep environment.id - The id with which the model has been declared in the environment.com.feedzai.openml.provider.exception.ModelLoadingException - If there is an error in the current environment.public void close()
close in interface AutoCloseableCopyright © 2018 Feedzai. All rights reserved.