I'm teaching a class on decision analysis in the fall and am looking for a python or R equivalent to Excel's Precision Tree.

What I want is for the students to be able to add the nodes of the tree, whether it is probability or decision node, label them etc. However, for all my searching, there doesn't appear to be a package/library that allows for them to import this as a csv or coded list.

Note, this is not a decision tree grown from a data set like the machine learning options that exist.

This is similar to question, but I'm wondering if there's a coding package or library rather than software package.

For example, if the students are creating a decision tree where someone is deciding whether to take an umbrella. The would provide a decision node and then probability nodes, and then the utilities of each outcome. This tree would have four branches. 1) take umbrella, rain 2) take umbrella, no rain 3) no umbrella etc.

Machine learning trees are unsuitable because they are learnt from a data set. This is not. It's the same effectively in terms of plotting, but here we have to define the tree ourselves.

  • I'm not completely clear on the distinction you're making between "coding package" and "software package". You mention wanting to be able to "import this as a csv or coded list". OK, so what's supposed to be in such a CSV, and what do you want to import this CSV into? What is it about the software packages mentioned in the other question, or the "machine learning options" in this one, that make them unsuitable for your purposes? What are you trying to teach? I'm not trying to shoot down your question, just trying to clarify it. – John Y Jul 21 '17 at 21:53
  • Thanks - coding package, I simply mean R or python and a library associated. I'm provide a simple example above – Tom Logan Jul 23 '17 at 15:23
  • R and Python are both quite capable languages, and very easy to use for how powerful they are. I guess I'm still not seeing what you need that is specific to decision trees, rather than just trees or graphs in general, for which there are many libraries out there (at least for Python; I don't use R personally). It seems to me you could just write whatever code is necessary which is beyond your students' capability to write themselves, but more specific than the built-ins or freely available libraries. So... are you looking for recommendations on general tree or graph libraries? – John Y Jul 27 '17 at 16:26
  • Also, the top answer for that other question you linked to has a Python API. Would that serve your purpose? – John Y Jul 27 '17 at 16:36
  • Yeah, I'm very familiar with both languages. But writing a function which draws a decision tree is not simple. Refer to the source code for rpart.plot as an example. The main difference which I am failing to describe well is that I would need to adapt the existing code to take an object that is self-created, rather than learned from data. I feel like there is a market gap, if Excel's Precision tree exists, there isn't a soley python/R alternative. The APIs are great from the solution, but I wondered if there was an alternative that was just coded or, like I said, csv'd. – Tom Logan Jul 27 '17 at 18:37

Your Answer

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

Browse other questions tagged or ask your own question.