Exemplo n.º 1
0
def uniform_value_parameter_sweep(actual,title=None):
    errors = []
    fixed_views_value = np.arange(0.0,10.0,0.1)
    for i in fixed_views_value:
        predicted_num_views = uniform_array(i,num_points)
        error = cost_function.error_function(predicted_num_views,actual)
        errors.append(error)

    plt.plot(fixed_views_value,errors)
    plt.title = title
    plt.show()
Exemplo n.º 2
0
        error = cost_function.error_function(predicted_num_views,actual)
        errors.append(error)

    plt.plot(fixed_views_value,errors)
    plt.title = title
    plt.show()

#uniform_value_parameter_sweep(d.num_views, title = 'param sweep for num_views')
#uniform_value_parameter_sweep(d.num_comments, title = 'param sweep for num_comments')
#uniform_value_parameter_sweep(d.num_votes, title = 'param sweep for num_votes')

mean_num_views = uniform_array(1.8,num_points)
mean_num_votes =  uniform_array(1.3,num_points) 
mean_num_comments = uniform_array(0.0,num_points)

mean_num_views_error = cost_function.error_function(mean_num_views,d.num_views)
mean_num_votes_error = cost_function.error_function(mean_num_votes,d.num_votes)
mean_num_comments_error = cost_function.error_function(mean_num_comments,d.num_comments)

zeros = np.zeros(num_points)
zeros_num_views_error = cost_function.error_function(zeros,d.num_views)

zeros_num_comments_error = cost_function.error_function(zeros,d.num_comments)

zeros_num_votes_error = cost_function.error_function(zeros,d.num_votes)

print("Mean num views error:")
print mean_num_views_error
print("Mean num votes error:")
print mean_num_votes_error
print("Mean num comments error:")