def testing(num): trainData = np.load("traindigitbasic.npy") trainLabels = samples.loadLabelsFile("data/digitdata/traininglabels", num) testData = np.load("testdigitbasic.npy") testLabels = samples.loadLabelsFile("data/digitdata/testlabels", 1000) validData = np.load("validationdigitbasic.npy") validLabels = samples.loadLabelsFile("data/digitdata/validationlabels", 1000) neural = NeuralNetworkClassifier(28 * 28, 50, 10, num, 3.5) neural.train(trainData[:, 0:num], trainLabels, 100) print "Test Data" guess = neural.classify(testData) samples.verify(neural, guess, testLabels) print "===================================" print "Validation Data" guess = neural.classify(validData) samples.verify(neural, guess, validLabels)
def testing(num): trainData = np.load("traindigitbasic.npy") trainLabels = samples.loadLabelsFile("data/digitdata/traininglabels", num) testData = np.load("testdigitbasic.npy") testLabels = samples.loadLabelsFile("data/digitdata/testlabels", 1000) validData = np.load("validationdigitbasic.npy") validLabels = samples.loadLabelsFile("data/digitdata/validationlabels", 1000) neural = NeuralNetworkClassifier(28 * 28, 50, 10, num, 3.5) neural.train(trainData[:, 0:num], trainLabels, 100) print "*************Test Data*************" guess = neural.classify(testData) samples.verify(neural, guess, testLabels) print "***********************************" print "************Valid Data*************" guess = neural.classify(validData) samples.verify(neural, guess, validLabels)
def testing(num): trainData = samples.loadImagesFile("data/digitdata/trainingimages", num, 28, 28) trainLabels = samples.loadLabelsFile("data/digitdata/traininglabels", num) testData = samples.loadImagesFile("data/digitdata/testimages", 1000, 28, 28) testLabels = samples.loadLabelsFile("data/digitdata/testlabels", 1000) validData = samples.loadImagesFile("data/digitdata/validationimages", 1000, 28, 28) validLabels = samples.loadLabelsFile("data/digitdata/validationlabels", 1000) nb = NaiveBayesClassifier(1,0) nb.train(trainData, trainLabels) print "***********************************" print "*************Test Data*************" guess = nb.classify(testData) samples.verify(nb,guess,testLabels) print "***********************************" print "************Valid Data*************" guess=nb.classify(validData) samples.verify(nb,guess,validLabels)
def testing(num): trainData = samples.loadImagesFile("data/facedata/facedatatrain", num, 60, 70) trainLabels = samples.loadLabelsFile("data/facedata/facedatatrainlabels", num) testData = samples.loadImagesFile("data/facedata/facedatatest", 150, 60, 70) testLabels = samples.loadLabelsFile("data/facedata/facedatatestlabels", 151) validData = samples.loadImagesFile("data/facedata/facedatavalidation", 301, 60, 70) validLabels = samples.loadLabelsFile("data/facedata/facedatavalidationlabels", 301) nb = NaiveBayesClassifier(1, 0) nb.train(trainData, trainLabels) print "===================================" print "Test Data" guess = nb.classify(testData) samples.verify(nb, guess, testLabels) print "===================================" print "Validation Data" guess = nb.classify(validData) samples.verify(nb, guess, validLabels)
def testing(num): trainData = samples.loadImagesFile("data/digitdata/trainingimages", num, 28, 28) trainLabels = samples.loadLabelsFile("data/digitdata/traininglabels", num) testData = samples.loadImagesFile("data/digitdata/testimages", 1000, 28, 28) testLabels = samples.loadLabelsFile("data/digitdata/testlabels", 1000) validData = samples.loadImagesFile("data/digitdata/validationimages", 1000, 28, 28) validLabels = samples.loadLabelsFile("data/digitdata/validationlabels", 1000) nb = NaiveBayesClassifier(1,0) nb.train(trainData, trainLabels) print "===================================" print "Test Data" guess = nb.classify(testData) samples.verify(nb,guess,testLabels) print "===================================" print "Validation Data" guess=nb.classify(validData) samples.verify(nb,guess,validLabels)
def testing(num): trainData = samples.loadImagesFile("data/facedata/facedatatrain", num, 60, 70) trainLabels = samples.loadLabelsFile("data/facedata/facedatatrainlabels", num) testData = samples.loadImagesFile("data/facedata/facedatatest", 150, 60, 70) testLabels = samples.loadLabelsFile("data/facedata/facedatatestlabels", 151) validData = samples.loadImagesFile("data/facedata/facedatavalidation", 301, 60, 70) validLabels = samples.loadLabelsFile("data/facedata/facedatavalidationlabels", 301) perceptron=PerceptronClassifier(trainData, trainLabels,0) perceptron.train(trainData, trainLabels,10) print "===================================" print "Test Data" guess=perceptron.classify(testData) samples.verify(perceptron, guess, testLabels) print "===================================" print "Validation Data" guess=perceptron.classify(validData) samples.verify(perceptron,guess,validLabels)
def testing(num): trainData = samples.loadImagesFile("data/digitdata/trainingimages", num, 28, 28) trainLabels = samples.loadLabelsFile("data/digitdata/traininglabels", num) testData = samples.loadImagesFile("data/digitdata/testimages", 1000, 28, 28) testLabels = samples.loadLabelsFile("data/digitdata/testlabels", 1000) validData = samples.loadImagesFile("data/digitdata/validationimages", 1000, 28, 28) validLabels = samples.loadLabelsFile("data/digitdata/validationlabels", 1000) perceptron=PerceptronClassifier(trainData, trainLabels,0) perceptron.train(trainData, trainLabels,10) print "***********************************" print "*************Test Data*************" guess=perceptron.classify(testData) samples.verify(perceptron, guess, testLabels) print "***********************************" print "************Valid Data*************" guess=perceptron.classify(validData) samples.verify(perceptron,guess,validLabels)
def testing(num): trainData = samples.loadImagesFile("data/digitdata/trainingimages", num, 28, 28) trainLabels = samples.loadLabelsFile("data/digitdata/traininglabels", num) testData = samples.loadImagesFile("data/digitdata/testimages", 1000, 28, 28) testLabels = samples.loadLabelsFile("data/digitdata/testlabels", 1000) validData = samples.loadImagesFile("data/digitdata/validationimages", 1000, 28, 28) validLabels = samples.loadLabelsFile("data/digitdata/validationlabels", 1000) perceptron=PerceptronClassifier(trainData, trainLabels,0) perceptron.train(trainData, trainLabels,10) print "===================================" print "Test Data" guess=perceptron.classify(testData) samples.verify(perceptron, guess, testLabels) print "===================================" print "Validation Data" guess=perceptron.classify(validData) samples.verify(perceptron,guess,validLabels)
def testing(num): trainData = np.load("trainfacebasic.npy") trainLabels = samples.loadLabelsFile("data/facedata/facedatatrainlabels", num) testData = np.load("testfacebasic.npy") testLabels = samples.loadLabelsFile("data/facedata/facedatatestlabels", 151) validData = np.load("validationfacebasic.npy") validLabels = samples.loadLabelsFile("data/facedata/facedatavalidationlabels", 301) loop=True while loop: neural = NeuralNetworkClassifier(60 * 70, 500, 1, num, 0.03) neural.train(trainData[:,0:num], trainLabels, 100) print "Test Data" guess = neural.classify(testData) loop=samples.verify(neural, guess, testLabels) if loop: continue print "===================================" print "Validation Data" guess = neural.classify(validData) samples.verify(neural, guess, validLabels)
def testing(num): trainData = np.load("trainfaceadvanced.npy") trainLabels = samples.loadLabelsFile("data/facedata/facedatatrainlabels", num) testData = np.load("testfaceadvanced.npy") testLabels = samples.loadLabelsFile("data/facedata/facedatatestlabels", 151) validData = np.load("validationfaceadvanced.npy") validLabels = samples.loadLabelsFile("data/facedata/facedatavalidationlabels", 301) loop=True while loop: neural = NeuralNetworkClassifier(60 * (70+1), 500, 1, num, 0.03) neural.train(trainData[:,0:num], trainLabels, 100) print "Test Data" guess = neural.classify(testData) loop=samples.verify(neural, guess, testLabels) if loop: continue print "===================================" print "Validation Data" guess = neural.classify(validData) samples.verify(neural, guess, validLabels)
def testing(num): trainData = samples.loadImagesFile("data/facedata/facedatatrain", num, 60, 70) trainLabels = samples.loadLabelsFile("data/facedata/facedatatrainlabels", num) testData = samples.loadImagesFile("data/facedata/facedatatest", 150, 60, 70) testLabels = samples.loadLabelsFile("data/facedata/facedatatestlabels", 151) validData = samples.loadImagesFile("data/facedata/facedatavalidation", 301, 60, 70) validLabels = samples.loadLabelsFile( "data/facedata/facedatavalidationlabels", 301) nb = NaiveBayesClassifier(1, 0) nb.train(trainData, trainLabels) print "***********************************" print "************Test Data**************" guess = nb.classify(testData) samples.verify(nb, guess, testLabels) print "***********************************" print "***********Valid Data**************" guess = nb.classify(validData) samples.verify(nb, guess, validLabels)
def testing(num): trainData = samples.loadImagesFile("data/facedata/facedatatrain", num, 60, 70) trainLabels = samples.loadLabelsFile("data/facedata/facedatatrainlabels", num) testData = samples.loadImagesFile("data/facedata/facedatatest", 150, 60, 70) testLabels = samples.loadLabelsFile("data/facedata/facedatatestlabels", 151) validData = samples.loadImagesFile("data/facedata/facedatavalidation", 301, 60, 70) validLabels = samples.loadLabelsFile( "data/facedata/facedatavalidationlabels", 301) perceptron = PerceptronClassifier(trainData, trainLabels, 0) perceptron.train(trainData, trainLabels, 10) print "===================================" print "Test Data" guess = perceptron.classify(testData) samples.verify(perceptron, guess, testLabels) print "===================================" print "Validation Data" guess = perceptron.classify(validData) samples.verify(perceptron, guess, validLabels)