Skip to content

Commit

Permalink
ANN done
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnoitanuj committed Nov 21, 2018
1 parent 87fd504 commit aeff8cf
Show file tree
Hide file tree
Showing 3 changed files with 1,527 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import pandas as pd

dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values
X = dataset.iloc[:, 1:].values
y = dataset.iloc[:, 0].values

# Encoding categorical data
#Encoding categorical data
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X_1 = LabelEncoder()
X[:, 1] = labelencoder_X_1.fit_transform(X[:, 1])
Expand Down Expand Up @@ -36,11 +36,12 @@
# Adding the second hidden layer
classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu'))
# Adding the output layer
classifier.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))
classifier.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid')) #if more than two categories use softmax
# Compiling the ANN
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
#If dependent variable has more than two categories(not binary), the loss function will be categorical_crossentropy
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
# Fitting the ANN to the Training set
classifier.fit(X_train, y_train, batch_size = 10, nb_epoch = 100)
classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)

#Making the predictions and evaluating the model

Expand Down
Loading

0 comments on commit aeff8cf

Please sign in to comment.