本文整理汇总了Python中pybrain.utilities.percentError函数的典型用法代码示例。如果您正苦于以下问题:Python percentError函数的具体用法?Python percentError怎么用?Python percentError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了percentError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: train
def train(self):
print "Enter the number of times to train, -1 means train until convergence:"
t = int(raw_input())
print "Training the Neural Net"
print "self.net.indim = "+str(self.net.indim)
print "self.train_data.indim = "+str(self.train_data.indim)
trainer = BackpropTrainer(self.net, dataset=self.train_data, momentum=0.1, verbose=True, weightdecay=0.01)
if t == -1:
trainer.trainUntilConvergence()
else:
for i in range(t):
trainer.trainEpochs(1)
trnresult = percentError( trainer.testOnClassData(), self.train_data['class'])
# print self.test_data
tstresult = percentError( trainer.testOnClassData(dataset=self.test_data), self.test_data['class'] )
print "epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
if i % 10 == 0 and i > 1:
print "Saving Progress... Writing to a file"
NetworkWriter.writeToFile(self.net, self.path)
print "Done training... Writing to a file"
NetworkWriter.writeToFile(self.net, self.path)
return trainer
开发者ID:davidlavy88,项目名称:FaceIdentifier,代码行数:30,代码来源:identify.py
示例2: main
def main():
trndata, tstdata = createDS()
for repeat in xrange(repeats):
iter_trn_results = []
iter_tst_results = []
nn = createNNLong(trndata)
hiddenAstrocyteLayer, outputAstrocyteLayer = associateAstrocyteLayers(nn)
trainer = BackpropTrainer(nn, dataset=trndata, learningrate=0.01,
momentum=0.1, verbose=False, weightdecay=0.0)
for grand_iter in xrange(iterations):
trainer.trainEpochs(1)
trnresult = percentError(trainer.testOnClassData(), trndata['class'])
iter_trn_results.append(trnresult)
tstresult = percentError(trainer.testOnClassData(dataset=tstdata), tstdata['class'])
iter_tst_results.append(tstresult)
if not grand_iter%20:
print 'epoch %4d' %trainer.totalepochs, 'train error %5.2f%%' %trnresult, \
'test error %5.2f%%' %tstresult
inputs = list(trndata['input'])
random.shuffle(inputs)
for inpt in trndata['input']:
nn.activate(inpt)
for minor_iter in range(hiddenAstrocyteLayer.astrocyte_processing_iters):
hiddenAstrocyteLayer.update()
outputAstrocyteLayer.update()
hiddenAstrocyteLayer.reset()
outputAstrocyteLayer.reset()
all_trn_results.append(iter_trn_results)
all_tst_results.append(iter_tst_results)
plotResults(all_trn_results)
plotResults(all_tst_results)
plt.show()
开发者ID:mfbx9da4,项目名称:neuron-astrocyte-networks,代码行数:34,代码来源:play_angn.py
示例3: train
def train(self):
#self.init_iri()
self.init_image()
self.ds = ClassificationDataSet(self.IN, 1, nb_classes=128)
#classifier.init_image()
self.load_data()
print "Number of trianing patterns: ", len(self.trndata)
print "Input and output dimensions: ", self.trndata.indim, self.trndata.outdim
print "First sample (input, target, class):"
print self.trndata['input'][0], self.trndata['target'][0], self.trndata['class'][0]
print self.trndata.indim, self.trndata.outdim
self.net = buildNetwork(self.trndata.indim, 7, self.trndata.outdim)
trainer = BackpropTrainer(self.net, dataset=self.trndata, momentum=0.1, verbose=True, weightdecay=0.01)
"""
for i in range(200):
trainer.trainEpochs(1)
trnresult = percentError(trainer.testOnClassData(), self.trndata['class'])
tstresult = percentError(trainer.testOnClassData(dataset = self.tstdata), self.tstdata["class"])
print "epch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
"""
trainer.trainUntilConvergence()
trnresult = percentError(trainer.testOnClassData(), self.trndata['class'])
tstresult = percentError(trainer.testOnClassData(dataset = self.tstdata), self.tstdata["class"])
print "epch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
开发者ID:kymo,项目名称:ImageRecognition,代码行数:32,代码来源:match.py
示例4: testBPHasLearned
def testBPHasLearned(self):
trnresult = percentError(self.trainer.testOnClassData(),
self.trn_d['class'])
tstresult = percentError(self.trainer.testOnClassData(dataset=self.tst_d),
self.tst_d['class'])
print 'trn perc error', trnresult
print 'tst perc error', tstresult
开发者ID:mfbx9da4,项目名称:neuron-astrocyte-networks,代码行数:7,代码来源:testmain.py
示例5: calculateANNaccuracy
def calculateANNaccuracy(model, trndata, tstdata, trainer,iterations=20,maxEpochs=10):
trn_sum=0
tst_sum=0
trnfinal=[]
tstfinal=[]
for i in range(iterations):
trainer.trainUntilConvergence(maxEpochs=maxEpochs, continueEpochs=1)
trnresult = percentError( trainer.testOnClassData(),
trndata['class'] )
tstresult = percentError( trainer.testOnClassData(
dataset=tstdata ), tstdata['class'] )
trnres=100-trnresult
tstres=100-tstresult
trn_sum=trn_sum+trnres
tst_sum=tst_sum+tstres
trnfinal.append(trnres)
tstfinal.append(tstres)
trn_avg=trn_sum/(i+1)
tst_avg=tst_sum/(i+1)
print "Train average accuracy: %5.2f%%" % trn_avg
print "Test average accuracy: %5.2f%%" % tst_avg
print "Train SD = ", np.std(trnfinal)
print "Test SD = ", np.std(tstfinal)
print "\n"
return tst_avg
开发者ID:aplassard,项目名称:Image_Processing,代码行数:30,代码来源:__init__.py
示例6: trainNetwork
def trainNetwork(self,proportion = 0):
if proportion != 0:
tstdata, trndata = self.alldata.splitWithProportion( 0.01*proportion )
else:
trndata = self.alldata
trndata._convertToOneOfMany( )
if proportion != 0:
tstdata._convertToOneOfMany( )
print "Number of training patterns: ", len(trndata)
print "Input and output dimensions: ", trndata.indim, trndata.outdim
self.fnn = buildNetwork( trndata.indim, self.hidden_layer_size, trndata.outdim,
hiddenclass=SigmoidLayer,outclass=SoftmaxLayer )
self.trainer = BackpropTrainer( self.fnn, dataset=trndata, momentum=0.1, verbose=True, weightdecay=0.01)
for i in range(self.iterations_number):
self.trainer.trainEpochs( 1 )
trnresult = percentError( self.trainer.testOnClassData(),
trndata['class'] )
if proportion != 0:
tstresult = percentError( self.trainer.testOnClassData(
dataset=tstdata ), tstdata['class'] )
if proportion != 0:
print "epoch: %4d" % self.trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
else:
print "epoch: %4d" % self.trainer.totalepochs, \
" train error: %5.2f%%" % trnresult
开发者ID:mcopik,项目名称:PyGestures,代码行数:28,代码来源:neural_network.py
示例7: main
def main():
images, labels = load_labeled_training(flatten=True)
images = standardize(images)
# images, labels = load_pca_proj(K=100)
shuffle_in_unison(images, labels)
ds = ClassificationDataSet(images.shape[1], 1, nb_classes=7)
for i, l in zip(images, labels):
ds.addSample(i, [l - 1])
# ds._convertToOneOfMany()
test, train = ds.splitWithProportion(0.2)
test._convertToOneOfMany()
train._convertToOneOfMany()
net = shortcuts.buildNetwork(train.indim, 1000, train.outdim, outclass=SoftmaxLayer)
trainer = BackpropTrainer(net, dataset=train, momentum=0.1, learningrate=0.01, weightdecay=0.05)
# trainer = RPropMinusTrainer(net, dataset=train)
# cv = validation.CrossValidator(trainer, ds)
# print cv.validate()
net.randomize()
tr_labels_2 = net.activateOnDataset(train).argmax(axis=1)
trnres = percentError(tr_labels_2, train["class"])
# trnres = percentError(trainer.testOnClassData(dataset=train), train['class'])
testres = percentError(trainer.testOnClassData(dataset=test), test["class"])
print "Training error: %.10f, Test error: %.10f" % (trnres, testres)
print "Iters: %d" % trainer.totalepochs
for i in range(100):
trainer.trainEpochs(10)
trnres = percentError(trainer.testOnClassData(dataset=train), train["class"])
testres = percentError(trainer.testOnClassData(dataset=test), test["class"])
trnmse = trainer.testOnData(dataset=train)
testmse = trainer.testOnData(dataset=test)
print "Iteration: %d, Training error: %.5f, Test error: %.5f" % (trainer.totalepochs, trnres, testres)
print "Training MSE: %.5f, Test MSE: %.5f" % (trnmse, testmse)
开发者ID:deepxkn,项目名称:facial-expression-recognition-1,代码行数:34,代码来源:rbm_nn.py
示例8: train
def train(args):
inputs, ys, gc = args
row_length = len(inputs[0])
d = ds.ClassificationDataSet(
row_length, nb_classes=2, class_labels=['Poisonous',
'Edible'])
d.setField('input', inputs)
d.setField('target', ys)
test, train = d.splitWithProportion(.25)
test._convertToOneOfMany()
train._convertToOneOfMany()
hidden = row_length // 2
print "indim:", train.indim
net = buildNetwork(train.indim,
hidden,
train.outdim,
outclass=SoftmaxLayer)
trainer = BackpropTrainer(net,
dataset=train,
momentum=0.0,
learningrate=0.1,
verbose=True,
weightdecay=0.0)
for i in xrange(20):
trainer.trainEpochs(1)
trnresult = percentError(trainer.testOnClassData(),
train['class'])
tstresult = percentError(
trainer.testOnClassData(dataset=test),
test['class'])
print "epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
return net, gc
开发者ID:DanielleSucher,项目名称:mushrooms,代码行数:35,代码来源:mushrooms.py
示例9: calculateANNaccuracy
def calculateANNaccuracy(model, trndata, tstdata, trainer):
trn_sum=0
tst_sum=0
trnfinal=[]
tstfinal=[]
for i in range(20):
trainer.trainUntilConvergence(maxEpochs=10, continueEpochs=3, validationProportion=0.30)
trnresult = percentError( trainer.testOnClassData(),
trndata['class'] )
tstresult = percentError( trainer.testOnClassData(
dataset=tstdata ), tstdata['class'] )
trnres=100-trnresult
tstres=100-tstresult
trn_sum=trn_sum+trnres
tst_sum=tst_sum+tstres
trnfinal.append(trnres)
tstfinal.append(tstres)
trn_avg=trn_sum/(i+1)
tst_avg=tst_sum/(i+1)
'''
print "Test average accuracy: %5.2f%%" % tst_avg
print "Test SD = ", np.std(tstfinal)
'''
return tst_avg
开发者ID:aplassard,项目名称:Image_Processing,代码行数:26,代码来源:ann.py
示例10: drawPic
def drawPic():
try:
sampleCount = int(inputEntry.get())
except:
sampleCount = 50
print 'Enter an integer.'
inputEntry.delete(0, END)
inputEntry.insert(0, '50')
# Need column vectors in dataset, not arrays
for i in range(sampleCount):
trainer.trainEpochs(1)
trnresult = percentError(trainer.testOnClassData(), trndata['class'])
tstresult = percentError(trainer.testOnClassData(dataset=tstdata), tstdata['class'])
if i % 20 == 0:
t.delete(1.0, END)
t.insert(END, "epoch:" + str(trainer.totalepochs) + " train error:" + str(round(trnresult, 2)) \
+ "% test error:" + str(round(tstresult, 2)) + "%\n")
# Clear the Figure
drawPic.f.clf()
drawPic.a = drawPic.f.add_subplot(111, projection='3d')
drawPic.a.set_title('Training...')
for a, c, m in [(0, 'r', 'o'), (1, 'b', '^'), (2, 'y', 's')]:
out = fnn.activateOnDataset(alldata)
out = out.argmax(axis=1)
here = (out == a)
drawPic.a.scatter(alldata['input'][here, 0], alldata['input'][here, 1], alldata['input'][here, 2], c=c, marker=m)
drawPic.canvas.show()
开发者ID:tangji08,项目名称:Forex,代码行数:27,代码来源:test2.py
示例11: measuredLearning
def measuredLearning(ds):
trndata,tstdata = splitData(ds,.025)
#build network
###
# This network has no hidden layters, you might need to add some
###
fnn = buildNetwork( trndata.indim, 22, trndata.outdim, outclass=SoftmaxLayer )
trainer = BackpropTrainer( fnn, verbose=True,dataset=trndata)
####
# Alter this to figure out how many runs you want. Best to start small and be sure that you see learning.
# Before you ramp it up.
###
for i in range(150):
trainer.trainEpochs(5)
trnresult = percentError(trainer.testOnClassData(),trndata['class'] )
tstresult = percentError( trainer.testOnClassData(
dataset=tstdata ), tstdata['class'] )
print "epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
if(trnresult<.5):
return
开发者ID:DanSGraham,项目名称:School-Projects,代码行数:32,代码来源:learner.py
示例12: trainStep
def trainStep(fnn, trainer, trndata, tstdata):
trainer.trainEpochs(1)
trnresult = percentError(trainer.testOnClassData(), trndata["class"])
tstresult = percentError(trainer.testOnClassData(dataset=tstdata), tstdata["class"])
print "epoch: %4d" % trainer.totalepochs, " train error: %5.2f%%" % trnresult, " test error: %5.2f%%" % tstresult
out = fnn.activateOnDataset(griddata)
out = out.argmax(axis=1) # the highest output activation gives the class
out = out.reshape(X.shape)
figure(1)
ioff() # interactive graphics off
clf() # clear the plot
hold(True) # overplot on
for c in [0, 1, 2]:
here, _ = where(trndata["class"] == c)
plot(trndata["input"][here, 0], trndata["input"][here, 1], "o")
if out.max() != out.min(): # safety check against flat field
contourf(X, Y, out) # plot the contour
ion() # interactive graphics on
draw() # update the plot
figure(2)
ioff() # interactive graphics off
clf() # clear the plot
hold(True) # overplot on
for c in [0, 1, 2]:
here, _ = where(tstdata["class"] == c)
plot(tstdata["input"][here, 0], tstdata["input"][here, 1], "o")
if out.max() != out.min(): # safety check against flat field
contourf(X, Y, out) # plot the contour
ion() # interactive graphics on
draw() # update the plot
开发者ID:Opeey,项目名称:hackday,代码行数:34,代码来源:main.py
示例13: test
def test(self,filename,classes,trainer,net):
testLabels = []
#load test data
tstdata = ClassificationDataSet(103, 1, nb_classes=classes)
tstdata = self.loaddata(filename, classes)
testLabels = tstdata['target'];
# some sort of mandatory conversion
tstdata._convertToOneOfMany()
# using numpy array
output = np.array([net.activate(x) for x, _ in tstdata])
output = output.argmax(axis=1)
print(output)
print("on test data",percentError( output, tstdata['class'] ))
for i, l in enumerate(output):
print l, '->', testLabels[i][0]
# alternate version - using activateOnDataset function
out = net.activateOnDataset(tstdata).argmax(axis=1)
print out
return percentError( out, tstdata['class'])
开发者ID:niesmo,项目名称:sign-language-classification,代码行数:25,代码来源:NeuralNets.py
示例14: createnetwork
def createnetwork(n_hoglist,n_classlist,n_classnum,n_hiddensize=100):
n_inputdim=len(n_hoglist[0])
n_alldata = ClassificationDataSet(n_inputdim,1, nb_classes=n_classnum)
for i in range(len(n_hoglist)):
n_input = n_hoglist[i]
n_class = n_classlist[i]
n_alldata.addSample(n_input, [n_class])
n_tstdata, n_trndata = n_alldata.splitWithProportion( 0.25 )
n_trndata._convertToOneOfMany( )
n_tstdata._convertToOneOfMany( )
print "Number of training patterns: ", len(n_trndata)
print "Input and output dimensions: ", n_trndata.indim, n_trndata.outdim
print "First sample (input, target, class):"
print n_trndata['input'][0], n_trndata['target'][0], n_trndata['class'][0]
n_fnn = buildNetwork(n_trndata.indim,n_hiddensize, n_trndata.outdim, outclass=SoftmaxLayer)
n_trainer = BackpropTrainer(n_fnn, dataset=n_trndata, momentum=0.1, verbose=True, weightdecay=0.01)
n_result = 1
while n_result > 0.1:
print n_result
n_trainer.trainEpochs(1)
n_trnresult = percentError(n_trainer.testOnClassData(),
n_trndata['class'])
n_tstresult = percentError(n_trainer.testOnClassData(
dataset=n_tstdata), n_tstdata['class'])
print "epoch: %4d" % n_trainer.totalepochs, \
" train error: %5.2f%%" % n_trnresult, \
" test error: %5.2f%%" % n_tstresult
n_result = n_tstresult
开发者ID:junwangcas,项目名称:network_rs,代码行数:32,代码来源:create_neuralnet.py
示例15: trainNetwork
def trainNetwork(inData, numOfSamples, numOfPoints, epochs):
# Build the dataset
alldata = createRGBdataSet(inData, numOfSamples, numOfPoints)
# Split into test and training data
trndata, tstdata = splitData(alldata)
# Report stats
print "Number of training patterns: ", len(trndata)
print "Input and output dimensions: ", trndata.indim, trndata.outdim
print "First sample (input, target, class):"
print trndata['input'][0], trndata['target'][0], trndata['class'][0]
# Build and train the network
fnn = buildNetwork( trndata.indim, 256, trndata.outdim, outclass=SoftmaxLayer )
trainer = BackpropTrainer( fnn, dataset=trndata, momentum=0.001, verbose=True, weightdecay=0.001)
#trainer.trainEpochs( epochs )
trainer.trainUntilConvergence(maxEpochs=epochs)
# Report results
trnresult = percentError( trainer.testOnClassData(), trndata['class'] )
tstresult = percentError( trainer.testOnClassData( dataset=tstdata ), tstdata['class'] )
print "epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
# Report results of final network
checkNeuralNet(trainer, alldata, numOfSamples)
return fnn
开发者ID:johnesquivel,项目名称:RaspVoiceRecog,代码行数:28,代码来源:buildModel.py
示例16: trainNetwork
def trainNetwork(epochs, rate, trndata, tstdata, network=None):
'''
epochs: number of iterations to run on dataset
trndata: pybrain ClassificationDataSet
tstdat: pybrain ClassificationDataSet
network: filename of saved pybrain network, or None
'''
if network is None:
net = buildNetwork(400, 25, 25, 9, bias=True, hiddenclass=SigmoidLayer, outclass=SigmoidLayer)
else:
net = NetworkReader.readFrom(network)
print "Number of training patterns: ", len(trndata)
print "Input and output dimensions: ", trndata.indim, trndata.outdim
print "First sample input:"
print trndata['input'][0]
print ""
print "First sample target:", trndata['target'][0]
print "First sample class:", trndata.getClass(int(trndata['class'][0]))
print ""
trainer = BackpropTrainer(net, dataset=trndata, learningrate=rate)
for i in range(epochs):
trainer.trainEpochs(1)
trnresult = percentError(trainer.testOnClassData(), trndata['class'])
tstresult = percentError(trainer.testOnClassData(dataset=tstdata), tstdata['class'])
print "epoch: %4d" % trainer.totalepochs, " train error: %5.2f%%" % trnresult, " test error: %5.2f%%" % tstresult
return net
开发者ID:kdelaney711,项目名称:sudokusolver,代码行数:29,代码来源:network.py
示例17: train
def train(self, inputData, verbose=True):
# Set of data to classify:
# - IMG_SIZE input dimensions per data point
# - 1 dimensional output
# - 4 clusters of classification
all_faces = ClassificationDataSet(IMG_SIZE, 1, nb_classes=4)
for entry in inputData:
(emotion, data) = entry
all_faces.addSample(data, [emotion])
# Generate a test and a train set from our data
test_faces, train_faces = all_faces.splitWithProportion(0.25)
# Hack to convert a 1-dimensional output into 4 output neurons
test_faces._convertToOneOfMany()
train_faces._convertToOneOfMany()
# Set up the actual network. These are the tunable params
self.fnn = buildNetwork(
train_faces.indim,
20,
train_faces.outdim,
outclass=SoftmaxLayer
)
# Set up the network trainer. Also nice tunable params
trainer = BackpropTrainer(
self.fnn,
dataset=train_faces,
momentum=0.1,
verbose=False,
weightdecay=0.01
)
tabledata = []
# Train this bitch.
if verbose:
# Report after every epoch if verbose
for i in range(EPOCHS):
trainer.trainEpochs(1)
trnresult = percentError( trainer.testOnClassData(),
train_faces['class'] )
tstresult = percentError( trainer.testOnClassData(
dataset=test_faces ), test_faces['class'] )
tabledata.append((trainer.totalepochs,trnresult,tstresult))
else:
trainer.trainEpochs(EPOCHS)
if verbose:
print "Epoch\tTrain Error\tTest Error"
for line in tabledata:
print "%4d\t" % line[0], \
"%5.2f%%\t\t" % line[1], \
"%5.2f%%" % line[2]
开发者ID:mwebergithub,项目名称:face457b,代码行数:59,代码来源:supervised_facial_classifier.py
示例18: train_model
def train_model(net, train_ds, test_ds):
# train model
tstdata, trndata = test_ds, train_ds
tstdata._convertToOneOfMany()
trndata._convertToOneOfMany()
print "Number of training patterns: ", len(trndata)
print "Number of test patterns: ", len(tstdata)
print "Input and output dimensions: ", trndata.indim, trndata.outdim
trainer = ExtendedBackpropTrainer(net, learningrate=0.01, dataset=trndata, verbose=True)
for i in range(20):
trainer.trainEpochs(5)
trnresult = percentError( trainer.testOnClassData(),
trndata['class'] )
tstresult = percentError( trainer.testOnClassData(
dataset=tstdata ), tstdata['class'] )
# Compute ROC curve and area the curve
probas_ = net.activateOnDataset(tstdata)
fpr, tpr, thresholds = roc_curve(tstdata['class'], probas_[:, 1])
roc_auc = auc(fpr, tpr)
print "Area under the ROC curve : %f" % roc_auc
print "epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
guess = []
correct = []
count = 0
for i in range(len(tstdata)):
output = net.activate(tstdata['input'][i])[0]
output = int(round(output))
real = int(tstdata['target'][i][0])
guess.append(output)
correct.append(real)
if output == real:
count += 1
conf_arr = np.zeros((2, 2))
for j in range(len(guess)):
conf_arr[guess[j]][correct[j]] += 1
print conf_arr
# Plot ROC curve
pl.clf()
pl.plot(fpr, tpr, label='ROC curve (area = %0.2f)' % roc_auc)
pl.plot([0, 1], [0, 1], 'k--')
pl.xlim([0.0, 1.0])
pl.ylim([0.0, 1.0])
pl.xlabel('False Positive Rate')
pl.ylabel('True Positive Rate')
pl.title('Receiver operating characteristic example')
pl.legend(loc="lower right")
pl.show()
开发者ID:lbvienna,项目名称:compare_documents,代码行数:57,代码来源:runNeuralNet.py
示例19: run_epoch
def run_epoch(trainer, trndata, tstdata):
trainer.trainEpochs( 1 )
trnresult = percentError( trainer.testOnClassData(),trndata['class'] )
tstresult = percentError( trainer.testOnClassData(dataset=tstdata ), tstdata['class'] )
print "epoch: %4d" % trainer.totalepochs, \
" train error: %5.2f%%" % trnresult, \
" test error: %5.2f%%" % tstresult
print
开发者ID:jamesfisk,项目名称:thesisc,代码行数:9,代码来源:neural.py
示例20: livetest
def livetest(self,data):
trainer, net = self.unpickleModel()
testData = ClassificationDataSet(103, 1, nb_classes=9)
testData.addSample(data[0],1);
testData._convertToOneOfMany()
out = net.activateOnDataset(testData).argmax(axis=1)
percentError(out, testData['class'])
print self.labelToLetter[str(out[0])]
return self.labelToLetter[str(out[0])]
开发者ID:niesmo,项目名称:sign-language-classification,代码行数:9,代码来源:NeuralNets.py
注:本文中的pybrain.utilities.percentError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论