<jupyter_start><jupyter_text>Training and Evaluating on the Training Set<jupyter_code>import os
import pandas as pd
import numpy as np 
from sklearn.linear_model import LinearRegression

import matplotlib.pyplot as plt
WORKING_PATH = os.path.join("working", "housing")
numpy_train_path = os.path.join(WORKING_PATH,"data_train.npy")
numpy_labels_path = os.path.join(WORKING_PATH,"data_lables.npy")


housing_prepared = np.load(numpy_train_path)

housing_labels = np.load(numpy_labels_path)<jupyter_output><empty_output><jupyter_text>Start the train<jupyter_code>lin_reg = LinearRegression()
lin_reg.fit(housing_prepared, housing_labels)
some_data = housing.iloc[:5]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09798270893371758, 'fraction_numerical': 0.001440922190201729, 'mean_word_length': 9.220588235294118, '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': '313289', 'license': 'Apache-2.0', 'n_tokens_mistral': 260, 'n_tokens_neox': 251, 'n_words': 42, 'path': 'chapter2/Train.ipynb', 'repo_name': 'FarhadManiCodes/handson-ml2', 'size': '694'}