<jupyter_start><jupyter_text>Linear Regression<jupyter_code>X.drop('const', inplace=True, axis=1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
model = LinearRegression(n_jobs=4).fit(X_train, y_train)

r_sq = model.score(X_train, y_train)
print('coefficient of determination:', r_sq)

print('intercept:', model.intercept_)

print('slope:', model.coef_)
y_pred = model.predict(X_test)
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
mean_absolute_error(y_test, y_pred)
mean_squared_error(y_test, y_pred)<jupyter_output><empty_output><jupyter_text>Train Final Model<jupyter_code>model = LinearRegression(n_jobs=4).fit(X, y)
r_sq = model.score(X_train, y_train)
print('coefficient of determination:', r_sq)

print('intercept:', model.intercept_)

print('slope:', model.coef_)
y_pred = model.predict(X)
mean_absolute_error(y, y_pred)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13052631578947368, 'fraction_numerical': 0.007368421052631579, 'mean_word_length': 10.188235294117646, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '165998', 'license': 'MIT', 'n_tokens_mistral': 380, 'n_tokens_neox': 367, 'n_words': 59, 'path': 'notebooks/build_model.ipynb', 'repo_name': 'Guillin/alixpartners', 'size': '950'}