from sklearn.metrics import mean_absolute_error,mean_squared_error #模型选择回归问题性能度量mean_absolute_error模型 def test_mean_absolute_error(): y_true=[1,1,1,1,1,2,2,2,0,0] y_pred=[0,0,0,1,1,1,0,0,0,0] print("Mean Absolute Error:",mean_absolute_error(y_true,y_pred)) #调用test_mean_absolute_error() test_mean_absolute_error()
#模型选择回归问题性能度量mean_squared_error模型 def test_mean_squared_error(): y_true=[1,1,1,1,1,2,2,2,0,0] y_pred=[0,0,0,1,1,1,0,0,0,0] print("Mean Absolute Error:",mean_absolute_error(y_true,y_pred)) print("Mean Square Error:",mean_squared_error(y_true,y_pred)) #调用test_mean_squared_error() test_mean_squared_error()