Answers for "linearRegression python"

8

scikit learn linear regression

from sklearn.linear_model import LinearRegression
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3
reg = LinearRegression().fit(X, y)
reg.score(X, y)
reg.coef_
reg.intercept_
reg.predict(np.array([[3, 5]]))
Posted by: Guest on September-06-2020
0

python linear regression

from sklearn.linear_model import LinearRegression
#x, y = np.array([0,1,2,3,4,5])

model = LinearRegression().fit(x.reshape(-1,1), y.reshape(-1,1))
r_sq = model.score(x.reshape(-1,1), y.reshape(-1,1))
q = model.intercept_
m = model.coef_

y_fit = np.array([i*m[0] for i in x]+q[0])
Posted by: Guest on October-02-2021
0

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)
Posted by: Guest on May-18-2021
0

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()
Posted by: Guest on May-14-2021

Code answers related to "linearRegression python"

Python Answers by Framework

Browse Popular Code Answers by Language