本文整理汇总了Python中neuralnet.NeuralNet.load方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.load方法的具体用法?Python NeuralNet.load怎么用?Python NeuralNet.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuralnet.NeuralNet
的用法示例。
在下文中一共展示了NeuralNet.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from neuralnet import NeuralNet [as 别名]
# 或者: from neuralnet.NeuralNet import load [as 别名]
#!/usr/bin/python
from __future__ import division
from time import time
from neuralnet import NeuralNet
import numpy as np
from scipy.special import expit
"""Script to test out loading a neural network from a json file"""
nn = NeuralNet.load("weights2.json")
nn.default_act = np.vectorize(lambda x: (1 - np.exp(-2*x)) / (1 + np.exp(-2*x)))
print "Beginning with scoring..."
start = time()
scored_text = open("testing.csv").read().split("\n")
testing = list(map(int, sample.strip().split(',')) for sample in scored_text
if sample.strip() != "")
predictions = nn.score_data(testing)
print "Done with scoring. Took {0} seconds to score the dataset" \
.format(round(time() - start, 2))
with open("results.txt", "w") as f:
f.write("IsBadBuy\n")
for pred in predictions:
if pred[0, 0] < 0:
f.write(str(0) + "\n")
else: f.write(str(pred[0, 0]) + "\n")