Linear Regression
Linear Regression
Linear Regression is a fundamental and widely used supervised machine learning algorithm for regression tasks. It
assumes a linear relationship between the independent variables (features) and the dependent variable (target).
For a project like Crab Age Prediction, Linear Regression would aim to predict the age of a crab based on physical
features such as weight, length, and shell dimensions.
Limitations
1. Linearity Assumption:
Linear Regression assumes a linear relationship between features and target, which may not hold true for
complex data like crab age prediction.
2. Sensitivity to Outliers:
Outliers can heavily influence the regression line, leading to inaccurate predictions.
3. Feature Dependency:
Multicollinearity among features can cause instability in coefficient estimates.
CODE
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
import matplotlib.pyplot as plt