2016-12-05 8 views

答えて

0

これは古い質問ですが、後で来る人にとっては、これらのスニペットは損失段階の関係を評価するために使用したものです。私は誰かがそれが役に立つと願っています。

# Collect errors to evaluate performance. 
errorlist = []; 

# Fit model by passing multiple times. 
numberOfIterations = 5; 
for i in range(numberOfIterations): 

    # Fit the model 
    regressor.fit(x=X,y=Y,steps=5000) 

    # Get the error 
    y = list(regressor.predict(X, as_iterable=True)) 
    error = mean_squared_error(Y,y) 
    errorlist = np.append(errorlist,error) 

    # Inform the user about remaining iterations 
    print("Remaining:",numberOfIterations-i) 

ここで収集したエラーをプロットするには、matplotlibを使用します。

# Plot errors 
plt.figure(1) 
plt.plot(errorlist,'g'); 
plt.title("Mean Squarred Error") 
plt.xlabel("Batch Iteration Number (x5000)") 
plt.ylabel("Error") 
関連する問題