Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Machine Learning External Lab Assessment

Name : Nitin Gupta


Roll No. : 2200291539004
Branch : CSE(AI&ML) 3rd year

We'll use the popular sklearn library for this task.

Step 1: Understanding the Dataset

We'll use the Breast Cancer Wisconsin (Diagnostic) dataset from the sklearn.datasets
module.

Step 2: Data Preprocessing

This includes loading the dataset, handling missing values (if any), encoding categorical
variables, and scaling numerical features.

Step 3: Model Building

We'll use the GaussianNB classifier from sklearn.naive_bayes.

Step 4: Model Evaluation

We'll evaluate the performance of our model using accuracy, precision, recall, and F1-score.

Code & Results :


Machine Learning External Lab Assessment
Machine Learning External Lab Assessment

Explanation:

1. Loading the Dataset:


o We use load_breast_cancer from sklearn.datasets to load the breast
cancer dataset.
o We convert the data into a DataFrame for better understanding and print the
first few rows.
2. Data Preprocessing:
o We split the dataset into training and testing sets using train_test_split.
o We standardize the features using StandardScaler.
3. Model Building:
o We create a GaussianNB classifier and fit it to the training data.
4. Model Evaluation:
o We predict the labels for the test set.
o We calculate and print accuracy, precision, recall, and F1-score.
o We also print a detailed classification report and confusion matrix.

You might also like