0

I am looking to utilize a Random Forest Regressor in Go using the golearn repository (https://github.com/sjwhitworth/golearn). As far as I know, golearn only supports random forest classifiers, which make predictions with a class and probability (https://github.com/sjwhitworth/golearn/blob/master/trees/id3.go#L413).

Is there an easy way to utilize the predicted probability from a classifier and use it to form a scalar prediction (equivalent to that from a regressor)?

Thanks in advance!

desertnaut
  • 57,590
  • 26
  • 140
  • 166
wass
  • 131
  • 1
  • 1
  • It is most certainly not: these are different algorithms with different loss functions. The last part of [this answer](https://stackoverflow.com/questions/38015181/accuracy-score-valueerror-cant-handle-mix-of-binary-and-continuous-target/54458777#54458777) may be useful for clarifying. – desertnaut Mar 26 '20 at 00:19

1 Answers1

1

Generally it is not possible to turn the scores from the tree leafs into Regression outputs. They are just not the same.

The Decision Trees in your linked package seems to build the trees using the ID3-Algorithm as written within the Source https://github.com/sjwhitworth/golearn/blob/master/trees/trees.go (Refer: https://en.wikipedia.org/wiki/ID3_algorithm)

ID3 will build the tree structure by optimizing Information Gain (Minimizing Entropy). You will have to use a CART-Algorithm to achieve a regression task (which optimizes for variance reduction).

Ric Hard
  • 599
  • 4
  • 12
  • I feared this was the case. Guess I might have to use an implementation in Python and use bindings to port the model back to Go. Very helpful response, thanks! – wass Mar 30 '20 at 17:15
  • Or you extend the package by a regression model. That is fairly easy. You would basically only have to change the criterion that is evaluated when splitting the nodes. If the package is written tidy that should be a farily easy plug in. – Ric Hard Mar 31 '20 at 11:12