Salary Prediction with Linear Regression
Salary Prediction with Linear Regression
MAE provides an average prediction error magnitude, easily interpretable in the original data units, highlighting error context. MSE, emphasizing larger errors, aids in penalizing models more for larger discrepancies, but an increase in MSE could mask specific model deficiencies due to squared error emphasis. Thus, the choice affects error sensitivity and model refinement priorities .
An R² value of 0.28 indicates that only 28% of the variability in the salary can be explained by the years of experience. This suggests that the linear model may be underfitting the data and that other factors may significantly influence salary, which are not considered in the model .
MAE and MSE measure the average magnitude of errors in predictions without considering their direction and square the differences before taking the average, respectively. The given MAE of 1484.72 and MSE of 2808565.82 indicate relatively high prediction errors, suggesting that the model's predictions deviate significantly from the actual values .
Increasing the 'order' parameter changes the model from linear to polynomial, potentially fitting data with more complexity and capturing non-linear relationships. This can improve model fit if the true relationship is non-linear but introduces risk of overfitting if not justified by the data .
A predictable pattern indicates a potential relationship between the independent and dependent variable, confirming model assumptions. However, as the scatter plot reflects assumptions only based on given variables, any missing influential variables can lead to model underperformance in representing real-world settings .
Data standardization is not critical when the regression model relies on only one feature, as relative range discrepancies don't exist between features. It becomes essential in multi-feature models to normalize varying scales, ensuring model estimates aren't biased to scale-dominant features .
Forward filling replaces missing values with the last observed data point, ensuring the continuity of the dataset. This can introduce bias if the past data point is not representative. Dropping NaN values removes incomplete data rows, potentially reducing the dataset size, affecting model training due to less data being available .
Reshaping data arrays aligns data into a required format for processing by ML algorithms. In linear regression, each sample should be in a single column (feature) format. Reshaping from 1D to 2D ensures compliance with input requirements, facilitating correct model training and predictions .
Splitting data into training and testing sets helps to evaluate how well the model generalizes to unseen data. A 75%-25% split is common as it provides sufficient data for training while maintaining a meaningful portion for testing. This balance allows for robust model evaluation and helps prevent overfitting .
The analysis shows a low R² value, which implies a weak linear relationship between years of experience and salary. This suggests that other factors aside from experience significantly impact salary, indicating that a linear model may be inadequate for capturing the complexity of the relationship .