{
  "id": 22990,
  "title": " Decision tree visualization in python",
  "url": "/competitions/grupo-bimbo-inventory-demand/discussion/22990",
  "author_name": "",
  "post_date": "2016-08-20T04:55:39.490Z",
  "votes": null,
  "comment_count": 3,
  "views": 1321,
  "content": "<p>Hi friends,I was struggling for Decision tree visualization in python.Sometimes there is error due to pydot and sometimes due to graphviz....even though I have installed both in my windows machine but still no luck... please let me know if you know any easy method for this visualization in ipython notebook</p>",
  "messages": [
    {
      "id": "131847",
      "postDate": "08/20/2016 04:55:39",
      "content": "<p>Hi friends,I was struggling for Decision tree visualization in python.Sometimes there is error due to pydot and sometimes due to graphviz....even though I have installed both in my windows machine but still no luck... please let me know if you know any easy method for this visualization in ipython notebook</p>",
      "rawMarkdown": "Hi friends,I was struggling for Decision tree visualization in python.Sometimes there is error due to pydot and sometimes due to graphviz....even though I have installed both in my windows machine but still no luck... please let me know if you know any easy method for this visualization in ipython notebook",
      "votes": null
    },
    {
      "id": "131967",
      "postDate": "08/21/2016 01:55:33",
      "content": "<p>If you are using python 3.5 try installing pydotplus</p>\n\n<blockquote>\n  <p>pip install pydotplus</p>\n</blockquote>\n\n<p>Then import it as </p>\n\n<blockquote>\n  <p>import pydotplus as pydot</p>\n</blockquote>\n\n<p>Now your previous code must be compatible without changes</p>",
      "rawMarkdown": "If you are using python 3.5 try installing pydotplus\r\n\r\n> pip install pydotplus\r\n\r\nThen import it as \r\n\r\n> import pydotplus as pydot\r\n\r\nNow your previous code must be compatible without changes",
      "votes": null
    },
    {
      "id": "131976",
      "postDate": "08/21/2016 06:26:59",
      "content": "<p>@KRV..... Thanks :) \nThis code is working well for me now</p>\n\n<p>import pydotplus as pydot\nfrom IPython.display import Image\nfrom sklearn.externals.six import StringIO</p>\n\n<p>dot_data = StringIO()\ntree.export_graphviz(model, out_file=dot_data,feature_names=predictor)\ngraph = pydot.graph_from_dot_data(dot_data.getvalue())  </p>\n\n<p>Image(graph.create_png())</p>",
      "rawMarkdown": "KRV..... Thanks :) \r\nThis code is working well for me now\r\n\r\nimport pydotplus as pydot\r\nfrom IPython.display import Image\r\nfrom sklearn.externals.six import StringIO\r\n\r\ndot_data = StringIO()\r\ntree.export_graphviz(model, out_file=dot_data,feature_names=predictor)\r\ngraph = pydot.graph_from_dot_data(dot_data.getvalue())  \r\n\r\nImage(graph.create_png())",
      "votes": null
    },
    {
      "id": "382189",
      "postDate": "09/05/2018 20:52:34",
      "content": "<p>I can't seem to install pydotplus via !pip in a notebook. I've enabled internet access on the notebook as well.</p>",
      "rawMarkdown": "I can't seem to install pydotplus via !pip in a notebook. I've enabled internet access on the notebook as well.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 131967,
      "author_name": "krvperera",
      "author_url": "",
      "post_date": "08/21/2016 01:55:33",
      "content": "<p>If you are using python 3.5 try installing pydotplus</p>\n\n<blockquote>\n  <p>pip install pydotplus</p>\n</blockquote>\n\n<p>Then import it as </p>\n\n<blockquote>\n  <p>import pydotplus as pydot</p>\n</blockquote>\n\n<p>Now your previous code must be compatible without changes</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 131976,
      "author_name": "arpangupta87",
      "author_url": "",
      "post_date": "08/21/2016 06:26:59",
      "content": "<p>@KRV..... Thanks :) \nThis code is working well for me now</p>\n\n<p>import pydotplus as pydot\nfrom IPython.display import Image\nfrom sklearn.externals.six import StringIO</p>\n\n<p>dot_data = StringIO()\ntree.export_graphviz(model, out_file=dot_data,feature_names=predictor)\ngraph = pydot.graph_from_dot_data(dot_data.getvalue())  </p>\n\n<p>Image(graph.create_png())</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 382189,
      "author_name": "morenoh149",
      "author_url": "",
      "post_date": "09/05/2018 20:52:34",
      "content": "<p>I can't seem to install pydotplus via !pip in a notebook. I've enabled internet access on the notebook as well.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "131847": "Hi friends,I was struggling for Decision tree visualization in python.Sometimes there is error due to pydot and sometimes due to graphviz....even though I have installed both in my windows machine but still no luck... please let me know if you know any easy method for this visualization in ipython notebook",
    "131967": "If you are using python 3.5 try installing pydotplus\r\n\r\n> pip install pydotplus\r\n\r\nThen import it as \r\n\r\n> import pydotplus as pydot\r\n\r\nNow your previous code must be compatible without changes",
    "131976": "KRV..... Thanks :) \r\nThis code is working well for me now\r\n\r\nimport pydotplus as pydot\r\nfrom IPython.display import Image\r\nfrom sklearn.externals.six import StringIO\r\n\r\ndot_data = StringIO()\r\ntree.export_graphviz(model, out_file=dot_data,feature_names=predictor)\r\ngraph = pydot.graph_from_dot_data(dot_data.getvalue())  \r\n\r\nImage(graph.create_png())",
    "382189": "I can't seem to install pydotplus via !pip in a notebook. I've enabled internet access on the notebook as well."
  },
  "source": "meta"
}