コード例 #1
0
matplotlib.pyplot.plot(space, scores1, '+-')
matplotlib.pyplot.xlabel('Learning Rate')
matplotlib.pyplot.ylabel('Cross Validation Error')
matplotlib.pyplot.title('Singular Value Decomposition')
matplotlib.pyplot.savefig('../plots/singular_value_decomposition1.png')
matplotlib.pyplot.gcf().clear()

space = (numpy.linspace(1, 600, 10)).astype(int)
model.set_learning_rate(best_learning_rate)
max_error = 100000.0
best_f = 1

for k in space:
	print("Epoch: %i", k)
	model.set_f(k)
	score = model.train(X, Y, X_val, Y_val)
	print("RMSE: ", score)
	if score < max_error:
		max_error = score
		best_f = k
	scores2.append(score)

matplotlib.pyplot.plot(space, scores2, 'k^:')
matplotlib.pyplot.xlabel('Number of Features')
matplotlib.pyplot.ylabel('Cross Validation Error')
matplotlib.pyplot.title('Singular Value Decomposition')
matplotlib.pyplot.savefig('../plots/singular_value_decomposition2.png')
matplotlib.pyplot.gcf().clear()

space = (numpy.linspace(0.01, 1, 10))