Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Certainly! Here's a draft for a README.md file based on your drug classification project:


Drug Classification Using Machine Learning

This project uses machine learning techniques to classify drugs based on patient features like Age, Sex, Blood Pressure (BP), Cholesterol levels, and Na-to-K ratio. The objective is to predict the appropriate drug class for each patient.

Table of Contents

Project Overview

This project implements various machine learning models, including:

  • K-Nearest Neighbors (KNN)
  • Decision Tree Classifier
  • Random Forest Classifier

The dataset contains patient information such as age, sex, blood pressure levels, cholesterol levels, and the Na-to-K ratio. Based on these features, the goal is to predict the appropriate drug from a set of possible drug classes.

Data

The dataset contains 200 records, each representing a patient. The features include:

  • Age: Integer value representing the age of the patient.
  • Sex: Categorical value (Male or Female).
  • Blood Pressure: Categorical value (High, Normal, Low).
  • Cholesterol: Categorical value (High, Normal).
  • Na-to-K Ratio: A floating-point number representing the ratio of sodium to potassium in the blood.
  • Drug: The target variable indicating the prescribed drug.

Preprocessing

  • Encoding: Categorical features (Sex, BP, Cholesterol) are encoded into numerical form.
  • Train-Test Split: The dataset is split into training and testing sets to validate model performance.
  • Data Visualization: Histograms and pie charts are used to explore feature distributions.

Models Used

The following models are implemented:

  1. K-Nearest Neighbors (KNN)

    • Accuracy: 73.3%
    • Distance-based classification, sensitive to the choice of k.
  2. Decision Tree Classifier

    • Accuracy comparable to KNN.
    • Works by recursively splitting the data based on feature thresholds.
  3. Random Forest Classifier

    • Ensemble learning technique combining multiple decision trees.
    • Improved accuracy and generalization compared to individual models.

Results

  • Random Forest Classifier provided the best overall accuracy and stability across the test dataset.
  • The model successfully classified drugs with higher accuracy and reduced overfitting compared to KNN and Decision Trees.

Dependencies

To run the project, the following Python libraries are required:

  • pandas
  • numpy
  • matplotlib
  • scikit-learn

Install dependencies via pip:

pip install -r requirements.txt

Usage

  1. Clone the repository:

    git clone https://github.com/your-username/drug-classification.git
    cd drug-classification
  2. Install the required libraries:

    pip install -r requirements.txt
  3. Run the drug_classification.py script:

    python drug_classification.py
  4. View the results and accuracy metrics for each model.

Future Improvements

  • Hyperparameter Tuning: Adjusting parameters of Random Forest and KNN to further improve model accuracy.
  • Feature Engineering: Creating additional features or transforming existing ones to enhance model performance.
  • Cross-Validation: Applying cross-validation to better evaluate model performance on unseen data.
  • Deep Learning Models: Exploring the potential of neural networks for drug classification tasks.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages