Class ASimplifiedTSClassifier<T>
- java.lang.Object
-
- ai.libs.jaicore.ml.tsc.classifier.ASimplifiedTSClassifier<T>
-
- Direct Known Subclasses:
BOSSClassifier,BOSSEnsembleClassifier,LearnPatternSimilarityClassifier,LearnShapeletsClassifier,NearestNeighborClassifier,ShapeletTransformTSClassifier,ShotgunEnsembleClassifier,TimeSeriesBagOfFeaturesClassifier,TimeSeriesForestClassifier,TimeSeriesTreeClassifier
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(TimeSeriesDataset dataset)ClassMappergetClassMapper()Getter for the propertyclassMapper.abstract <U extends ASimplifiedTSClassifier<T>>
ASimplifiedTSCLearningAlgorithm<T,U>getLearningAlgorithm(TimeSeriesDataset 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(TimeSeriesDataset 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(TimeSeriesDataset dataset)Trains the simplified time series classifier model using the givenTimeSeriesDataset.
-
-
-
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 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:
PredictionException- If something fails during the prediction process.
-
predict
public T predict(java.util.List<double[]> multivInstance) throws 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:
PredictionException- If something fails during the prediction process.
-
predict
public abstract java.util.List<T> predict(TimeSeriesDataset dataset) throws PredictionException
Performs predictions based on the given instances in the given dataset.- Parameters:
dataset- TheTimeSeriesDatasetfor which predictions should be made.- Returns:
- Returns the result of the predictions
- Throws:
PredictionException- If something fails during the prediction process
-
getLearningAlgorithm
public abstract <U extends ASimplifiedTSClassifier<T>> ASimplifiedTSCLearningAlgorithm<T,U> getLearningAlgorithm(TimeSeriesDataset dataset)
-
train
public final void train(TimeSeriesDataset dataset) throws TrainingException
Trains the simplified time series classifier model using the givenTimeSeriesDataset.- Parameters:
dataset- TheTimeSeriesDatasetwhich should be used for the training.- Throws:
TrainingException- If something fails during the training process.
-
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(TimeSeriesDataset dataset) throws PredictionException
- Throws:
PredictionException
-
-