本文整理汇总了Python中nolearn.dbn.DBN.random_state方法的典型用法代码示例。如果您正苦于以下问题:Python DBN.random_state方法的具体用法?Python DBN.random_state怎么用?Python DBN.random_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nolearn.dbn.DBN
的用法示例。
在下文中一共展示了DBN.random_state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from nolearn.dbn import DBN [as 别名]
# 或者: from nolearn.dbn.DBN import random_state [as 别名]
max_epochs=10,
verbose=1)
classifiers.append(('nolearn.lasagne', clf))
RUNS = 1
for name, orig in classifiers:
times = []
accuracies = []
for i in range(RUNS):
start = time.time()
clf = clone(orig)
clf.random_state = int(time.time())
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
accuracies.append(clf.score(X_test, y_test))
times.append(time.time() - start)
a_t = np.array(times)
a_s = np.array(accuracies)
print("\n"+name)
print("\tAccuracy: %5.2f%% ±%4.2f" % (100.0 * a_s.mean(), 100.0 * a_s.std()))
print("\tTimes: %5.2fs ±%4.2f" % (a_t.mean(), a_t.std()))
print("\tReport:")
print(classification_report(y_test, y_pred))