Reputation: 4623
I have a dataset of 100 records , I ran decision tree using the dataset .
On println(model.toDebugString)
Output is :
DecisionTreeModel classifier of depth 3 with 7 nodes
If (feature 0 <= 2.0)
Predict: 0.0
Else (feature 0 > 2.0)
If (feature 1 <= 12354.0)
If (feature 2 <= 14544.0)
Predict: 1.0
Else (feature 2 > 14544.0)
Predict: 0.0
Else (feature 1 > 12354.0)
Predict: 1.0
Is it possible to know how many no of rows are going to If condition and to the Else condition ?
like 40 rows are in If (feature 0 <= 2.0) and 60 rows are in Else (feature 0 > 2.0)
Upvotes: 0
Views: 131
Reputation: 40370
Unfortunately there is no magical method to compute that for now. You'll need to loop over your condition and filter then count.
example : df.filter([condition1]).count
Upvotes: 1