linear regression with 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)