0% found this document useful (0 votes)
8 views

AI in HC - 3

The document outlines an experiment aimed at breast cancer detection using machine learning techniques, specifically employing the Python programming language. It discusses the prevalence of breast cancer and provides a step-by-step guide to creating a detection model using the Gaussian Naive Bayes algorithm. The process includes loading the dataset, splitting it, and making predictions based on the trained model.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

AI in HC - 3

The document outlines an experiment aimed at breast cancer detection using machine learning techniques, specifically employing the Python programming language. It discusses the prevalence of breast cancer and provides a step-by-step guide to creating a detection model using the Gaussian Naive Bayes algorithm. The process includes loading the dataset, splitting it, and making predictions based on the trained model.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment - 3

Aim:- Breast Cancer Detection with Machine


Learning.

Theory:- Over the past decades, machine learning techniques


have been widely used in intelligent health systems, particularly
for breast cancer diagnosis and prognosis. In this article, I will
walk you through how to create a breast cancer detection model
using machine learning and the Python programming language.
Breast cancer is one of the most common cancers in women
globally, accounting for the majority of new cancer cases and
cancer-related deaths according to global statistics, making it a
major public health problem in the world. today’s society.

from sklearn.datasets import load_breast_cancer


from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.linear_model import LinearRegression
from sklearn.metrics import accuracy_score

Now we need to create new variables for each important set of


information that we find useful and assign the attributes in the
dataset to those variables:

data = load_breast_cancer()
label_names = data["target_names"]
labels = data["target"]
feature_names = data["feature_names"]
features = data["data"]
print(label_names)
print("Class label :", labels[0])
print(feature_names)
print(features[0], "\n")
Output:-

Splitting The Dataset

train, test, train_labels, test_labels = train_test_split(features, labels,


test_size=0

Using Naive Bayes for Breast Cancer Detection

gnb = GaussianNB()gnb.fit(train, train_labels)


preds = gnb.predict(test)
print(preds, "\n")
[1 0 0 1 1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0
1011011111111001111100110011100110010
1111110110000011111111001001001110110
1 1 0]

gnb = GaussianNB()gnb.fit(train, train_labels)


preds = gnb.predict(test)
print(preds, "\n")
[1 0 0 1 1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0
1011011111111001111100110011100110010
1111110110000011111111001001001110110
1 1 0]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy