This project uses machine learning to predict whether an object detected by a sonar is a rock or a mine. It utilizes a Logistic Regression model trained on a dataset of sonar signals.
The dataset used for this project contains sonar signals and their corresponding labels (Rock or Mine). It is in CSV format and can be found in the file sonar data.csv.
- Features: 60 numerical features representing the energy within various frequency bands.
- Target: A categorical label indicating whether the object is a 'R' (Rock) or 'M' (Mine).
- Data Loading and Preprocessing: The dataset is loaded into a Pandas DataFrame and basic statistical analysis is performed.
- Feature Extraction: The dataset is split into features (X) and target (Y).
- Data Splitting: The data is split into training and testing sets using
train_test_splitwith a test size of 10% and stratification to ensure balanced class distribution. - Model Training: A Logistic Regression model is trained using the training data.
- Model Evaluation: The model's accuracy is evaluated on both the training and testing sets using
accuracy_score. - Prediction: A predictive system is created to classify new sonar inputs as Rock or Mine.
- Install Dependencies: Make sure you have the necessary libraries installed: pip install numpy pandas scikit-learn
- Run the Code: Execute the provided Python code in a Google Colab environment.
- Input Data: Modify the
input_datavariable with the sonar readings for the object you want to classify. - View Prediction: The code will print the prediction (Rock or Mine) to the console.
The model achieved an accuracy of approximately [insert accuracy scores here] on the training and testing sets, respectively.
[Include an image of the project's workflow or a visualization of the data here. You can use an image hosting service like Imgur or upload it directly to your repository. Example: ]
This project demonstrates the application of machine learning for sonar target classification. The Logistic Regression model shows promising results, but further improvements can be explored with different algorithms or feature engineering techniques.
Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.
This project is licensed under the [insert license name here] License.