本文整理匯總了Python中mlp.MLP.validation_set方法的典型用法代碼示例。如果您正苦於以下問題:Python MLP.validation_set方法的具體用法?Python MLP.validation_set怎麽用?Python MLP.validation_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mlp.MLP
的用法示例。
在下文中一共展示了MLP.validation_set方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run_mlp
# 需要導入模塊: from mlp import MLP [as 別名]
# 或者: from mlp.MLP import validation_set [as 別名]
def run_mlp(dataset_path, neurons):
dataset_input = np.loadtxt(dataset_path)
dataset_output = dataset_input[:, - 1]
input = dataset_input[:,:-1]
print(input)
print(dataset_output)
scv = SCV(dataset_input, 5)
training, training_out, validation, validation_out = scv.select_fold_combination()
print("training ", training)
print("training out ",training_out)
print("validation ",validation)
print("validation_out ", validation_out)
hide = np.array([int(neurons)])
print(training.shape[1])
print(hide[0])
ann = MLP(training.shape[1],training.shape[1], hide)
ann.set_learningRate(0.95)
ann.set_learningDescent(0.5)
ann.set_momentum(0.02)
ann.set_erro(0.005)
ann.validation_set(validation, validation)
ann.train_mlp(training, training)
print("Validation Error: ", ann.get_validationError())
print("Training Error: ", ann.get_trainingError())
title = str(neurons) + " Neurons"
#ann.plot_learning_curve(title)
ann.plot_neurons(title)