示例#1
0
def get_layout_from_task(task_id):
    """

    :param task_id:
    :return:
    layout: the layout for task visualization
    df : the df containing measures

    """

    measures = (evaluations.list_evaluation_measures())
    try:
        os.remove('cache/task'+str(task_id)+'.pkl')
    except OSError:
        pass
    layout = html.Div([
        html.Div(id='intermediate-value', style={'display': 'none'}),
        html.Div(children=[
            # Dropdown to choose metric
            html.Div(
                [dcc.Dropdown(
                    id='metric',
                    options=[
                        {'label': i, 'value': i} for i in measures
                    ],
                    multi=False,
                    clearable=False,
                    placeholder="Select an attribute",
                    value=measures[0]
                )],
                style={'width': '30%', 'display': 'inline-block',
                       'position': 'relative'},
            ),
            # Scatter plot flow vs metric

            dcc.Tabs(id="tabs", children=[
                dcc.Loading(fullscreen=True, children=[
                    dcc.Tab(label='Evaluations', children=[html.Div(id='tab1')])]),
                dcc.Tab(label='People', children=[html.Div(id='tab2')])
            ]),
            html.Div(html.Button('Fetch next 1000 runs', id='button')),


        ]),
    ], style={"fontFamily": font, 'width':'100%'})

    return layout, pd.DataFrame(measures)
示例#2
0
def get_layout_from_flow(flow_id):
    """

    :param flow_id:
    :return:
    """

    measures = (evaluations.list_evaluation_measures())

    task_types = [
        "Supervised classification", "Supervised regression", "Learning curve",
        "Supervised data stream classification", "Clustering",
        "Machine Learning Challenge", "Survival Analysis", "Subgroup Discovery"
    ]

    setup_list = setups.list_setups(flow=flow_id,
                                    size=1,
                                    output_format='dataframe')
    parameter_dict = setup_list['parameters'].values[0]
    parameters = [param['full_name'] for key, param in parameter_dict.items()]
    parameters.append('None')

    # Define components of flow layout
    dropdown_metric = html.Div(
        [
            dcc.Dropdown(id='metric',
                         options=[{
                             'label': i,
                             'value': i
                         } for i in measures],
                         multi=False,
                         clearable=False,
                         placeholder="Select an attribute",
                         value=measures[0])
        ],
        style={
            'width': '30%',
            'display': 'inline-block',
            'position': 'relative'
        },
    )
    dropdown_tasktype = html.Div(
        [
            dcc.Dropdown(id='tasktype',
                         options=[{
                             'label': i,
                             'value': i
                         } for i in task_types],
                         multi=False,
                         clearable=False,
                         placeholder="Select an attribute",
                         value=task_types[0])
        ],
        style={
            'width': '30%',
            'display': 'inline-block',
            'position': 'relative'
        },
    )
    dropdown_parameter = html.Div(
        [
            dcc.Dropdown(id='parameter',
                         options=[{
                             'label': i,
                             'value': i
                         } for i in parameters],
                         multi=False,
                         clearable=False,
                         placeholder="Select an attribute",
                         value=parameters[-1])
        ],
        style={
            'width': '30%',
            'display': 'inline-block',
            'position': 'relative'
        },
    )
    flow_graph = html.Div([
        dcc.Loading(
            dcc.Graph(id='flowplot',
                      style={
                          'height': '100%',
                          'width': '100%',
                          'position': 'absolute'
                      }))
    ])
    layout = html.Div([
        html.Div(id='intermediate-value', style={'display': 'none'}),
        html.Div(children=[
            dropdown_metric, dropdown_tasktype, dropdown_parameter, flow_graph
        ])
    ])

    return layout
示例#3
0
def get_layout_from_task(task_id):
    """

    :param task_id:
    :return:
    layout: the layout for task visualization

    """

    measures = (evaluations.list_evaluation_measures())
    try:
        os.remove('cache/task' + str(task_id) + '.pkl')
    except OSError:
        pass

    # Define components in task layout
    loading_spinner = dcc.Loading(html.Div(id='dummy'), type='dot')
    hidden_div = html.Div(id='intermediate-value', style={'display': 'none'})
    metric_dropdown = html.Div(
        [
            dcc.Dropdown(id='metric',
                         options=[{
                             'label': i,
                             'value': i
                         } for i in measures],
                         multi=False,
                         clearable=False,
                         placeholder="Select an attribute",
                         value=measures[0])
        ],
        style={
            'width': '30%',
            'display': 'inline-block',
            'position': 'relative'
        },
    )

    fetch_runs_button = html.Div(
        html.Button('Fetch next 100 runs',
                    id='button',
                    style={
                        'fontSize': 14,
                        'color': 'black',
                        'width': '20',
                        'height': '30',
                        'background-color': 'white'
                    }))
    graph_evals = html.Div(id='tab1')
    graph_people = html.Div(id='tab2')

    layout = html.Div([
        loading_spinner,
        hidden_div,
        html.Div(children=[
            metric_dropdown,
            html.H4('Evaluations:'),
            graph_evals,
            html.H4('People:'),
            graph_people,
            html.P(" "),
            html.P(" "),
            fetch_runs_button,
        ]),
    ],
                      style={'width': '100%'})

    return layout
示例#4
0
def get_layout_from_flow(flow_id):
    """

    :param flow_id:
    :return:
    """
    # Define components of flow layout
    # Metric dropdown
    measures = evaluations.list_evaluation_measures()
    dropdown_metric = html.Div(
        [
            dcc.Dropdown(
                id="metric",
                options=[{
                    "label": i,
                    "value": i
                } for i in measures],
                multi=False,
                clearable=False,
                placeholder="Select an attribute",
                value=measures[0],
            )
        ],
        className="three columns",
        style={
            "display": "inline-block",
            "position": "relative"
        },
    )
    # Task type dropdown
    task_types = [
        "Supervised classification",
        "Supervised regression",
        "Learning curve",
        "Supervised data stream classification",
        "Clustering",
        "Machine Learning Challenge",
        "Survival Analysis",
        "Subgroup Discovery",
    ]

    dropdown_tasktype = html.Div(
        [
            dcc.Dropdown(
                id="tasktype",
                options=[{
                    "label": i,
                    "value": i
                } for i in task_types],
                multi=False,
                clearable=False,
                placeholder="Select an attribute",
                value=task_types[0],
            )
        ],
        style={
            "display": "inline-block",
            "position": "relative"
        },
        className="three columns",
    )
    # parameters dropdown
    setup_list = setups.list_setups(flow=flow_id,
                                    size=1,
                                    output_format="dataframe")
    parameter_dict = setup_list["parameters"].values[0]
    parameters = [param["full_name"] for key, param in parameter_dict.items()]
    parameters.append("None")
    dropdown_parameter = html.Div(
        [
            dcc.Dropdown(
                id="parameter",
                options=[{
                    "label": i,
                    "value": i
                } for i in parameters],
                multi=False,
                clearable=False,
                placeholder="Select an attribute",
                value=parameters[-1],
            )
        ],
        style={
            "display": "inline-block",
            "position": "relative"
        },
        className="four columns",
    )
    # Flow evaluations plot
    flow_graph = html.Div(
        [
            dcc.Loading(
                dcc.Graph(id="flowplot",
                          style={
                              "height": "100%",
                              "position": "absolute"
                          }))
        ],
        className="twelve columns",
    )
    layout = html.Div(
        [
            html.Div(id="intermediate-value", style={"display": "none"}),
            html.Div(children=[
                dropdown_metric,
                dropdown_tasktype,
                dropdown_parameter,
                flow_graph,
            ]),
        ],
        className="container",
    )

    return layout
示例#5
0
def get_layout_from_task(task_id):
    """

    :param task_id:
    :return:
    layout: the layout for task visualization

    """

    try:
        os.remove("cache/task" + str(task_id) + ".pkl")
    except OSError:
        pass

    # Define components in task layout
    loading_spinner = dcc.Loading(html.Div(id="dummy"), type="dot")
    hidden_div = html.Div(id="intermediate-value", style={"display": "none"})
    # Metrics dropdown
    measures = evaluations.list_evaluation_measures()
    metric_dropdown = html.Div(
        [
            dcc.Dropdown(
                id="metric",
                options=[{
                    "label": i,
                    "value": i
                } for i in measures],
                multi=False,
                clearable=False,
                placeholder="Select an attribute",
                value=measures[0],
            )
        ],
        style={
            "width": "30%",
            "display": "inline-block",
            "position": "relative"
        },
    )
    # Fetch more runs button
    fetch_runs_button = html.Div(
        html.Button(
            "Fetch next 100 runs",
            id="button",
            style={
                "fontSize": 14,
                "color": "black",
                "width": "20",
                "height": "30",
                "background-color": "white",
            },
        ))
    # Graphs
    graph_evals = html.Div(id="tab1")
    graph_people = html.Div(id="tab2")

    layout = html.Div(
        [
            loading_spinner,
            hidden_div,
            html.Div(children=[
                metric_dropdown,
                html.P(" "),
                html.P(" "),
                html.H4("Evaluations:"),
                graph_evals,
                html.H4("People:"),
                graph_people,
                html.P(" "),
                html.P(" "),
                fetch_runs_button,
                # html.Div(id="tab3")
            ]),
        ],
        className="container",
        # style={'overflowY': 'hidden'}
    )

    return layout
示例#6
0
def get_layout_from_flow(flow_id):
    """

    :param flow_id:
    :return:
    """
    # Dropdown #1 Metrics
    measures = (evaluations.list_evaluation_measures())
    df = pd.DataFrame(measures)
    # Dropdown #2 task types
    task_types = ["Supervised classification", "Supervised regression", "Learning curve",
                  "Supervised data stream classification", "Clustering", "Machine Learning Challenge",
                  "Survival Analysis", "Subgroup Discovery"]
    # Dropdown #3 flow parameters
    P = setups.list_setups(flow=flow_id, size=1, output_format='dataframe')
    parameter_dict = P['parameters'].values[0]
    parameters = [param['full_name'] for key, param in parameter_dict.items()]
    parameters.append('None')
    layout = html.Div([
        html.Div(id='intermediate-value', style={'display': 'none'}),
        html.Div(children=[
            # 1 Dropdown to choose metric
            html.Div(
                [dcc.Dropdown(
                    id='metric',
                    options=[
                        {'label': i, 'value': i} for i in measures
                    ],
                    multi=False,
                    clearable=False,
                    placeholder="Select an attribute",
                    value=measures[0]
                )],
                style={'width': '30%', 'display': 'inline-block',
                       'position': 'relative'},
            ),
            # 2 Dropdown to choose task type
            html.Div(
                [dcc.Dropdown(
                    id='tasktype',
                    options=[
                        {'label': i, 'value': i} for i in task_types
                    ],
                    multi=False,
                    clearable=False,
                    placeholder="Select an attribute",
                    value=task_types[0]
                )],
                style={'width': '30%', 'display': 'inline-block',
                       'position': 'relative'},
            ),
            # 3 Dropdown to choose parameter
            html.Div(
                [dcc.Dropdown(
                    id='parameter',
                    options=[
                        {'label': i, 'value': i} for i in parameters
                    ],
                    multi=False,
                    clearable=False,
                    placeholder="Select an attribute",
                    value=parameters[-1]
                )],
                style={'width': '30%', 'display': 'inline-block',
                       'position': 'relative'},
            ),

            html.Div(
                [dcc.Loading(dcc.Graph(
                    id='flowplot',
                    style={'height': '100%', 'width': '100%',
                           'position': 'absolute'}))],
            ),

        ]),
    ],style={"fontFamily": font})

    return layout, df