<jupyter_start><jupyter_text>Decision Tree Classification<jupyter_code>import pandas as pd
df = pd.read_csv("salaries.csv")
df.head()
inputs = df.drop('salary_more_then_100k',axis='columns')
target = df['salary_more_then_100k']
from sklearn.preprocessing import LabelEncoder
le_company = LabelEncoder()
le_job = LabelEncoder()
le_degree = LabelEncoder()
inputs['company_n'] = le_company.fit_transform(inputs['company'])
inputs['job_n'] = le_job.fit_transform(inputs['job'])
inputs['degree_n'] = le_degree.fit_transform(inputs['degree'])
inputs
inputs_n = inputs.drop(['company','job','degree'],axis='columns')
inputs_n
target
from sklearn import tree
model = tree.DecisionTreeClassifier()
model.fit(inputs_n, target)
model.score(inputs_n,target)<jupyter_output><empty_output><jupyter_text>**Is salary of Google, Computer Engineer, Bachelors degree > 100 k ?**<jupyter_code>model.predict([[2,1,0]])<jupyter_output><empty_output><jupyter_text>**Is salary of Google, Computer Engineer, Masters degree > 100 k ?**<jupyter_code>model.predict([[2,1,1]])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14948932219127206, 'fraction_numerical': 0.016713091922005572, 'mean_word_length': 10.977777777777778, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '272044', 'license': 'MIT', 'n_tokens_mistral': 383, 'n_tokens_neox': 369, 'n_words': 63, 'path': "Program's_Contributed_By_Contributors/AI-Summer-Course/py-master/ML/9_decision_tree/9_decision_tree.ipynb", 'repo_name': 'siddharthdeo99/Hacktoberfest2k21', 'size': '1077'}