<jupyter_start><jupyter_text>Regresión con Árboles de Decisión  Cómo importar las librerías<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import pandas as pd<jupyter_output><empty_output><jupyter_text>Importar el data set<jupyter_code>dataset = pd.read_csv('Position_Salaries.csv')
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values<jupyter_output><empty_output><jupyter_text>Ajustar la regresión con el dataset<jupyter_code>from sklearn.tree import DecisionTreeRegressor
regression = DecisionTreeRegressor(random_state = 0)
regression.fit(X, y)<jupyter_output><empty_output><jupyter_text>Predicción de nuestros modelos<jupyter_code>y_pred = regression.predict([[6.0],[6.4],[6.5],[6.6],[7.0]])
print(y_pred)<jupyter_output>[150000. 150000. 150000. 200000. 200000.]<jupyter_text>Visualización de los resultados del Modelo Polinómico<jupyter_code># X_grid = np.arange(min(X), max(X), 0.1)
# X_grid = X_grid.reshape(len(X_grid), 1)
plt.scatter(X, y, color = "red")
plt.plot(X, regression.predict(X), color = "blue")
plt.title("Modelo de Regresión")
plt.xlabel("Posición del empleado")
plt.ylabel("Sueldo (en $)")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14079728583545378, 'fraction_numerical': 0.03986429177268872, 'mean_word_length': 8.44, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '356086', 'license': 'MIT', 'n_tokens_mistral': 511, 'n_tokens_neox': 463, 'n_words': 82, 'path': 'Notebook/2.Regresion/6.decission_tree_regression.ipynb', 'repo_name': 'ESOJ74/machinelearning-az', 'size': '1179'}