9
$\begingroup$

I am trying to implement decision tree classifier to classify my data set. I am using Python. Now it is easy to implement in scikit learn, but how can I implement this in tensorflow.

$\endgroup$
  • $\begingroup$ Even if Decision Trees were offered for TensorFlow(which they don't), I wouldn't suggest using it. There is so much technical overhead with getting a tensorflow model going compared to sklearn... Pick the right tool for the job! <scikit-learn.org/stable/modules/tree.html> $\endgroup$ – Michael Higgins Mar 12 at 19:41
9
$\begingroup$

Basically I guess TensorFlow does not support decision trees. I quote from here,

This is a big oversimplification, but there are essentially two types of machine learning libraries available today, Deep learning (CNN,RNN, fully connected nets, linear models) and Everything else (SVM, GBMs, Random Forests, Naive Bayes, K-NN, etc). The reason for this is that deep learning is much more computationally intensive than other more traditional training methods, and therefore requires intense specialization of the library (e.g., using a GPU and distributed capabilities). If you're using Python and are looking for a package with the greatest breadth of algorithms, try scikit-learn. In reality, if you want to use deep learning and more traditional methods you'll need to use more than one library. There is no "complete" package.

You can see from here that there are other learning algorithms implemented in TensorFlow which are not deep models.

You can take a look at here for tracking algorithms implemented in TensorFlow.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I'm torn on this: I'm aboard with the reasoning of your quote, but on the other hand: Random Forrest is a kind of tree learner. $\endgroup$ – S van Balen Feb 20 '18 at 13:19
  • $\begingroup$ @SvanBalen I don't understand what you mean. $\endgroup$ – Media Feb 20 '18 at 13:57
  • $\begingroup$ Tensorflow supports random forrest (as documented by the link you gave), random forrest is a special kind of tree learner. So even though Tensorflow doenst seem to support common learners (CART or C45) and even though it is primarily a library for deep learning, and even though I too would use sklearn, it technically supports a tree learner, making your statement false. $\endgroup$ – S van Balen Feb 20 '18 at 14:06
  • 1
    $\begingroup$ @SvanBalen I thank you if I really have made a mistake for announcing me but I don't know where I'm wrong. I've said TensorFlow does not support decision trees, which is really the case. Which part I'm wrong? $\endgroup$ – Media Feb 20 '18 at 14:10
  • $\begingroup$ TF supports random forest, random forest is a decision tree (a specific type at that), hence TF supports decision trees. But like I said: I'm torn at whether your statement is wrong: Technically it is, but for all practical purposes it is not. $\endgroup$ – S van Balen Feb 20 '18 at 14:26
3
$\begingroup$

Similar to what I wrote on the other post, TensorFlow does in fact have implementations of Random Forest and Gradient Boosting, in addition to other non-deep learning algorithms. The links can be found at that post.

| improve this answer | |
$\endgroup$
1
$\begingroup$

The main difference is that tensorflow is based on numerical methods (i.e., gradient descents). There is no gradient in tree-based methods. The exception is gradient regression tree.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.