ML context for the day – 18th August 2021
Simple linear regression
y = mx + c
y – Dependent variable(DV)
x – Independent variable(IV)
c – constant
AI Context for the day – 6th August 2021
Training set and Test set
Filling missing data using scikit
from sklearn.impute import SimpleImputer
We are importing the simple imputer from scikit library.
imputer = SimpleImputer(missing_values=np.nan, strategy=’mean’)
The strategy used is mean, where the missing data is replaced by average of the values.
imputer.fit(X[:, 1:3])
The number of columns on which the above function is used is 2 i.e between 1 and 3.
X[:, 1:3] = imputer.transform(X[:, 1:3])
The new column is again assigned to the 2 columns.
Importing dataset in Python
dataset = [library alias name].read_csv(‘file.csv’)
x = dataset.iloc[:,:-1].values
y = dataset.iloc[:, -1].values
In the above lines, read_csv and iloc are functions.
[:,:-1] is slicing range of the values.
Importing libraries in Python
Syntax
import [library] as []