Unit5 - Linear Regression
Unit5 - Linear Regression
Linear Regression
Steps of Development of ML in Python
In [4]:
sns.pairplot(dataset)
plt.show()
In [5]:
print(dataset.columns)
print(dataset.shape)
print(dataset.info())
print(dataset.isnull().sum())
In [21]:
from sklearn.linear_model import LinearRegression
model = LinearRegression()
LinearRegression()
Out[22]:
[1200000. 800000.]
2.710505431213761e-20
1.1641532182693481e-10
1.6463612699567982e-10
In [25]:
print(model.coef_)
print(model.intercept_)
[100000.]
400000.00000000023
In [26]:
sns.distplot(predictions, hist = False, color = 'r', label = 'Predicted Values')
sns.distplot(Y_test, hist = False, color = 'b', label = 'Actual Values')
plt.legend(loc = "upper left")
plt.show()
C:\Users\chinu\anaconda3\lib\site-packages\seaborn\distributions.py:2619: FutureWarn
ing: `distplot` is a deprecated function and will be removed in a future version. Pl
ease adapt your code to use either `displot` (a figure-level function with similar f
lexibility) or `kdeplot` (an axes-level function for kernel density plots).
warnings.warn(msg, FutureWarning)
C:\Users\chinu\anaconda3\lib\site-packages\seaborn\distributions.py:2619: FutureWarn
ing: `distplot` is a deprecated function and will be removed in a future version. Pl
ease adapt your code to use either `displot` (a figure-level function with similar f
lexibility) or `kdeplot` (an axes-level function for kernel density plots).
warnings.warn(msg, FutureWarning)
Predictions
In [27]:
experience = np.array([[int(input("Enter your years of experince :"))]])
salary = model.predict(experience.reshape((-1,1)))
print(salary)
In [ ]: