AttributeError:'str'对象没有属性'pop'-沃尔玛销售预测

时间:2019-05-17 12:35:14

标签: python jupyter-notebook

def print_evaluation_metrics(trained_model,trained_model_name,X_test,y_test):
        print ('--------- For Model : ', trained_model_name ,' ---------\n')
        predicted_values = trained_model.predict(X_test)
        #print ("Predicted Values : ", predicted_values)
        print ("Mean Absolute Error : ", metrics.mean_absolute_error(y_test,predicted_values))
        print ("Mean Squared Error : ", metrics.mean_squared_error(y_test,predicted_values))
        print ("R2 Score : ", metrics.r2_score(y_test,predicted_values))
        print ("---------------------------------------\n")
        actual_values = y_test[30000:30050]
        plt.plot(predicted_values[30000:30050], color='green', label='Predicted Values')
        plt.plot(actual_values, color='red', label='Actual Values')
        plt.xlabel('Week Number')
        plt.ylabel('Weekly Sales')
        plt.legend(loc='upper right')
        plt.title('Comparison of Predicted and Actual Weekly Sales for ', trained_model_name)
        plt.show()

0 个答案:

没有答案