<jupyter_start><jupyter_text>Data Preprocessing<jupyter_code># independent 
X = df.iloc[:, :-1].values 
# dependent 
y = df.iloc[:, -1].values 
X 
X.shape 
y 
y.shape
from sklearn.model_selection import train_test_split 
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=1/3, random_state=0)
X_train
X_test
y_train
y_test
from sklearn.linear_model import LinearRegression
reg = LinearRegression() 
reg.fit(X_train, y_train)
y_pred = reg.predict(X_test)
y_pred
y_test
print(reg.coef_)
print(reg.intercept_)
from sklearn import metrics
metrics.mean_absolute_error(y_test, y_pred)
metrics.mean_squared_error(y_test, y_pred)
np.sqrt(metrics.mean_squared_error(y_test, y_pred))
metrics.r2_score(y_test, y_pred)
plt.scatter(X_train, y_train, color='red')
plt.plot(X_train, reg.predict(X_train), color='blue')
plt.xlabel("Year of Experience")
plt.ylabel("Salary")
plt.title("Salary vs Experience(Training Set)")
plt.tight_layout() 
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12512716174974567, 'fraction_numerical': 0.006103763987792472, 'mean_word_length': 7.482758620689655, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '120809', 'license': 'MIT', 'n_tokens_mistral': 407, 'n_tokens_neox': 392, 'n_words': 72, 'path': '03-Regression/01-Simple-Linear-Regression.ipynb', 'repo_name': 'hossainlab/ML', 'size': '983'}