DEV Community

Cover image for Interesting Machine Learning Projects : Rock Vs Mine Prediction
Prakash Singh
Prakash Singh

Posted on

Interesting Machine Learning Projects : Rock Vs Mine Prediction

Suppose there is a war between countries and we have assigned submarines to check whether there is rock or a mine inside water.

Mines are explosives that explode when some object come in contact with it.

And there can be rocks as well in the ocean.

What to build ?
→ Submarines have to predict whether it is crossing a mine or a rock. So, we have to build a system to predict whether the object beneath the submarine is mine or rock.

How it can be done ?
→ Submarine uses a sonar that sends sound signal and reviews switch back of the signal. So, this signal is then processed to detect whether the object is mine or just a rock in the ocean.
These sound waves can travel for hundreds of miles under water, and can retain an intensity of 140 decibels as far as 300 miles from their source.

WorkFlow :


Collect Sonar Data : Laboratory setup experiment can be done where sonar is used to send and receive signals. There is far difference between signals received from mines and rocks. Because mines will be made up of metal.
So, we collect this data which is nothing but the sonar data obtained from a rock and a metal cylinder.
And later, we use this sonar data and feed it to our machine learning model.
and our model will predict whether the object is made up of metal or it is just a rock.
This is the principle we are going to use in our prediction.

Data Preprocessing : We must process data for better results. In preprocessing, we do cleaning, filling missing values etc.

Train Test Split : After that, we will train our model with 80-90% of training-data and 10–20% will be used to test-data. And evaluate our model with the help of test-data.

Logistic Regression Model : Why Logistic Regression Model ? Because, this model works very well for Binary Classification Problem. It is a Binary Classification Problem (Rock or a Mine).
This is a Supervised Learning Algorithm.


# Importing Dependencies
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score

# Dataset Reading

# Check relation between classes

# Separating input-output columns

# train_test_split

# Model Building

# Model Fitting,Y_train)

# accuracy on training data

# accuracy on test data

# Check Github Link For Full Code And Dataset

Enter fullscreen mode Exit fullscreen mode

Github Link : Click Here

Top comments (1)

prynsh7 profile image
priyansh raj

good read!