<jupyter_start><jupyter_text>Regresión <NAME>  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 el Random Forest con el dataset<jupyter_code>from sklearn.ensemble import RandomForestRegressor
regression = RandomForestRegressor(n_estimators = 300, random_state = 0)
regression.fit(X, y)<jupyter_output><empty_output><jupyter_text>Predicción de nuestros modelos con Random Forest<jupyter_code>y_pred = regression.predict([[6.0], [6.4], [6.5], [6.6], [6.7], [7.0]])
y_pred[6.5]<jupyter_output><empty_output><jupyter_text>Visualización de los resultados del Random Forest<jupyter_code>X_grid = np.arange(min(X), max(X), 0.01)
X_grid = X_grid.reshape(len(X_grid), 1)
plt.scatter(X, y, color = "red")
plt.plot(X_grid, regression.predict(X_grid), color = "blue")
plt.title("Modelo de Regresión con Random Forest")
plt.xlabel("Posición del empleado")
plt.ylabel("Sueldo (en $)")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13872832369942195, 'fraction_numerical': 0.02064409578860446, 'mean_word_length': 8.46875, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, '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': '494532', 'license': 'MIT', 'n_tokens_mistral': 492, 'n_tokens_neox': 472, 'n_words': 88, 'path': 'Notebook/2.Regresion/7.random_forest_regression.ipynb', 'repo_name': 'ESOJ74/machinelearning-az', 'size': '1223'}