Lab 1
Lab 1
in the specified directory. Here's a complete example that demonstrates how to load the
dataset, perform some basic operations, and visualize the data using Matplotlib.
Make sure `Salary.csv` is in the same directory as your script, or provide the full path to
the file.
Let's perform a simple linear regression to predict Salary based on Years of Experience.
Mean Squared Error (MSE): Measures the average squared difference between
the actual and predicted values. Lower values are better.
R-squared (R²) score: Represents the proportion of variance in the dependent
variable that is predictable from the independent variable(s). Higher values
(closer to 1) are better.
X = dataset[['YearsExperience']]
y = dataset['Salary']