Пример #1
0
def update_prediction_convergence(static, inputs, models):

    if (inputs is not None) and (models is not None):
        # Filter inputs
        file = models
        inputs = sorted(inputs)

        # Make filename
        for parameter in inputs:
            temp = parameter.strip(" ")
            file += "_" + temp

        # Initialise model
        model = Predictor(dataset, inputs=inputs, model=models, filename=file)

        # Run
        results = model.check()

        return {
            'data': [{
                'x': results[-1],
                'y': results[1],
                'line': dict(color='black')
            }]
        }
Пример #2
0
    def convergence_block():
        model = Predictor(dataset,
                          inputs=['Max Temp', 'Min Temp', 'Rain'],
                          model='svr',
                          filename='svr_Max Temp_Min Temp_Rain')
        results = model.check()

        layout = html.Div(
            [
                # Left Plot
                html.Div(dcc.Graph(
                    id='fit_convergence_plot',
                    config={'displayModeBar': False},
                    animate=True,
                    figure={
                        'data': [{
                            'x': results[-1],
                            'y': results[0],
                            'line': dict(color='grey')
                        }],
                        'layout':
                        go.Layout(
                            title="Loss Scores: Fitting",
                            xaxis={'title': "Number of Data Points"},
                            yaxis={'range': [0, 0.3]},
                            margin={
                                'l': 50,
                                'b': 50,
                                't': 100,
                                'r': 50
                            },
                        )
                    },
                ),
                         style={
                             'width': '50%',
                             'display': 'inline-block'
                         }),

                # Right Plot
                html.Div(dcc.Graph(
                    id='pred_convergence_plot',
                    config={'displayModeBar': False},
                    animate=True,
                    figure={
                        'data': [{
                            'x': results[-1],
                            'y': results[1],
                            'line': dict(color='black')
                        }],
                        'layout':
                        go.Layout(
                            title="Loss Scores: Prediction",
                            xaxis={'title': "Number of Data Points"},
                            yaxis={'range': [0, 0.3]},
                            margin={
                                'l': 50,
                                'b': 50,
                                't': 100,
                                'r': 50
                            },
                        )
                    },
                ),
                         style={
                             'width': '50%',
                             'display': 'inline-block'
                         }),
            ],
            className='container',
            style={'margin-top': '10px'},
        )

        return layout