Decision Tree in Python

3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€41.81
List Price:  €58.53
You save:  €16.72
£36.21
List Price:  £50.70
You save:  £14.48
CA$67.66
List Price:  CA$94.73
You save:  CA$27.07
A$70.84
List Price:  A$99.19
You save:  A$28.34
S$63.19
List Price:  S$88.47
You save:  S$25.28
HK$390.20
List Price:  HK$546.31
You save:  HK$156.11
CHF 38.38
List Price:  CHF 53.74
You save:  CHF 15.35
NOK kr478.85
List Price:  NOK kr670.43
You save:  NOK kr191.57
DKK kr312.19
List Price:  DKK kr437.10
You save:  DKK kr124.90
NZ$82.40
List Price:  NZ$115.37
You save:  NZ$32.96
د.إ183.58
List Price:  د.إ257.03
You save:  د.إ73.45
৳6,112.16
List Price:  ৳8,557.52
You save:  ৳2,445.35
₹4,597.61
List Price:  ₹6,437.02
You save:  ₹1,839.41
RM196.33
List Price:  RM274.88
You save:  RM78.55
₦69,348.62
List Price:  ₦97,093.62
You save:  ₦27,745
₨13,992.41
List Price:  ₨19,590.50
You save:  ₨5,598.08
฿1,558.73
List Price:  ฿2,182.35
You save:  ฿623.62
₺2,170.81
List Price:  ₺3,039.30
You save:  ₺868.49
B$260.01
List Price:  B$364.04
You save:  B$104.02
R787.55
List Price:  R1,102.63
You save:  R315.08
Лв81.77
List Price:  Лв114.48
You save:  Лв32.71
₩71,595.81
List Price:  ₩100,239.87
You save:  ₩28,644.05
₪154.14
List Price:  ₪215.81
You save:  ₪61.66
₱2,949.54
List Price:  ₱4,129.60
You save:  ₱1,180.05
¥7,664.25
List Price:  ¥10,730.56
You save:  ¥3,066.31
MX$857.41
List Price:  MX$1,200.44
You save:  MX$343.03
QR181.86
List Price:  QR254.62
You save:  QR72.75
P654.47
List Price:  P916.31
You save:  P261.84
KSh6,446.21
List Price:  KSh9,025.21
You save:  KSh2,579
E£2,343.91
List Price:  E£3,281.67
You save:  E£937.75
ብር7,777.53
List Price:  ብር10,889.17
You save:  ብር3,111.63
Kz45,597.52
List Price:  Kz63,840.18
You save:  Kz18,242.66
CLP$43,282.19
List Price:  CLP$60,598.53
You save:  CLP$17,316.34
CN¥347.18
List Price:  CN¥486.08
You save:  CN¥138.90
RD$3,147.03
List Price:  RD$4,406.10
You save:  RD$1,259.06
DA6,454
List Price:  DA9,036.12
You save:  DA2,582.11
FJ$109.50
List Price:  FJ$153.32
You save:  FJ$43.81
Q383.74
List Price:  Q537.26
You save:  Q153.52
GY$10,464.44
List Price:  GY$14,651.06
You save:  GY$4,186.61
ISK kr6,054.78
List Price:  ISK kr8,477.18
You save:  ISK kr2,422.40
DH452.24
List Price:  DH633.17
You save:  DH180.93
L840.87
List Price:  L1,177.29
You save:  L336.41
ден2,574.82
List Price:  ден3,604.96
You save:  ден1,030.13
MOP$401.97
List Price:  MOP$562.79
You save:  MOP$160.82
N$795.31
List Price:  N$1,113.50
You save:  N$318.18
C$1,840.56
List Price:  C$2,576.94
You save:  C$736.37
रु7,350.97
List Price:  रु10,291.94
You save:  रु2,940.97
S/167.35
List Price:  S/234.31
You save:  S/66.95
K214.10
List Price:  K299.76
You save:  K85.65
SAR187.49
List Price:  SAR262.50
You save:  SAR75.01
ZK994.08
List Price:  ZK1,391.79
You save:  ZK397.71
L213.07
List Price:  L298.31
You save:  L85.24
Kč1,016.13
List Price:  Kč1,422.66
You save:  Kč406.53
Ft15,954.66
List Price:  Ft22,337.81
You save:  Ft6,383.14
SEK kr442.46
List Price:  SEK kr619.48
You save:  SEK kr177.02
ARS$72,210.55
List Price:  ARS$101,100.55
You save:  ARS$28,890
Bs345.62
List Price:  Bs483.90
You save:  Bs138.27
COP$182,899.65
List Price:  COP$256,074.14
You save:  COP$73,174.49
₡24,825.23
List Price:  ₡34,757.30
You save:  ₡9,932.07
L1,319.97
List Price:  L1,848.07
You save:  L528.09
₲335,885
List Price:  ₲470,265.88
You save:  ₲134,380.87
$U1,871.59
List Price:  $U2,620.38
You save:  $U748.78
zł175.89
List Price:  zł246.26
You save:  zł70.37
Already have an account? Log In

Transcript

Talk country Python, we need to import a decision tree here. So we import from SK learn dot tree decision tree classifier. Okay, so for these our decision tree classifier, I'm going to change the sny. The decision tree classifier is our classification. So, classification is to predict all those variables that have all those across all categories. So classification is to predict categorical variables.

So to do that, I change this one to minus one, and then these two four, so x minus one in my data set so I have our 12345 elbows So minus one. So, I was left wrong first year, second year over here and four here over here. So minus one I I will take from this first year to the proper tempo why I will put four. So 01234 so far is the paper over here. So, I can create a decision tree using something like this okay Mada equal decision tree classifier, model dot v, x train, y train and prediction equals model dot predict x test okay so I can run this code and I will get my prediction okay green the key print the so maybe I need to pray my prediction also pray prediction so I run my code okay so here are all my predictions for all the testing data.

So he let's say we are going to do some regression you can pull out regressors here and everything will be around see just a decision tree regressor is for doing regression. So it will be more or less on the predicting or those are numeric variables. So, for this decision tree I will say the algorithm is actually a CRT or CRT algorithm or the ID tree algorithm, Id three algorithm will use all those information gain to actually select a variable for CRT they will use some of those entropy and Gini index to select a variable instead. So, for this one we are using the CRT algorithm

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.