Skip to main content

A package for breast cancer diagnosis using MLP classifier.

Project description

🩺 Breast Cancer Diagnosis with MLP 🧠

This project aims to develop a machine learning model for the diagnosis of breast cancer using a Multi-Layer Perceptron (MLP) classifier. The dataset utilized for this task is the Breast Cancer Wisconsin dataset, obtained from the UCI Machine Learning Repository.

🎯 Purpose

The main purpose of this code is to demonstrate the application of a MLP classifier in diagnosing breast cancer based on features extracted from fine needle aspiration (FNA) images of breast masses. The features describe various characteristics of cell nuclei present in the images. By analyzing these features, the MLP classifier can learn to differentiate between benign and malignant tumors, thereby aiding in the early detection and diagnosis of breast cancer.

🛠️ Decision Making

  1. Model Selection: The MLP classifier from the scikit-learn library is chosen for its ability to capture complex patterns in the data. MLPs are capable of learning non-linear relationships between features, making them suitable for this classification task.

  2. Data Preprocessing: Prior to training the model, the dataset is divided into training and testing sets using a standard 80-20 split. Additionally, feature scaling is performed using StandardScaler to standardize the feature values, ensuring that each feature contributes equally to the learning process and improving convergence speed.

  3. Model Training: The MLP model is instantiated with two hidden layers containing 100 and 50 neurons respectively. The 'adam' solver is chosen for optimization, and the model is trained with a maximum of 500 iterations. The 'verbose' parameter is set to 10 to display progress during training.

  4. Evaluation: After training, the model is evaluated using the testing set. Accuracy score and confusion matrix are computed to assess the performance of the model in diagnosing breast cancer.

🚀 Usage

To run the code, ensure that you have the required dependencies installed. You can execute the script in any Python environment that supports scikit-learn. Simply clone the repository and execute the breast_cancer_diagnosis_mlp.py script. Make sure to adjust any parameters or configurations as needed for your specific use case.

data = "ID: 842302, Diagnosis: M, mean_radius: 17.99, mean_texture: 10.38, mean_perimeter: 122.8, mean_area: 1001, mean_smoothness: 0.1184, mean_compactness: 0.2776, mean_concavity: 0.3001, mean_concave_points: 0.1471, mean_symmetry: 0.2419, mean_fractal_dimension: 0.07871, se_radius: 1.095, se_texture: 0.9053, se_perimeter: 8.589, se_area: 153.4, se_smoothness: 0.006399, se_compactness: 0.04904, se_concavity: 0.05373, se_concave_points: 0.01587, se_symmetry: 0.03003, se_fractal_dimension: 0.006193, worst_radius: 25.38, worst_texture: 17.33, worst_perimeter: 184.6, worst_area: 2019, worst_smoothness: 0.1622, worst_compactness: 0.6656, worst_concavity: 0.7119, worst_concave_points: 0.2654, worst_symmetry: 0.4601, worst_fractal_dimension: 0.1189"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

breastcancermlpmodel-0.0.30.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

BreastCancerMLPModel-0.0.30-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page