Package adams.data.wekapyroproxy
Class AbstractCommunicationProcessor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.wekapyroproxy.AbstractCommunicationProcessor
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SizeOfHandler
,Serializable
- Direct Known Subclasses:
FusionJsonCommunicationProcessor
,NullCommunicationProcessor
,SimpleJsonCommunicationProcessor
public abstract class AbstractCommunicationProcessor extends adams.core.option.AbstractOptionHandler
Ancestor for classes processing the communication to/fro Pyro proxy models.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractCommunicationProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
checkDataset(weka.core.Instances data)
Hook method for performing checks before converting a dataset.protected String
checkInitialize(weka.core.Instances data)
Hook method for performing checks before initializing.protected String
checkInstance(weka.core.Instance inst)
Hook method for performing checks before converting the Instance.protected String
checkPrediction(Object prediction)
Hook method for performing checks before parsing the prediction.protected String
checkPredictions(Object predictions)
Hook method for performing checks before parsing the predictions.Object
convertDataset(PyroProxy owner, weka.core.Instances data)
Performs the dataset conversion.Object
convertInstance(PyroProxy owner, weka.core.Instance inst)
Converts the instance into a different format.protected abstract Object
doConvertDataset(PyroProxy owner, weka.core.Instances data)
Performs the dataset conversion.protected abstract Object
doConvertInstance(PyroProxy owner, weka.core.Instance inst)
Converts the instance into a different format.protected abstract void
doInitialize(PyroProxy owner, weka.core.Instances data)
Performs the initialization.protected abstract double[]
doParsePrediction(PyroProxy owner, Object prediction)
Parses the prediction.protected abstract double[][]
doParsePredictions(PyroProxy owner, Object predictions)
Parses the predictions.void
initialize(PyroProxy owner, weka.core.Instances data)
Converts the instance into a different format.double[]
parsePrediction(PyroProxy owner, Object prediction)
Parses the prediction.double[][]
parsePredictions(PyroProxy owner, Object predictions)
Parses the predictions.abstract boolean
supportsBatchPredictions()
Returns whether batch predictions are supported.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
checkInitialize
protected String checkInitialize(weka.core.Instances data)
Hook method for performing checks before initializing.- Parameters:
data
- the Instances to check- Returns:
- null if successful, otherwise the error message
-
doInitialize
protected abstract void doInitialize(PyroProxy owner, weka.core.Instances data) throws Exception
Performs the initialization.- Parameters:
owner
- the owning classifierdata
- the training data- Throws:
Exception
- if initialization fails
-
initialize
public void initialize(PyroProxy owner, weka.core.Instances data) throws Exception
Converts the instance into a different format.- Parameters:
owner
- the owning classifierdata
- the training data- Throws:
Exception
- if check or initialization fails
-
checkDataset
protected String checkDataset(weka.core.Instances data)
Hook method for performing checks before converting a dataset.- Parameters:
data
- the dataset to check- Returns:
- null if successful, otherwise the error message
-
doConvertDataset
protected abstract Object doConvertDataset(PyroProxy owner, weka.core.Instances data) throws Exception
Performs the dataset conversion.- Parameters:
owner
- the owning classifierdata
- the dataset to convert- Returns:
- the converted dataset
- Throws:
Exception
- if build fails
-
convertDataset
public Object convertDataset(PyroProxy owner, weka.core.Instances data) throws Exception
Performs the dataset conversion.- Parameters:
owner
- the owning classifierdata
- the dataset to convert- Returns:
- the converted dataset
- Throws:
Exception
- if check or build fails
-
checkInstance
protected String checkInstance(weka.core.Instance inst)
Hook method for performing checks before converting the Instance.- Parameters:
inst
- the Instance to check- Returns:
- null if successful, otherwise the error message
-
doConvertInstance
protected abstract Object doConvertInstance(PyroProxy owner, weka.core.Instance inst) throws Exception
Converts the instance into a different format.- Parameters:
owner
- the owning classifierinst
- the instance to convert- Returns:
- the generated data structure
- Throws:
Exception
- if conversion fails
-
convertInstance
public Object convertInstance(PyroProxy owner, weka.core.Instance inst) throws Exception
Converts the instance into a different format.- Parameters:
owner
- the owning classifierinst
- the instance to convert- Returns:
- the generated data structure
- Throws:
Exception
- if check or conversion fails
-
checkPrediction
protected String checkPrediction(Object prediction)
Hook method for performing checks before parsing the prediction.- Parameters:
prediction
- the prediction to check- Returns:
- null if successful, otherwise the error message
-
doParsePrediction
protected abstract double[] doParsePrediction(PyroProxy owner, Object prediction) throws Exception
Parses the prediction.- Parameters:
owner
- the owning classifierprediction
- the prediction to parse- Returns:
- the class distribution
- Throws:
Exception
- if conversion fails
-
parsePrediction
public double[] parsePrediction(PyroProxy owner, Object prediction) throws Exception
Parses the prediction.- Parameters:
owner
- the owning classifierprediction
- the prediction to parse- Returns:
- the class distribution
- Throws:
Exception
- if check or conversion fails
-
supportsBatchPredictions
public abstract boolean supportsBatchPredictions()
Returns whether batch predictions are supported.- Returns:
- true if supported
-
checkPredictions
protected String checkPredictions(Object predictions)
Hook method for performing checks before parsing the predictions.- Parameters:
predictions
- the prediction to check- Returns:
- null if successful, otherwise the error message
-
doParsePredictions
protected abstract double[][] doParsePredictions(PyroProxy owner, Object predictions) throws Exception
Parses the predictions.- Parameters:
owner
- the owning classifierpredictions
- the predictions to parse- Returns:
- the class distribution
- Throws:
Exception
- if conversion fails
-
-