Created
March 17, 2020 04:00
-
-
Save Varad2305/f7940ec47e3fc58552e26d8a0e509cdf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import roc_auc_score | |
from sklearn.preprocessing import StandardScaler | |
from src.algorithms import DAGMM,LSTMAD | |
scaler = StandardScaler() | |
data_file_path = "./DuEx_DuEn.csv" | |
data_sheet = pd.read_csv(data_file_path,parse_dates=True) | |
X = data_sheet[['si_average_speed','si_density','si_flow']] | |
y = np.asarray(data_sheet['cong']) | |
y = np.reshape(y,[y.shape[0],1]) | |
# X = scaler.fit_transform(X) | |
X = pd.DataFrame(X) | |
y = pd.DataFrame(y) | |
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size = 0.33,random_state=42) | |
mod = DAGMM(sequence_length=480) | |
mod.fit(X_train) | |
error = mod.predict(X_test) | |
print(roc_auc_score(y_test,error)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment