November 2018
Intermediate to advanced
556 pages
14h 42m
English
The first step is to build our simulated data. The following code generates the training dataset. The dataset is made up of two columns, wind and power, an array, X_train, and one column array, y_train.
The y_train contains the value 0 when the relation between wind and power is an anomaly and is marked as 1 using an additional variable:
X_train=[]y_train=[]# regular dataX_train.extend( [[x ,wind_turbine_model(x)] for x in range(0,30)] )y_train.extend( [1 for x in range(0,30)] )# anomaly datafor x in range(15,30): X_train.extend([[x, 50 + x*random.random()]]) y_train.extend([0])
To generated the regular data, we used the wind_turbine_model() function. To generate anomaly ...