This repository contains Data Science projects
Project 1: Iris Classification
Description The Iris Classification project aims to classify iris flowers into three different species: Iris setosa, Iris versicolor, and Iris virginica, based on the measurements of their sepals and petals. This is achieved by using machine learning algorithms to train a model on a dataset containing these measurements. The project demonstrates the process of loading and preprocessing data, training and evaluating a machine learning model, and making predictions on new data.
Project 2: Spam Detection Description
The Spam Detection project focuses on identifying whether an email is spam or not based on its content. Using the SMS Spam Collection dataset, which contains labeled examples of both spam and ham (non-spam) messages, a machine learning model is trained to recognize patterns and characteristics typical of spam messages. The project involves text preprocessing, feature extraction, model training, and evaluation. The resulting model can then be used to classify new messages as either spam or non-spam.
This repository contains two distinct projects that utilize machine learning for classification tasks: Iris Flower Classification and Spam Detection.
This repository contains implementations of two machine learning projects:
- Iris Classification: Classifying iris flowers into three species based on their sepal and petal measurements.
- Spam Detection: Identifying whether a given email is spam or not based on its content.
The Iris dataset is a classic dataset in the field of machine learning and is included in the scikit-learn
library. It consists of 150 samples from three species of Iris flowers (Iris setosa, Iris versicolor, and Iris virginica). Each sample has four features: sepal length, sepal width, petal length, and petal width.
- Python 3.x
- pandas
- numpy
- scikit-learn
- matplotlib (optional, for data visualization)
Install the dependencies using pip:
pip install pandas numpy scikit-learn matplotlib
To train the Iris classification model, open and run the Iris.ipynb
Jupyter notebook. This notebook loads the dataset, splits it into training and test sets, trains a classifier (e.g., SVM, Random Forest, etc.), and evaluates the model's performance.
To use the trained Iris classification model for predictions, you can export the trained model from the notebook and create a script similar to:
import joblib
# Load the trained model
model = joblib.load('iris_model.pkl')
# Sample input
sepal_length = 5.1
sepal_width = 3.5
petal_length = 1.4
petal_width = 0.2
# Make a prediction
prediction = model.predict([[sepal_length, sepal_width, petal_length, petal_width]])
print(f'The predicted species is: {prediction[0]}')
Project 2: Spam Detection
The Spam Detection project uses the SMS Spam Collection dataset, which consists of a collection of SMS messages labeled as "spam" or "ham" (not spam).
- Python 3.x
- pandas
- numpy
- scikit-learn
- nltk (for text processing)
- matplotlib (optional, for data visualization)
Install the dependencies using pip:
pip install pandas numpy scikit-learn nltk matplotlib
### Model Training
To train the Spam detection model, open and run the `email_filtering.ipynb` Jupyter notebook. This notebook preprocesses the text data, splits it into training and test sets, trains a classifier (e.g., Naive Bayes, SVM, etc.), and evaluates the model's performance.
### Usage
To use the trained Spam detection model for predictions