API Cheetsheet¶
Model¶
IsolationForest
realseries.models.iforest.IForest.fit()
: Fit Isolation Forest. y is ignored.realseries.models.iforest.IForest.detect()
: Predict the score of a sample being anomaly by the detector. The anomaly score is returned.
LSTM_dynamic
realseries.models.lstm_dynamic.LSTM_dynamic.fit()
: Fit LSTM model. y is ignored.realseries.models.lstm_dynamic.LSTM_dynamic.detect()
: Predict the score of a sample being anomaly by the dynamic method. The anomaly sequence and score is returned.
Luminol
realseries.models.lumino.Lumino.detect()
: Predict the score of a sample being anomaly by the detector. The anomaly score is returned.
Random cut forest
realseries.models.rcforest.RCForest.detect()
: Predict the score of a sample being anomaly by the detector. The anomaly score is returned.
LSTM encoder decoder
realseries.models.rnn.LSTMED.fit()
: Fit LSTM. y is ignored.realseries.models.rnn.LSTMED.detect()
: Predict the score of a sample being anomaly by the LSTM. The anomaly score is returned.
SeqVL
realseries.models.seqvl.SeqVL.fit()
: Fit detector. y is ignored in unsupervised methods.realseries.models.seqvl.SeqVL.detect()
: Predict the score of a sample being anomaly by the detector. The anomaly score is returned.
SR_CNN
realseries.models.srcnn.SR_CNN.fit()
: Fit CNN model.realseries.models.srcnn.SR_CNN.detect()
: Predict the score of a sample being anomaly by the CNN. The anomaly score is returned.
VAE_AD
realseries.models.vae_ad.VAE_AD.fit()
: Fit detector. y is ignored in unsupervised methods.realseries.models.vae_ad.VAE_AD.detect()
: Predict the score of a sample being anomaly by the detector. The anomaly score is returned.
STL
realseries.models.stl.STL.fit()
: Fit STL model. y is ignored in unsupervised methods.realseries.models.stl.STL.forecast()
: Forecast the later value of a sequence. The array is returned.
Granger Causality
realseries.models.GC.GC.detect()
: Granger Causality detector, which is channel-level.realseries.models.DWGC.DWGC.detect()
: Dynamic Window-level Granger Causality detector.
See base class definition in realseries.models.base
.
Data¶
The following functions are used for raw data loading easily.
realseries.utils.data.load_NAB()
: Load data in the NAB_data diary. Train DataFrame and Test DataFrame with labels are returned.realseries.utils.data.load_Yahoo()
: Load data in the Yahoo_data diary. Train DataFrame and Test DataFrame with labels are returned.realseries.utils.data.load_split_NASA()
: Load data in the NASA diary. Train DataFrame and Test DataFrame with labels are returned.
Visualize¶
The following functions are used plotting raw data and predicted result.
realseries.utils.visualize.plot_anom()
: The parameters mainly includepd_data_label
,pred_anom
andpred_score
.pd_data_label
is thepandas.DataFrame()
with data and label,pred_anom
is the array with predicted label, andpred_score
is the corresponding anomaly score.realseries.utils.visualize.plot_mne()
: The parameters mainly includeX, scalings, ch_types, color
. IfX
is the array and last column as label. We set label column to differentch_type
, so it will show different color in the figure.