Thursday, May 20, 2021

Activation Functions In Artificial Neural Networks Part 2 Binary Classification

Activation Functions In Artificial Neural Networks Part 2 Binary Classification

This is part 2 of the series on activation functions in artificial neural networks. Chek out part1 - how to use RELU in Artificial Neural Networks for building a Regression model.

In this notebook, I will talk about how to build a binary classification neural network model.

In [1]:
from collections import Counter

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from tensorflow.keras.layers import Dense, Dropout, Input
from tensorflow.keras.models import Model

To ensure that every time we run the code we get the same results, we need following code so as to generate a fixed random seed.

In [ ]:
tf.random.set_seed(42)
np.random.seed(42)
Binary Classification

For this exercise, we will use breast cancer dataset which is available in sklearn datasets.

In [2]:
from sklearn.metrics import classification_report
In [3]:
from sklearn.datasets import load_breast_cancer
In [4]:
data = load_breast_cancer()
X =
(continued...)

from Planet SciPy
read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...