Introduction to Decision Trees For Classification Problems with a Python Example. #decisiontree #python #classification #datascience #statistics Code snippets used in the video: ``` # Install required packages pip install pandas scikit-learn # Download Pokemon dataset wget -q \ 194bcff35001e7eb53a2a8b441e8b2c6/raw/\ 92200bc0a673d5ce2110aaad4544ed6c4010f687/ # Load dataset import pandas as pd df = (" ").rename(columns={"Type 1": "Type"}) # Filter two types only data = (" (('Electric', 'Grass'))") # Training Dataset X = data[['HP', 'Attack', 'Defense', 'Speed', ]] # Features y = (data['Type'] == 'Electric') # = 0 if Grass, = 1 if Electric # Train decision tree from import DecisionTreeClassifier tree = DecisionTreeClassifier(max_depth=1).fit(X, y) # Plot decision tree from import plot_tree plot_tree(tree); # Predict using the decision tree predictions = (X) predictions[3] # is Pokemon at index 3 of type "Electric"? # Accuracy score from import accuracy_score accuracy_score(y, (X)) # change depth to 2 tree = DecisionTreeClassifier(max_depth=2).fit(X, y) ``` -------------------------- This video would not have been possible without the help of Gökçe Dayanıklı.











