0

I'm trying to figure out this calculation by hand. But I do not understand all the steps to how regression trees are split.

My target is drug effectiveness and my feature is dosage. The tree it produces is below. How can I calculate mse by hand to get the same outcome as sklearn?

data = {"doseage": [10,20,35,5,15], "drug_effective": [98,0,6,44,88]}
df = pd.DataFrame(data=data)

target = df["drug_effective"]
features = df.drop(columns=['drug_effective', "age"])

tree = DecisionTreeRegressor()
tree.fit(features,target)

plot_tree(tree)

enter image description here

rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
  • This will give you idea about how algorithm splits. [reference](https://www.saedsayad.com/decision_tree_reg.htm) – RakeshV Jul 30 '20 at 14:41
  • @RakeshV thanks, I've seen that reference, but it doesn't use mse and I'm only working with a binary split, not 3 way split. – Avery Quinn Jul 30 '20 at 19:31
  • I have done MSE calculations based on split rules mentioned in image above. You can see excel file [here](https://drive.google.com/file/d/1_q4P8kEIGdlBTK3FEdSv54t55z4R-GDN/view?usp=sharing) – RakeshV Aug 03 '20 at 15:05

0 Answers0