Scaler standardscaler fitxtrain xtrain scaler

This preview shows page 1 out of 1 page.

scaler = StandardScaler() . fit(X_train) X_train = scaler . transform(X_train) X_test = scaler . transform(X_test) X_train . shape In [106]: # Deep Learning Model Architecture import warnings warnings . filterwarnings( 'ignore' ) from keras.models import Sequential from keras.layers import Dense model = Sequential() model . add(Dense( 6 , activation = 'relu' , input_shape = ( 18 , ))) # 114 parameters: (18+1)*6=114 model . add(Dense( 6 , activation = 'relu' )) # (6+1)*6 = 42 parameters model . add(Dense( 1 , activation = 'sigmoid' )) # 7 parameters model . output_shape model . summary() In [107]: model . get_config() model . get_weights() In [112]: # Model Specification and Training model . compile(loss = 'binary_crossentropy' , optimizer = 'rmsprop' , metrics = [ 'accuracy' ]) history = model . fit(X_train, y_train, epochs =8 , batch_size =5 ) # Consider using validation set In [113]: y_pred = model . predict(X_test) model . evaluate(X_test, y_test, verbose =1 ) In [ ]: Out[104]: (2333,) Out[105]: (2333, 18) Model: "sequential_11" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= dense_31 (Dense) (None, 6) 114 _________________________________________________________________ dense_32 (Dense) (None, 6) 42 _________________________________________________________________ dense_33 (Dense) (None, 1) 7 ================================================================= Total params: 163 Trainable params: 163 Non-trainable params: 0 _________________________________________________________________ Out[107]: [array([[ 0.12270689, 0.06002271, -0.30381155, 0.4232595 , 0.26618087, -0.374017 ], [-0.09357405, 0.23626399, -0.06130993, 0.24180377, 0.39834523, -0.42834842], [-0.3417518 , 0.07780313, 0.10733736, -0.21364641, -0.39769137, 0.10660934], [-0.306275 , 0.3300631 , -0.32976878, 0.46783113, -0.38840544, -0.30925846], [-0.10273063, 0.1454488 , -0.00450718, 0.43823922, 0.41288376, 0.39989543], [ 0.24769068, -0.15703046, 0.31494963, 0.15532649, -0.4516654 , -0.42641842], [-0.2687956 , -0.44650018, 0.24993467, -0.31604028, -0.11704528, 0.18019211], [ 0.09761751, -0.04382014, -0.38842046, -0.10064209, 0.13762367, -0.18425488], [-0.18494594, -0.2728752 , 0.41580117, -0.28652728, -0.30349576, -0.00326693], [ 0.1640408 , -0.43841958, 0.27376604, 0.25421798, 0.0234369 , 0.10435867], [ 0.43579364, -0.03936672, 0.17783749, 0.27433598, -0.36070657, -0.13512409], [-0.47436738, 0.06550658, 0.34221888, 0.20120752, 0.4177606 , -0.38549662], [-0.49576974, -0.4463842 , -0.4031775 , -0.41571033, 0.1470815 , 0.2161001 ], [ 0.4745854 , 0.23693264, -0.10473883, 0.44708824, 0.3433386 , -0.23407817], [ 0.2846495 , 0.4166715 , -0.33375275, -0.31270874, -0.35382688, -0.13400626], [-0.490811 , -0.43378592, 0.14463532, 0.3105409 , 0.15026009, 0.00506151], [-0.4345156 , -0.125337 , -0.2736404 ,

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture