LAB7
LAB7
import pandas as pd
import numpy as np
data = {
'Area': [1000, 1200, 1500, 1800, 2000, 2200, 2500, 2700, 3000],
'Price': [200000, 240000, 300000, 360000, 400000, 440000, 500000, 540000, 600000]
df = pd.DataFrame(data)
X = df[['Area']]
y = df['Price']
regressor = LinearRegression()
regressor.fit(X, y)
y_pred = regressor.predict(X)
# Print Coe icients
print("Intercept:", regressor.intercept_)
# Plotting
plt.ylabel('Price ($)')
plt.legend()
plt.grid(True)
plt.show()
OUTPUT: