<jupyter_start><jupyter_text>Linear Model w/ sklearn<jupyter_code>import sklearn.linear_model
import sklearn.neighbors
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Load the data
oecd_bli = pd.read_csv("oecd_bli_2015.csv", thousands=',')
gdp_per_capita = pd.read_csv("gdp_per_capita.csv", thousands=',', delimiter='\t', encoding='latin1', na_values="n/a")
#Preparing data
country_stats = prepare_country_stats(oecd_bli, gdp_per_capita)
X = np.c_[country_stats["GDP per capita"]]
y = np.c_[country_stats["Life Satisfaction"]]
#Vizualizing data
country_stats.plot(kind="scatter", x="GDP per capita", y="Life Satisfaction")
plt.show()
#Selecting Linear Model
model = sklearn.linear_model.LinearRegression()
#Selecting k-N neighbors
model = sklearn.neighbors.KNeighborsRegressor(n_neighbors=3)
#Model train
model.fit(X, y)
#Predicting for Chipre
X_new = [[22587]]
print(model.predict(X_new))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1292372881355932, 'fraction_numerical': 0.011652542372881356, 'mean_word_length': 8.264705882352942, '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': '78927', 'license': 'MIT', 'n_tokens_mistral': 375, 'n_tokens_neox': 357, 'n_words': 72, 'path': 'Untitled.ipynb', 'repo_name': 'Isaquehg/ML', 'size': '944'}