# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Multivariate Regression
#
# https://scikit-learn.org/stable/modules/linear_model.html

# ## Dummy Data Generation

import numpy as np
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
Y = np.array([1, 1, 1, 2, 2, 2])

# ## Trainig

from sklearn import linear_model
reg = linear_model.LinearRegression()
reg.fit(X,Y)

# ## Regression parameters

print("Slope: ",reg.coef_)
print("Intercept: ",reg.intercept_)

# ## Prediction

print(reg.predict([[-0.8,1]]))
print(reg.predict([[0,1],[ 2,1]]))

# ## Accuracy

print("R- Squared Score: ", reg.score(X,Y))

StarcoderdataJupyterScriptsDedupFiltered