linear regression code in python code example
Example 1: linear regression in python
from sklearn.linear_model import LinearRegression
lm = LinearRegression()
lm.fit(X, y)
Example 2: python linear regression
>>> from scipy import stats
>>> import numpy as np
>>> x = np.random.random(10)
>>> y = np.random.random(10)
>>> slope, intercept, r_value, p_value, std_err = stats.linregress(x,y)
Example 3: python linear regression
import seaborn as sb
from matplotlib import pyplot as plt
df = sb.load_dataset('tips')
sb.regplot(x = "total_bill", y = "tip", data = df)
plt.show()