Class ASimplifiedTSClassifier<T>
- java.lang.Object
-
- ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<T>
-
- Direct Known Subclasses:
BOSSClassifier,BOSSEnsembleClassifier,NearestNeighborClassifier,ShotgunEnsembleClassifier
public abstract class ASimplifiedTSClassifier<T> extends java.lang.ObjectSimplified batch-learning time series classifier which can be trained and used as a predictor. Usesalgorithmto train the model parameters (if necessary).
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassMapperclassMapperClass mapper object used to encode and decode predicted values if String values are used as classes.protected booleantrainedVariable indicating whether the classifier has been trained.
-
Constructor Summary
Constructors Constructor Description ASimplifiedTSClassifier()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected double[][]checkWhetherPredictionIsPossible(TimeSeriesDataset2 dataset)ClassMappergetClassMapper()Getter for the propertyclassMapper.abstract <U extends ASimplifiedTSClassifier<T>>
ASimplifiedTSCLearningAlgorithm<T,U>getLearningAlgorithm(TimeSeriesDataset2 dataset)booleanisTrained()abstract Tpredict(double[] univInstance)Performs a prediction based on the given univariate double[] instance representation and returns the result.abstract java.util.List<T>predict(TimeSeriesDataset2 dataset)Performs predictions based on the given instances in the given dataset.Tpredict(java.util.List<double[]> multivInstance)Performs a prediction based on the given multivariate list of double[] instance representation and returns the result.voidsetClassMapper(ClassMapper classMapper)Setter for the propertyclassMapper.voidtrain(TimeSeriesDataset2 dataset)Trains the simplified time series classifier model using the givenTimeSeriesDataset2.
-
-
-
Field Detail
-
classMapper
protected ClassMapper classMapper
Class mapper object used to encode and decode predicted values if String values are used as classes. Can be null if the predicted values are not mapped to String values.
-
trained
protected boolean trained
Variable indicating whether the classifier has been trained.
-
-
Method Detail
-
predict
public abstract T predict(double[] univInstance) throws org.api4.java.ai.ml.core.exception.PredictionException
Performs a prediction based on the given univariate double[] instance representation and returns the result.- Parameters:
univInstance- Univariate instance given by a double vector of time series values used for the prediction- Returns:
- Returns the result of the prediction
- Throws:
org.api4.java.ai.ml.core.exception.PredictionException- If something fails during the prediction process.
-
predict
public T predict(java.util.List<double[]> multivInstance) throws org.api4.java.ai.ml.core.exception.PredictionException
Performs a prediction based on the given multivariate list of double[] instance representation and returns the result.- Parameters:
multivInstance- Multivariate instance given by a list of multiple double[] time series used for the prediction- Returns:
- Returns the result of the prediction
- Throws:
org.api4.java.ai.ml.core.exception.PredictionException- If something fails during the prediction process.
-
predict
public abstract java.util.List<T> predict(TimeSeriesDataset2 dataset) throws org.api4.java.ai.ml.core.exception.PredictionException
Performs predictions based on the given instances in the given dataset.- Parameters:
dataset- TheTimeSeriesDataset2for which predictions should be made.- Returns:
- Returns the result of the predictions
- Throws:
org.api4.java.ai.ml.core.exception.PredictionException- If something fails during the prediction process
-
getLearningAlgorithm
public abstract <U extends ASimplifiedTSClassifier<T>> ASimplifiedTSCLearningAlgorithm<T,U> getLearningAlgorithm(TimeSeriesDataset2 dataset)
-
train
public final void train(TimeSeriesDataset2 dataset) throws java.lang.InterruptedException, org.api4.java.ai.ml.core.exception.TrainingException
Trains the simplified time series classifier model using the givenTimeSeriesDataset2.- Parameters:
dataset- TheTimeSeriesDataset2which should be used for the training.- Throws:
org.api4.java.ai.ml.core.exception.TrainingException- If something fails during the training process.java.lang.InterruptedException
-
getClassMapper
public ClassMapper getClassMapper()
Getter for the propertyclassMapper.- Returns:
- Returns the actual class mapper or null if no mapper is stored
-
setClassMapper
public void setClassMapper(ClassMapper classMapper)
Setter for the propertyclassMapper.- Parameters:
classMapper- The class mapper to be set
-
isTrained
public boolean isTrained()
- Returns:
- the trained
-
checkWhetherPredictionIsPossible
protected double[][] checkWhetherPredictionIsPossible(TimeSeriesDataset2 dataset) throws org.api4.java.ai.ml.core.exception.PredictionException
- Throws:
org.api4.java.ai.ml.core.exception.PredictionException
-
-