Exemplo n.º 1
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
def testSingleCluster():
  trainData = df.flatPixelTrainData()
  unn = UnsupervisedNeuralNet(20)
  np.random.shuffle(trainData)
  unn.C = 1
  unn.D = 900
  unn.initializeSynapses()
  unn.trainOnPoint(unn.synapses, trainData[0], 0, 0.01)
  for p in trainData:
    unn.classify(p)
def testUnsupervisedNeuralNet():
  trainData = df.flatPixelTrainData()
  synthTrainData = sf.synthData(500,256,128)
  #testData = df.flatPixelTestData().reshape(10,1000,900)

  net = UnsupervisedNeuralNet(20)
  synapses = net.trainOnSetGrowing(trainData)
  #net.testOnSet(testData)
  net.displayClassMeans()
  return synapses