-
Notifications
You must be signed in to change notification settings - Fork 5
Artificial Neural Network
Steps to be Performed :
- Data Preprocessing
- Adding Input Layers, Hidden Layers and Output Layers
- Time to Compile
- Once compiled, one must fit the training dataset
- Predict
- Improving and Parameter Tuning of the ANN
All the Steps performed in Python using the Spyder IDE.
*Rectifier Function used for the HIDDEN layers and Sigmoid function used for the OUTPUT Layer. *Standardization Function used for Feature Scaling
Make an object of Sequential class, which will be our ANN
classifier = Sequential()
Adding the input layer and the first hidden layer
classifier.add(Dense(units=6, kernel_initializer = "uniform",
activation = "relu", input_dim=11))
Adding the second hidden layer same for all, only input not required
classifier.add(Dense(units=6, kernel_initializer = "uniform",
activation = "relu"))
Adding the final layer or Output layer
classifier.add(Dense(units=1, kernel_initializer = "uniform",
activation = "sigmoid"))
Time to compile the model
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
Fitting the data
classifier.fit(X_train,y_train, batch_size=10 ,epochs = 100)
Predictions
y_pred = classifier.predict(X_test) y_pred = (y_pred > 0.5)