How to build a basic machine learning model from scratch
In this tutorial, we will learn how to build a machine learning model using python from scratch.
1) Getting the data
I chose a data-set titled “Cars” data from Kaggle the author of this data set is Lilit Janughazyan [1]. This data set has 428 instances and 15 features also called as rows and columns. Since the data set was already in a CSV format. All I had to do is just format the data into a pandas data frame. The data set can be found here: Cars dataset
# Importing the required librariesimport pandas as pd
import numpy as np
import seaborn as sns #visualisation
import matplotlib.pyplot as plt #visualisation
%matplotlib inline
sns.set(color_codes=True)# Loading the CSV file into a pandas dataframe.df = pd.read_csv(“CARS.csv”)
df.head(5)
Removing irrelevant features.
I will remove some features such as Drive Train, Model, Invoice, Type, and Origin from this dataset. Because these features do not contribute to the prediction of price.
# Removing irrelevant…