Commit a5ac8ad2 authored by bogdan's avatar bogdan

Tree Visualization widget

parent f0462cb1
This diff is collapsed.
......@@ -494,9 +494,9 @@ def svmeasy(input_dict):
return output_dict
def class_tree(input_dict):
import orange
import Orange
output_dict = {}
output_dict['treeout']= orange.TreeLearner(name = "Classification Tree (Orange)")
output_dict['treeout']= Orange.classification.tree.TreeLearner(name = "Classification Tree (Orange)")
return output_dict
def c45_tree(input_dict):
......@@ -840,3 +840,6 @@ def alter_table_finished(postdata, input_dict, output_dict):
except: # Catch orange exception and give a proper error message.
raise Exception("Illegal value '%s' for discrete attribute '%s', legal values are: %s." % (new_value, att, new_table.domain[att].values))
return {'altered_data' : new_table}
def tree_visualization(input_dict):
\ No newline at end of file
......@@ -267,7 +267,7 @@ class AbstractWidget(models.Model):
i.uid = uuid.uuid4()
if commit:
for option in i:
for option in i.options.all():
option.uid = uuid.uuid4()
if commit:
<div id="widgetvisualization-{{}}" rel="{{}}" width="900" height="600" class="widgetvisualizationdialog" title="{{}}">
{{ svg|safe }}
\ No newline at end of file
......@@ -191,3 +191,30 @@ def sdmsegs_viewer(request,input_dict,output_dict,widget):
output_dict = {'json_output':output}
return render(request, 'visualizations/sdmsegs_viewer.html',{'widget':widget,'input_dict':input_dict,'output_dict':output_dict})
def tree_visualization(request, input_dict, output_dict, widget):
import Orange
import pydot
import tempfile
f = tempfile.NamedTemporaryFile(delete=False,suffix='.dot')
tree = input_dict['clt'], leaf_shape="oval", node_shape="box")
dot_file = open(,"r")
dot_data =
tree_visualization_graph = pydot.graph_from_dot_data(dot_data)
tree_visualization = tree_visualization_graph.create_svg()
return render(request, 'visualizations/tree_visualization.html', {'widget':widget, 'input_dict':input_dict, 'svg':tree_visualization})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment