-
Notifications
You must be signed in to change notification settings - Fork 3
/
acctTaining.py
51 lines (35 loc) · 1.81 KB
/
acctTaining.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""accTraining-ourWays.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1HhlgE4LwvNFUv5VaMP7qH-MWMKpd2Oyk
"""
import keras
import numpy as np
import pandas as pd
df = pd.read_csv('drive/My Drive/hugefinal.csv')
from sklearn.utils import shuffle
df = shuffle(df)
df.reset_index(drop=True, inplace=True)
del df['index']
df.head()
x = df.iloc[:,1:151]
y = df.iloc[:,-1]
x.shape
x.head()
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.33, random_state=42)
#classifier = Sequential() #First Hidden Layerclassifier.add(Dense(20, activation='relu', kernel_initializer='random_normal', input_dim=x_train.shape[1]))classifier.add(Dense(50, activation='relu', kernel_initializer='random_normal'))classifier.add(Dense(30, activation='relu', kernel_initializer='random_normal'))classifier.add(Dense(30, activation='relu',, x_test, y_train, y_test = train_test_split(x, y, test_size=0.33, random_state=42)
from keras import Sequential
from keras.layers import Dense
classifier = Sequential()
#First Hidden Layer
classifier.add(Dense(20, activation='relu', kernel_initializer='random_normal', input_dim=x_train.shape[1]))
classifier.add(Dense(50, activation='relu', kernel_initializer='random_normal'))
classifier.add(Dense(30, activation='relu', kernel_initializer='random_normal'))
classifier.add(Dense(30, activation='relu', kernel_initializer='random_normal'))
classifier.add(Dense(1, activation='sigmoid', kernel_initializer='random_normal'))
classifier.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
classifier.fit(x_train, y_train, batch_size=50, epochs=50)
classifier.evaluate(x_test, y_test)
classifier.save('drive/My Drive/accOnlyModel.h5')