Handling missing values using machine learning:
Filling missing values using Linear Regression:
Step 1: Test data will be missing values
Step 2: Drop the null values and consider it as train data
Checking null values in train data:
Step 3: Create x_train and y_train from the dataset
y_train is the rows of age with non null values
x_train is the dataset except age column with non null valuesStep 4 : Building the model
Step 5 :Creating X_test from Test_data
Step 6: Applying the model and predicting the missing values
Importing Libraries:
Loading dataset:
Printing first 10 rows of dataset:
Number of rows and columns in the dataset:
Overall information about the dataset:
Name of the columns:
Statistically describing the dataset:
Number of null values:
Visualizing null values using heat map:
Step 1: Separating the null values and consider as test data
Step 2: Dropping the null values and considering as train data set
Checking null values:
Step 3: Creating X_train and Y_train from the dataset
X_train is the dataset except the 'Age' column:
Step 4 : Building the model
Training the model:
Step 5: Creating X_test from Test_data
Step 6: Applying the model and predicting the missing values
Replacing the missing values by predicted values:
0 Comments