Skip to content

Hybrid Configurations

Heshan Eranga edited this page Feb 4, 2019 · 3 revisions

5 models can be generated by the framework.

Hyperparameters

Hyperparameters for the model is passed as a structure ModelStruct

class ModelStruct {
public:
    virtual ~ModelStruct();
public:
    int trainingIterations; // training iterations
    int trainDataSize; // train data size
    double learningRate; // learning rate
    // LSTM
    int memCells; // number of memory cells
    int inputVecSize; // input vector size
    int predictions; // prediction points
    int numPredPoints; // future points
    std::string dataFile; // path to the data file
    // CNN
    int matWidth;
    int matHeight;
    int targetC;
    struct::NetStruct netStruct;
};

Prediction Models

Constructors

LSTMPredictionModel(ModelStruct * modelStruct);
CNNPredictionModel(ModelStruct * modelStruct);
LSTMCNNPredictionModel(ModelStruct * modelStruct);
CNNLSTMPredictionModel(ModelStruct * modelStruct);
LSTMCNNFCPredictionModel(ModelStruct * modelStruct);

Training

int train();

Prediction Methods

  • predict the given number of points and write the predicted values to given file
    [ LSTM,CNN,LSTMCNN,CNNLSTM ]
int predict(int points, std::string expect, std::string predict);

points: number of prediction points
expect: file path to write the expected values
predict: file path to write the predicted value

  • predict the given number of points, Identify the anomalies using DTW and write the anomalous points to given file
    [ LSTM,CNN ]
int predict(
    int points, std::string expect, std::string predict, 
    int simVecSize, double marker, double simMargin = 0
);

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted anomaly points
simVecSize: DTW similarity vector size
marker: value to write for the anomalous point
simMargin: DTW similarity margin to detect anomalous points

  • Predict the given number of points and write the predicted values to given file
    [ CNNLSTMFC ]
int predict(
    int points, std::string expect, std::string predict, 
    double lstmW = 0.5, double cnnW = 0.5, int abs = 0
);

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted value
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)
abs: get the absolute value of the prediction ( default = 0 : original prediction )

  • Predict the given number of points, Identify the anomalies using DTW and write the anomalous points to given file
int predict(
    int points, std::string expect, std::string predict, 
    int simVecSize, double marker, double simMargin = 0, 
    double lstmW = 0.5, double cnnW = 0.5, int abs = 0
);

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted anomaly points
simVecSize: DTW similarity vector size
marker: value to write for the anomalous point
simMargin: DTW similarity margin to detect anomalous points
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)
abs: get the absolute value of the prediction ( default = 0 : original prediction )

  • Predict the given number of points and write the predicted values to given file keep track on the training data points to predict the normal behavior
int predictNorm(
    int points, std::string expect, std::string predict, 
    double lstmW = 0.5, double cnnW = 0.5
)

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted value
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)

  • Predict the given number of points, Identify the anomalies using DTW and write the anomalous points to given file keep track on the training data points to predict the normal behavior
int predictNorm(
    int points, std::string expect, std::string predict, 
    int simVecSize, double marker, double simMargin = 0, 
    double lstmW = 0.5, double cnnW = 0.5
);

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted anomaly points
simVecSize: DTW similarity vector size
marker: value to write for the anomalous point
simMargin: DTW similarity margin to detect anomalous points
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)

  • Predict the given number of points and write the predicted values to given file and keep track on the training data points to predict the normal behavior to adapt for the changes in the normal behavior
int predictAdaptNorm(
    int points, std::string expect,   std::string predict, 
    int timeLimit, double lstmW = 0.5, double cnnW = 0.5
);

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted value
timeLimit: time limit to update the normal behavior
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)

  • Predict the given number of points, Identify the anomalies using DTW and write the anomalous points to given file and keep track on the training data points to predict the normal behavior to adapt for the changes in the normal behavior
int predictAdaptNorm(
    int points, std::string expect, std::string predict, 
    int timeLimit, int simVecSize, double marker, 
    double simMargin = 0, double lstmW = 0.5, double cnnW = 0.5
);

points: points to be predicted
expect: file path to write the expected values
predict: file path to write the predicted anomaly points
timeLimit: time limit to update the normal behavior
simVecSize: DTW similarity vector size
marker: value to write for the anomalous point
simMargin: DTW similarity margin to detect anomalous points
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)

  • Process a large input file: read the inputs while predicting, Predict the given number of points using the data in the given file and write the predicted values to given file
int predictFromFile(
    std::string infile, int points, std::string predict, 
    double lstmW = 0.5, double cnnW = 0.5, int abs = 0
);

infile: datafile
points: points to be predicted
predict: file path to write the predicted values
lstmW: prediction weight for the lstm (default value = 0.5, lstmW + cnnW = 1)
cnnW: prediction weight for the cnn (default value = 0.5, lstmW + cnnW = 1)
abs: get the absolute value of the prediction ( default = 0 : original prediction )