<jupyter_start><jupyter_text>Decision Tree Regression - Predicting Salaries<jupyter_code># importing required libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
dataset.head()
X = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values<jupyter_output><empty_output><jupyter_text>Trainig the Decision Tree Regression model on the whole dataset<jupyter_code>from sklearn.tree import DecisionTreeRegressor
regressor = DecisionTreeRegressor(random_state=0)
regressor.fit(X,y)
# Predicting a new result
regressor.predict([[6.5]])<jupyter_output><empty_output><jupyter_text>Visualising the Decision Tree Regression results (higher resolution)<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, regressor.predict(x_grid),color='blue')
plt.title('Truth or Bluff (Decision Tree Regression)')
plt.xlabel('Position level')
plt.ylabel('Salary')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12698412698412698, 'fraction_numerical': 0.009337068160597572, 'mean_word_length': 8.403508771929825, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '95434', 'license': 'Apache-2.0', 'n_tokens_mistral': 398, 'n_tokens_neox': 372, 'n_words': 80, 'path': 'Part 1 - Regression/5. Decision Tree Regression/Decision Tree Regression - Position Salaries.ipynb', 'repo_name': 'gopalchettri/Machine_Learning_A_to_Z', 'size': '1071'}