Skip to content

Divyanshu-spec-code/Machine-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸͺ¨ Sonar Rock vs Mine Prediction using Logistic Regression This project uses a Logistic Regression model to classify sonar signals as either rock or mine based on the sonar dataset from the UCI Machine Learning Repository. The dataset contains 60 numerical features representing sonar signal strengths bounced off surfaces.

πŸ“Œ Problem Statement Sonar signals are used to detect objects under the sea. The goal is to predict whether the object is a rock or a mine (metal cylinder) based on the sonar return signal data.

πŸ“‚ Dataset Source: UCI Sonar Dataset

Features: 60 numeric attributes (energy values in different frequency bands)

Target:

R: Rock

M: Mine

βš™οΈ Technologies Used Python 🐍

NumPy

Pandas

Matplotlib / Seaborn

Scikit-learn

πŸ“ˆ Model Used Logistic Regression

Suitable for binary classification

Outputs probability and class label (0 or 1)

Used with scaling and train-test split

πŸš€ How to Run

  1. Clone the Repository bash Copy Edit git clone https://github.com/Divyanshu-spec -code/sonar-rock-vs-mine.git cd sonar-rock-vs-mine
  2. Install Dependencies bash Copy Edit pip install -r requirements.txt
  3. Run the Code bash Copy Edit python sonar_logistic_regression.py πŸ§ͺ Project Workflow Importing Libraries

Loading the Dataset

Data Exploration and Visualization

Data Preprocessing

Label encoding (R β†’ 0, M β†’ 1)

Train-test split

Feature scaling

Model Training

Logistic Regression with sklearn

Model Evaluation

Accuracy score

Confusion matrix

Classification report

Making Predictions

πŸ“Š Results Accuracy: ~85%–90% (varies slightly due to train-test split randomness)

Model is able to distinguish between rock and mine objects effectively.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published