else: model.fit(x_train) y_pred = model.predict(x_test) y_pred = convert_predictions(y_pred) metrics_report(y_test, y_pred) scores.append( create_experiment_report(get_metrics(y_test, y_pred), model.get_params())) return {'experiments': scores} if __name__ == '__main__': x_train = load_drain3( '../../data/interim/HDFS1/train-data-Drain3-HDFS1-cv1-1.binlog') y_train = load_labels( '../../data/interim/HDFS1/train-labels-HDFS1-cv1-1.csv') x_val = load_drain3( '../../data/interim/HDFS1/val-data-Drain3-HDFS1-cv1-1.binlog') y_val = load_labels('../../data/interim/HDFS1/val-labels-HDFS1-cv1-1.csv') y_train = get_labels_from_csv(y_train, x_train.keys()) y_val = get_labels_from_csv(y_val, x_val.keys()) results = train_lof(x_train, x_val, y_train, y_val) save_experiment(results, '../../models/LOF-hyperparameters-Drain3-HDFS1.json') results = train_iso_forest(x_train, x_val, y_train, y_val) save_experiment(results, '../../models/IF-hyperparameters-Drain3-HDFS1.json')
y_train = np.load( '../../data/processed/HDFS1/y-train-HDFS1-cv1-1-block.npy') y_val = np.load('../../data/processed/HDFS1/y-val-HDFS1-cv1-1-block.npy') # results = train_window(X_train, X_val, y_train, y_val) # save_experiment(results, '../../models/TCN-cropped-window-embeddings-HDFS1.json') # results = train_tcnn(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) # results = train_cnn1d(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) # results = train_cnn2d(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) # results = train_tcnn_cnn1d(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) # results = train_aetcnn(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) # results = train_sa_cnn1d(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) # results = train_sa_cnn2d(X_train, X_val, y_train, y_val) # save_experiment(results, EXPERIMENT_PATH) results = train_aecnn1d(X_train, X_val, y_train, y_val) save_experiment(results, EXPERIMENT_PATH)
print('AETCN + IF model:', json.dumps(results, indent=4, sort_keys=True)) results = evaluate_hybrid_model_ae(X_train, X_test, y_test) experiment_reports['AETCN + AE model'] = results print('AETCN + AE model:', json.dumps(results, indent=4, sort_keys=True)) ############################### BASELINE METHODS ################################################################### X_train = load_pickle_file( '../../data/interim/HDFS1/train-data-Drain3-HDFS1-cv1-1.binlog') y_train = load_labels( '../../data/interim/HDFS1/train-labels-HDFS1-cv1-1.csv') X_test = load_pickle_file( '../../data/interim/HDFS1/test-data-Drain3-HDFS1.binlog') y_test = load_labels('../../data/interim/HDFS1/test-labels-HDFS1.csv') results = evaluate_autoencoder(X_train, X_test, y_test) experiment_reports['AE model'] = results print('AE model:', json.dumps(results, indent=4, sort_keys=True)) results = evaluate_iso_forest(X_train, X_test, y_test) experiment_reports['IF model'] = results print('IF model:', json.dumps(results, indent=4, sort_keys=True)) results = evaluate_lof(X_train, X_test, y_test) experiment_reports['LOF model'] = results print('LOF model:', json.dumps(results, indent=4, sort_keys=True)) print_report(experiment_reports) save_experiment(experiment_reports, '../../reports/results/evalution.json')