<jupyter_start><jupyter_text>linear regressionfind f(x) such most fits sample data  often, mean square error avg(|y-f(x)|) is minimized  reference: https://qiita.com/m-hayashi/items/ee379c86e3e18f0ddc6d<jupyter_code>import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
from sklearn import linear_model
%matplotlib inline
# datasets
X = pd.DataFrame([0, 1, 2, 3, 4, 5])
Y = pd.DataFrame([3, 2, 5, 7, 6, 10])
# define model
model = linear_model.LinearRegression()
model.fit(X, Y)
# warniing seems to be harmless
# view model
px = np.arange(int(X.min()), int(X.max()), 0.01)[:, np.newaxis]
py = model.predict(px)
plt.scatter(X, Y, color='red')
plt.plot(px, py, color='blue')
print(model.coef_)
print(model.intercept_)<jupyter_output>[[1.4]]
[2.]
{'fraction_non_alphanumeric': 0.1542483660130719, 'fraction_numerical': 0.03790849673202614, 'mean_word_length': 5.660869565217391, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '488054', 'license': 'MIT', 'n_tokens_mistral': 322, 'n_tokens_neox': 298, 'n_words': 80, 'path': 'regression/linear_regression/simple.ipynb', 'repo_name': 'fumiphys/data-science', 'size': '765'}