<jupyter_start><jupyter_text>01 First ModelLittle data exploratin and a VERY simple OLS model<jupyter_code>import pandas as pd
import pandas_profiling as pp
df = pd.read_csv("../data/raw/train.csv")
df.head()
pr = pp.ProfileReport(df)
pr
from sklearn import linear_model
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>First modelVery first model, lets try something realy simple:* pick top 10 most highly correlated features with the target.* fill any missing values with the mode* Fit an OLS regression<jupyter_code>df.corrwith(df['SalePrice']).sort_values(ascending=False).index[1:10]
feats = pr.description_set['correlations']['spearman']["SalePrice"].sort_values(ascending=False).index[1:10]
target = "SalePrice"
df['GarageYrBlt'] = df['GarageYrBlt'].fillna(df['GarageYrBlt'].mode()[0])
pp.ProfileReport(df[feats])
X_train, X_test, y_train, y_test = train_test_split(df[feats], df[target], test_size=0.3)
rgr = linear_model.LinearRegression().fit(X_train, y_train)
mean_squared_error(y_test, rgr.predict(X_test))**0.5<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12020033388981637, 'fraction_numerical': 0.012520868113522538, 'mean_word_length': 8.669354838709678, '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': '253040', 'license': 'MIT', 'n_tokens_mistral': 439, 'n_tokens_neox': 414, 'n_words': 90, 'path': 'notebooks/01_first_model.ipynb', 'repo_name': 'CamCairns/house_price_model', 'size': '1198'}