You are on page 1of 1

ITM 740 Artificial Intelligence in Business

Assignment #2
Due on Monday April 1, 2024
➢ The dataset (bcancer_data.csv) is about a group of patients that were tested for breast cancer. The
goal is to predict if a new patient has cancer or not based on different attributes (e.g., size of the
cell)
➢ The target class is in the 10th column and its name is “Class”.
➢ Number of Attributes for Classification: 9.
➢ The task must be developed using Python and PyTorch.

Tasks:
1- Divide data into two datasets
• 80% as training data
• 20% as test data
i. Note: this is similar to what you have done in ITM-618, using train_test_split
from sklearn.

2- Build a classification model based on the training data to predict if a new patient is predicted as
yes or no (1 or 0).
• The minimum number of input attributes must be 3 (you can use more attributes if
you want to). You can choose the input attributes in any way you want (just make sure to
use at least 3 input attributes).
• You should create a neural network using PyTorch with one hidden layer. The hidden
layer must have 10 neurons (units).
• Use ReLU as the activation function for the hidden layer.
• Use BCEWithLogitsLoss as the loss function.
• Use torch.optim.SGD as the optimizer.
• Train the network with 100 epochs and set the learning rate to 0.1

3- Test the model on the test data and build the confusion matrix.
• This is similar to what you have done in ITM-618:
o from sklearn.metrics import confusion_matrix

4- Using the confusion matrix, calculate the accuracy, precision, and recall.

Deliverables:
1- Source code (either .ipynb or .py file)
• If you use Google Colab, go to "File" menu, then "Download", and then choose
"Download .ipynb" or "Download .py".
2- A PDF or Word file that contains the followings:
• The confusion matrix. You can draw a confusion matrix in MS Word by inserting an
equation and then adding a matrix. See a sample matrix below (you copy and paste this
matrix and update the numbers with yours).
100 200
[ ]
300 400
• Accuracy, Precision, and Recall

You might also like