testting codes
This commit is contained in:
@@ -237,7 +237,7 @@ plt.show()
|
||||
===== To think about =====
|
||||
|
||||
When you are comparing your own code with for example _Scikit-Learn_'s library, there are some minor things to keep in mind.
|
||||
The example here shows how one can leave out or keep the intercept.
|
||||
The example here shows how one can keep the intercept in order to compare own code.
|
||||
|
||||
!bc pycod
|
||||
import numpy as np
|
||||
@@ -316,10 +316,10 @@ for i in range(nlambdas):
|
||||
print(RegRidge.coef_)
|
||||
# Now plot the results
|
||||
plt.figure()
|
||||
plt.plot(np.log10(lambdas), MSEOwnRidgeTrain, label = 'MSE Ridge train')
|
||||
plt.plot(np.log10(lambdas), MSEOwnRidgePredict, 'r--', label = 'MSE Ridge Test')
|
||||
plt.plot(np.log10(lambdas), MSERidgeTrain, label = 'MSE Ridge train')
|
||||
plt.plot(np.log10(lambdas), MSERidgePredict, 'r--', label = 'MSE Ridge Test')
|
||||
plt.plot(np.log10(lambdas), MSEOwnRidgeTrain, 'b', label = 'MSE Ridge train')
|
||||
plt.plot(np.log10(lambdas), MSEOwnRidgePredict, 'r', label = 'MSE Ridge Test')
|
||||
plt.plot(np.log10(lambdas), MSERidgeTrain, 'y', label = 'MSE Ridge train')
|
||||
plt.plot(np.log10(lambdas), MSERidgePredict, 'g', label = 'MSE Ridge Test')
|
||||
|
||||
plt.xlabel('log10(lambda)')
|
||||
plt.ylabel('MSE')
|
||||
|
||||
Reference in New Issue
Block a user