Example #1
0
def testPegasos():
  unlabeledTrainData = df.flatEdgeTrainData()
  unlabeledTestData = df.flatEdgeTestData()
  trainData = df.labeled(unlabeledTrainData)
  testData = df.labeled(unlabeledTestData)
  peg = PegasosSVM()
  peg.trainOnSet(trainData,unlabeledTrainData,8000)
  peg.testOnSet(testData)
  peg.displayWeights()
  peg.showProductHistogram(unlabeledTestData)
  return peg
Example #2
0
def testNeuralNet(numIterations):
  trainData = df.labeled(df.flatPixelTrainData())
  testData = df.flatPixelTestData().reshape(10,1000,900)

  net = NeuralNet(20)
  net.trainOnSet(trainData, numIterations)
  net.testOnSet(testData)
  net.displayClassMeans()
  return net