Esempio n. 1
0
def plot_data_and_errors():
    inputs = [.30, .40, .50, .60, .70]
    predictions = list(map(lambda angle: 40*angle,inputs))
    predictions_trace = trace_values(inputs, predictions, 'lines', name = 'predictions')
    errors = [-4, -9, -11]
    error_traces = error_line_traces(observed_shot_angles, observed_distances, errors)
    return py.plot([data_trace, predictions_trace] + error_traces)
def updated_model_with_errors(parameter):
    layout = {
        'yaxis': {
            'range': [0, 450],
            'title': 'sales'
        },
        'xaxis': {
            'title': 'ad spend'
        }
    }
    inputs = list(range(1500, 4500, 250))

    predictions = list(
        map(lambda ad_spend: parameter * ad_spend, observed_ad_spends))
    data_trace = trace_values([2000, 3500, 4000], [260, 445, 490],
                              name='actual sales')
    predictions_trace = trace_values(observed_ad_spends,
                                     predictions,
                                     'lines',
                                     name='predictions')
    y_values_y_hats = list(zip(observed_sales, predictions))
    errors = list(map(lambda pair: pair[0] - pair[1], y_values_y_hats))
    error_traces = error_line_traces(observed_ad_spends, observed_sales,
                                     errors)
    return plot([data_trace, predictions_trace] + error_traces)
Esempio n. 3
0
def plot_data_and_errors():
    inputs = list(range(1500, 4500, 250))
    predictions = list(map(lambda input: .15*input,inputs))
    predictions_trace = trace_values(inputs, predictions, 'lines', name = 'predictions')
    errors = [-40, -80, -110]
    ad_spends = [2000, 3500, 4000]
    sales = [260, 445, 490]
    error_traces = error_line_traces(ad_spends, sales, errors)
    return plot([data_trace, predictions_trace] + error_traces)
Esempio n. 4
0
def updated_model_with_errors(parameter):
    layout = {'yaxis': {'range': [0, 18], 'title': 'shot distance'}, 'xaxis': {'title': 'shot angle'}}
    predictions = list(map(lambda angle: parameter*angle, observed_shot_angles))
    actual_trace = trace_values(observed_shot_angles, observed_distances, name = 'actual shots')
    predictions_trace = trace_values(observed_shot_angles, predictions, 'lines', name = 'predictions')
    y_values_y_hats = list(zip(observed_distances, predictions))
    errors = list(map(lambda pair: pair[0] - pair[1], y_values_y_hats))
    error_traces = error_line_traces(observed_shot_angles, observed_distances, errors)
    return py.plot([actual_trace, predictions_trace] + error_traces)