Esempio n. 1
0
def update_train5_prediction(n_clicks, value):
    global model
    if value == '':
        return layout.get_empty_figure(height=100)

    if n_clicks > 0:
        local_sample = Sample(path='BP-data/data/' + value, model=model)
        local_prediction = Prediction(sample=local_sample)
        return local_prediction.get_figure(small=True)

    else:
        return layout.get_empty_figure(height=100)
Esempio n. 2
0
def update_train5_content(n_clicks, value1, value2):
    if value2 == '':
        return layout.get_empty_figure(height=650)

    if n_clicks > 0:
        if value1 == 'code':
            local_seesoft = SeeSoft(path='BP-data/data/' + value2,
                                    comments=True)
            local_seesoft.draw()
            return local_seesoft.get_figure(small=True)

        else:
            local_tree = Tree(path='BP-data/data/' + value2)
            return local_tree.get_figure()

    else:
        return layout.get_empty_figure(height=650)
Esempio n. 3
0
def update_network(children):
    global sample

    if children != '':
        local_network = Network(sample=sample)
        return local_network.get_figure()

    else:
        return layout.get_empty_figure(height=900)
Esempio n. 4
0
def update_input_prediction(children):
    global prediction
    global sample

    if children != '':
        prediction = Prediction(sample=sample)
        return prediction.get_figure()

    else:
        return layout.get_empty_figure(height=120)
Esempio n. 5
0
def update_input_tree(children):
    global tree
    global sample

    if children != '':
        tree = Tree(data=sample.data)
        return tree.get_figure(horizontal=True)

    else:
        return layout.get_empty_figure(height=250)
Esempio n. 6
0
def update_input_scatterplot(children):
    global scatterplot
    global sample

    if children != '':
        scatterplot = ScatterPlot(data=sample.data)
        return scatterplot.get_figure(show_legend=True, show_text=True)

    else:
        return layout.get_empty_figure(height=200)
Esempio n. 7
0
def update_clusters(children, value1, n_clicks2, n_clicks3, n_clicks4,
                    n_clicks5, n_clicks6, value2, value3, value4, value5,
                    value6):
    global click_counter
    global sample
    global clusters

    if children != '':
        # handle train1 sample highlight
        if n_clicks2 > 0:
            if value2 == '':
                clusters.train_samples[0] = None
            else:
                clusters.train_samples[0] = value2

        # handle train2 sample highlight
        if n_clicks3 > 0:
            if value3 == '':
                clusters.train_samples[1] = None
            else:
                clusters.train_samples[1] = value3

        # handle train3 sample highlight
        if n_clicks4 > 0:
            if value4 == '':
                clusters.train_samples[2] = None
            else:
                clusters.train_samples[2] = value4

        # handle train4 sample highlight
        if n_clicks5 > 0:
            if value5 == '':
                clusters.train_samples[3] = None
            else:
                clusters.train_samples[3] = value5

        # handle train5 sample highlight
        if n_clicks6 > 0:
            if value6 == '':
                clusters.train_samples[4] = None
            else:
                clusters.train_samples[4] = value6

        # click counter used so that the cluster diagram is only updated when
        # the new JSON file is chosen
        if int(children) == click_counter:
            return clusters.get_figure(algorithm=value1)

        click_counter = int(children)

        clusters.add_sample(sample)
        return clusters.get_figure(algorithm=value1)

    else:
        return layout.get_empty_figure(height=500)
Esempio n. 8
0
def update_sample_prediction(children):
    global prediction

    if children != '':
        while not prediction:
            time.sleep(0.5)

        return prediction.get_figure(small=True)

    else:
        return layout.get_empty_figure(height=100)
Esempio n. 9
0
def update_input_seesoft(children):
    global seesoft
    global sample

    if children != '':
        seesoft = SeeSoft(data=sample.data)
        seesoft.draw()
        return seesoft.get_figure()

    else:
        return layout.get_empty_figure(height=750)
Esempio n. 10
0
def update_sample_content(children, value):
    global seesoft
    global tree

    if children != '':
        if value == 'code':
            while not seesoft:
                time.sleep(0.5)
            return seesoft.get_figure(small=True)

        else:
            while not tree:
                time.sleep(0.5)
            return tree.get_figure()

    else:
        return layout.get_empty_figure(height=650)
Esempio n. 11
0
 # large div for source code visualization
 html.Div(
     children=[
         # colorful original lua source code
         html.Div(id='luacode-div',
                  children=[layout.get_empty_div(height=750)],
                  style={
                      'height': '800px',
                      'float': 'left',
                      'width': '520px',
                      'padding-left': '10px',
                      'padding-right': '10px',
                  }),
         # minimized colorful representation of source code
         dcc.Graph(id='seesoft-content',
                   figure=layout.get_empty_figure(height=750),
                   config={'displayModeBar': False},
                   style={
                       'max-height': '750px',
                       'float': 'left',
                       'width': '200px',
                       'padding': '10px',
                   }),
         # legend for both source code visualizations
         html.Img(src=layout.get_legend_image(),
                  style={
                      'position': 'absolute',
                      'top': '1000px',
                      'left': '180px'
                  }),
         # heading