Hi, I was asked to implement the following . Note for using libraries: For this, any pre-trained or pre-built neural
networks or CNN architectures cannot be used (e.g. torchvision.models,
keras.applications). This time you can use scikit-learn for data preprocessing.
For this assignment you can use PyTorch or Keras/Tensorflow deep learning framework (works using sklearn.neural_network.MLPClassifier won't be considered).

Part I: Building a Basic NN 
In this , implement a neural network using the PyTorch/Keras library.
You will train the network on the dataset named as 'dataset.csv', which contains of seven features and
a target. Your goal is to predict a target, that has a binary representation.
Step 1: Loading the Dataset
Load the dataset. You can use the pandas library to load the dataset into a DataFrame
Step 2: Preprocessing the Dataset
First, we need to preprocess the dataset before we use it to train the neural network.
Preprocessing typically involves converting categorical variables to numerical variables,
scaling numerical variables, and splitting the dataset into training and validation sets.
For this dataset, you can use the following preprocessing steps:
• Convert categorical variables to numerical variables using one-hot encoding
o You can use OneHotEncoder¶from sklearn
• Scale numerical variables to have zero mean and unit variance.
o You can use StandardScaler from sklearn or Normalize from PyTorch
• Split the dataset into training and validation sets.
o train_test_split from sklearn
You can also check Keras preprocessing tools here.
Step 3: Defining the Neural Network
Now, we need to define the neural network that we will use to make predictions on the
dataset. For this part, you can define a simple neural network.
Decide your NN architecture:
• How many input neurons are there?
• What activation function will you choose?
o Suggestion: try ReLU
• What is the number of hidden layers?
o Suggestion: start with a small network, e.g. 2 or 3 layers
• What is the size of each hidden layer?
o Suggestion: try 64 or 128 nodes for each layer
• What activation function is used for the hidden and output layer?
Step 4: Training the Neural Network
Training has to be defined from scratch, e.g. code with in-built .fit() function won’t be
evaluated.
1. Set up the training loop: In this step, you will create a loop that iterates over the
training data for a specified number of epochs. For each epoch, you will iterate
over the batches of the training data, compute the forward pass through the
neural network, compute the loss, compute the gradients using backpropagation,
and update the weights of the network using an optimizer such as Stochastic
Gradient Descent (SGD) or Adam.
2. Define the loss function that will be used to compute the error between the
predicted output of the neural network and the true labels of the training data.
For binary classification problems, a commonly used loss function is Binary Cross Entropy Loss.
3. Choose an optimizer and a learning rate. It will update the weights of the neural
network during training. Stochastic Gradient Descent (SGD) is one of the
commonly used, you can also explore other optimizers like Adam or RMSProp.
4. Train the neural network. Run the training loop and train the neural network on
the training data. Select the number of epochs and batch size. Monitor the
training loss and the validation loss at each epoch to ensure that the model is not
overfitting to the training data.
5. Evaluate the performance of the model on the testing data.
The expected accuracy for this task is more than 75%.
6. Save the weights of the trained neural network.
7. Visualize the results. Use visualization techniques such as confusion matrices.   The training loop implementation should contain both test and train accuracy and their losses as well.