Beispiel #1
0
def single_run(te):
    print te
    data, label = make_moons(n_samples=2000,
                             noise=0.05,
                             shuffle=True,
                             random_state=int(time.time()))

    data, validation_data, label, validation_label = train_test_split(
        data, label, train_size=.30)
    #separate the data set into buckets

    total_data = []
    for item in data:  #list(group_list(data,1))
        total_data.append(np.array(np.matrix(item)))

    total_label = []
    for item in label:  #list(group_list(label,1))

        total_label.append(np.asarray(item))
    #The two separate site sets

    for s in range(10, 150, 10):
        nets = []
        nn_groups_data = []
        nn_groups_label = []
        number_of_nets = s
        for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1, [2, 6, 6, 1], eta=eta,
                                       nonlin=nonlin))
        iters = 100
        for j in range(number_of_nets):

            x = (total_data[int(float(j) / number_of_nets *
                                (len(total_data))):int(
                                    float((j + 1)) / number_of_nets *
                                    (len(total_data)))])
            nn_groups_data.append(x)

            nn_groups_label.append(total_label[int(
                float(j) / number_of_nets * (len(total_label) / number_of_nets)
            ):int(float((j + 1)) / number_of_nets * (len(total_label)))])
        start = time.time()
        visitbatches(nets, nn_groups_data, nn_groups_label, [], it=iters)
        one = accuracy(nets[0], validation_data, validation_label, thr=0.5)

        nn1Acc[te][s / 10] += one
        print "accuracy"
        print one
        '''
def single_run(te):
    print te
    data, label = make_moons(n_samples=2000, noise=0.05, shuffle=True, random_state = int(time.time()))
        
    data,validation_data,label,validation_label = train_test_split(data,label,train_size = .30)
        #separate the data set into buckets
    
    total_data = []
    for item in data:#list(group_list(data,1))
      total_data.append(np.array(np.matrix(item)))
    
    total_label = []
    for item in label:#list(group_list(label,1))
      
      total_label.append(np.asarray(item))
    #The two separate site sets

    for s in range(10,150,10):
	nets = []
	nn_groups_data = []
	nn_groups_label = []
	number_of_nets = s
	for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin))
        iters = 100
        for j in range(number_of_nets):

            x = (total_data[int(float(j)/number_of_nets*(len(total_data))):int(float((j+1))/number_of_nets*(len(total_data)))])
            nn_groups_data.append(x)
            
	 
            nn_groups_label.append(total_label[int(float(j)/number_of_nets*(len(total_label)/number_of_nets)):int(float((j+1))/number_of_nets*(len(total_label)))])
	start = time.time()
	visitbatches(nets,nn_groups_data,nn_groups_label,[],it=iters)
	one = accuracy(nets[0], validation_data, validation_label, thr=0.5)

	nn1Acc[te][s/10] += one
	print "accuracy"
	print one
        '''
    batches = list() #a list to store every separate site set
    #Lists for our error to be plotted later
        
    nat = []
    for i in range((min(len(nn1_groups_data),len(nn2_groups_data),len(nn2_groups_data)))):#
	
        print len(nn1_groups_data)-1
        groups_data = list()
        groups_label = list()
        nets = list()
        batches = list()
        nnClassic1 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        nnClassic2 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        
        for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin))
        
        #Build the two site data sets
        groups_data.append(np.asarray([item for sublist in nn1_groups_data[:i+1] for item in sublist]))
        groups_data.append(np.asarray([item for sublist in nn2_groups_data[:i+1] for item in sublist]))
        groups_data.append(np.asarray([item for sublist in nn3_groups_data[:i+1] for item in sublist]))
        print "groups data length " + str(len(nn1_groups_label))
        print "groups data length " + str(len(nn1_groups_data[i]))
        print "groups data length " + str(len(nn2_groups_label[i]))
        print "groups data length " + str(len(nn2_groups_data))

        groups_label.append(np.asarray([item for sublist in nn1_groups_label[:i+1] for item in sublist]))
        groups_label.append(np.asarray([item for sublist in nn2_groups_label[:i+1] for item in sublist]))
        groups_label.append(np.asarray([item for sublist in nn3_groups_label[:i+1] for item in sublist]))
        total_groups_data = np.asarray([item for sublist in groups_data for item in sublist])
        total_groups_label =  np.asarray([item for sublist in groups_label for item in sublist])
def sing_run(counts):
      siteCount = 0
      if counts[1] == 2:
        siteCount = 0
      if counts[1] == 10:
        siteCount = 1
      if counts[1] == 100:
        siteCount = 2
      number_of_nets = counts[1]
      data, label = make_moons(n_samples=6 * site_size * number_of_nets, noise=0.05, shuffle=True, random_state = int(time.time()))
        
      data,validation_data,label,validation_label = train_test_split(data,label,train_size = .50)
     
      biases = [.01,.02,.05,.15,.20,.25,.30,.35,.40,.5]
      #biases = [.01,.5]
      biasCount = 0
      for b in biases:
        
        #nData, nLabel = (bias(data,label,b))

        total_data = data
        #print len(total_data)
        total_label = label#list(group_list(nLabel,1))

        
  
        nn_groups_data = []
        nn_groups_label = list()
        groups_data = list()
        groups_label = list()
        nets = list()
        batches = list()
        for j in range(number_of_nets):
          dataCount = len(total_data) / number_of_nets
          #x = (total_data[int(float(j)/number_of_nets*(len(total_data))):int(float((j+1))/number_of_nets*(len(total_data)))])
          x = total_data[site_size * j * 3 : site_size*(j+1)*3]
          
          y = total_label[site_size * j*3 : site_size*(j+1)*3]
          d,l = bias(x,y,b,site_size)
          nn_groups_data.append(d)

            #print len(nn_groups_data[j])
            #print "HERE BREAK"
            #print str(float((j+1))) + "  " + str(number_of_nets) + "  LEN TOTAL DATA: " + str(len(total_data)) 
            #print int(float((j+1))/number_of_nets*(len(total_data)/number_of_nets))
            #print "HERE END"
          nn_groups_label.append(l)
          #print len(nn_groups_data[1])

        nets = list()  #Our differential networks
        batches = list() #a list to store every separate site set
        labelBatches = list()
        #Lists for our error to be plotted later
        #FIXME:  Needs to fill batches only.  Really though?  Think about this more...
        #TODO:  run this guy when you get the chance.  10 samples, and check.  if it's not what you want,
        #it's a problem...        
        #for i in range(len(nn_groups_data)):
            
            #nnClassic1 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)

        
        for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin))


        groups_data = []
        groups_label = []
        print "y"
        for ke in range(0,number_of_nets):
          for k in range(0,site_size):
            groups_data.append((nn_groups_data[ke][k].T))
            groups_label.append(nn_groups_label[ke][k])

            #t = [x for x in iter_minibatches(2,total_groups_data.T, total_groups_label)]
            #t3 = [x for x in iter_minibatches(2,total_groups_data.T, total_groups_label)]
        err = []
            #Run the batches through the algos
        iters = 100
            #visitClassicBatches(nnClassic1,t, it=iters)
            #visitClassicBatches(nnClassic3,t3, it=iters)
        start = time.time()
        batches_data,batches_label = [x for x in iter_minibatches(site_size,groups_data, groups_label)]
        visitClassicBatches(nets[0], batches_data, batches_label, it=iters)
            #print time.time() - start
            #calculate error

            #classic = accuracyClassic(nnClassic1,validation_data,validation_label, thr=0.5)
        print "has finished calc"        
        one = accuracy(nets[0], validation_data, validation_label, thr=0.5)
            #classic3 = accuracyClassic(nnClassic3,validation_data,validation_label, thr=0.5)
        nat = nets[0]
            #build plottable arrays
        nn1Acc[siteCount][counts[0]][biasCount] += one
        print "accuracy"
        print one
            
            #classAcc1[te][s/2] += classic
            #classAcc3[te][s/2] += classic3

            #print "us " + str(one) + " c1 " + str(classic) + " cc " + str(classic3)

        biasCount +=1
Beispiel #5
0
    nets = list()  #Our differential networks
    batches = list()  #a list to store every separate site set

    for i in range((min(len(nn1_groups_data), len(nn2_groups_data),
                        len(nn2_groups_data)))):  #

        print len(nn1_groups_data) - 1
        groups_data = list()
        groups_label = list()
        nets = list()
        batches = list()
        nnClassic1 = nnS.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)
        nnClassic2 = nnS.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)

        for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1, [2, 6, 6, 1], eta=eta,
                                       nonlin=nonlin))

        #Build the two site data sets
        groups_data.append(
            np.asarray([
                item for sublist in nn1_groups_data[:i + 1] for item in sublist
            ]))
        groups_data.append(
            np.asarray([
                item for sublist in nn2_groups_data[:i + 1] for item in sublist
            ]))
        groups_data.append(
            np.asarray([
                item for sublist in nn3_groups_data[:i + 1] for item in sublist
            ]))
        print "groups data length " + str(len(nn1_groups_label))
def sing_run(te):
    print te
    data, label = make_moons(n_samples=2000, shuffle=True, noise=0.1,random_state = int(time.time()))
    
    data,validation_data,label,validation_label = train_test_split(data,label,train_size = .38)
        #separate the data set into buckets
 
    total_data, total_label,A,B = split(data,label)
    
    random.seed(4)
    random.shuffle(total_data[0])
    random.seed(4)
    random.shuffle(total_data[1])
    random.seed(4)
    random.shuffle(total_data[2])
    random.seed(4)
    random.shuffle(total_label[0])
    random.seed(4)
    random.shuffle(total_label[1])
    random.seed(4)
    random.shuffle(total_label[2])
    totlistX = []
    totlistY = []
    #for item in total_data[0]:
      #x=2
      #totlistX.append(item[0])
      #totlistY.append(item[1])
    #for item in total_data[1]:
	  #x=2
	  #totlistX.append(item[0])
	  #totlistY.append(item[1])
    #for item in total_data[2]:
	  #x=2
	  #totlistX.append(item[0])
	  #totlistY.append(item[1])
    # print len(totlistX)


    #plt.scatter(totlistX,totlistY,c=total_label[0] + total_label[1] +total_label[2])
    #+total_label[1]+total_label[2]

    #random.shuffle(total_label[2])
    '''for i in range(3):
      for item in total_data[i]:
	for j in range(len(item)):
	  total_data[i][j] = list(total_data[i][j])'''
    #total_data = list(group_list(data,10))
    #total_label = list(group_list(label,10))
    #The two separate site sets
    #nn1_groups_data = total_data[:len(total_data)/2+1]
    #nn1_groups_data = total_data[0]#list(group_list(total_data[0],1))
    #nn1_groups_label = total_label[0]#list(group_list(total_label[0],1))
    #nn2_groups_data = total_data[1]#list(group_list(total_data[1],1))
    #nn2_groups_label = total_label[1]#list(group_list(total_label[1],1))
    #nn3_groups_data = total_data[2]#list(group_list(total_data[2],1))
    #nn3_groups_label = total_label[2]#list(group_list(total_label[2],1))

   

 
    minim = min(min(len(total_data[0]),len(total_data[1])),len(total_data[2]))
    #print "length of site one group data " + str(len(nn1_groups_data))
    #nn2_groups_data = total_data[len(total_data)/2:]
    #nn1_groups_label = total_label[:len(total_data)/2+1]
    #nn2_groups_label = total_label[len(total_data)/2:]
    
    nets = list()  #Our differential networks
    batches = list() #a list to store every separate site set
    #Lists for our error to be plotted later
        
    nat = []


  

    for i in range((minim - minim%10) -10,minim - minim%10,10):#
	totlistX1 = []
	totlistY1 = []
	totlistX2 = []
	totlistY2 = []
	totlistX3 = []
	totlistY3 = []
	for item in total_data[0][:i]:
	  x=2
	  totlistX1.append(item[0])
	  totlistY1.append(item[1])
	for item in total_data[1][:i]:
	  x=2
	  totlistX1.append(item[0])
	  totlistY1.append(item[1])
	for item in total_data[2][:i]:
	  totlistX1.append(item[0])
	  totlistY1.append(item[1])
	#print len(totlistX)
	#print len(total_label[0][:i]+total_label[1][:i]+total_label[2][:i])
	#print "y"
	#print [0 for x in total_label[0][:i]]+[1 for x in total_label[1][:i]]+[2 for x in total_label[2][:i]]
	#plt.scatter(totlistX1,totlistY1,c=[0 for x in total_label[0][:i]]+[1 for x in total_label[1][:i]]+[2 for x in total_label[2][:i]])
	#plt.scatter(totlistX2,totlistY2,c=[x + 2 for x in total_label[1][:i]])
	#plt.scatter(totlistX3,totlistY3,c=[x + 4 for x in total_label[2][:i]])
	#plt.show()
	#exit(1)
	#TODO:  Here, we need to rewrite the function so it 
        groups_data = []
        groups_label = []
        nets = []
        batches = []
        #nnClassic1 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #nnClassic2 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin))
        print number_of_nets
        nextNet = nnDif.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #Build the two site data sets
        #groups_data.append(np.asarray([item for sublist in nn1_groups_data[:i+1] for item in sublist]))
        #groups_data.append(np.asarray([item for sublist in nn2_groups_data[:i+1] for item in sublist]))
        #groups_data.append(np.asarray([item for sublist in nn3_groups_data[:i+1] for item in sublist]))

        #groups_label.append(np.asarray([item for sublist in nn1_groups_label[:i+1] for item in sublist]))
        #groups_label.append(np.asarray([item for sublist in nn2_groups_label[:i+1] for item in sublist]))
        #groups_label.append(np.asarray([item for sublist in nn3_groups_label[:i+1] for item in sublist]))
        #total_groups_data = np.asarray([item for sublist in groups_data for item in sublist])
        #total_groups_label =  np.asarray([item for sublist in groups_label for item in sublist])
        #Our classic combined nn    
        #nnClassic3 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #nnClassic4 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        
        #for s in range(number_of_nets):
            #batches.append([x for x in iter_minibatches(2,groups_data[s].T, groups_label[s])])
        #t = [x for x in iter_minibatches(2,groups_data[0].T, groups_label[0])]
        #t2 = [x for x in iter_minibatches(1,groups_data[1].T, groups_label[1])]    
        #t3 = [x for x in iter_minibatches(1,groups_data[2].T, groups_label[2])]
        #t4 = [x for x in iter_minibatches(1,total_groups_data.T, total_groups_label)]
        err = []
        #Run the batches through the algos
        iters = 700
        #visitClassicBatches(nnClassic2,nn2_groups_data[:i],nn2_groups_label[:i], it=iters)
        #visitClassicBatches(nnClassic3,nn3_groups_data[:i],nn3_groups_label[:i], it=iters)
        #visitClassicBatches(nnClassic4,t4, it=iters)
        #visitbatches(nets, batches, err, it=iters)
	#print "finish classics"
        #differential_groups = differential_groups + dif_group_data[3*i] +dif_group_data[3*i + 1] + dif_group_data[3*i + 2]
	batchesData1,batchesLabel1 = [x for x in iter_minibatches(1,total_data[0],total_label[0])]
       	batchesData2,batchesLabel2 = [x for x in iter_minibatches(1,total_data[1],total_label[1])]
	batchesData3,batchesLabel3 = [x for x in iter_minibatches(1,total_data[2],total_label[2])]
	nnTogetherClassic = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
	classicWing = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
	classicWing2 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
	classicLeft = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
	nnTogetherDif = nnDif.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
	print "LENGTH:   " +str(len(batchesData1[:i]))
	visitClassicBatches(classicWing,batchesData2[:i],batchesLabel2[:i],it=iters)
	#visitClassicBatches(classicWing2,batchesData2[:i],batchesLabel2[:i],it=iters)
	visitClassicBatches(classicLeft,batchesData1[:i],batchesLabel1[:i],it=iters)
	visitClassicBatches(nnTogetherClassic,batchesData1[:i]+batchesData2[:i]+batchesData3[:i],batchesLabel1[:i]+batchesLabel2[:i]+batchesLabel3[:i],it=iters)
	#visitClassicBatches(nnClassic1,batchesData1[:i],batchesLabel1[:i], it=iters)
	#visitClassicBatches(nnClassic2,batchesData2[:i],batchesLabel2[:i], it=iters)
	#visitClassicBatches(nnClassic3,batchesData3[:i],batchesLabel3[:i], it=iters)
	
	plotlistX = []
	plotlistY = []
	plotlistColor = []
	for batch in batchesData1[:i]:
	  for tup in batch:
	      plotlistX.append(tup[0])
	      plotlistY.append(tup[1])
	#for batch in batchesData2[:i]:
	#  for tup in batch:
	#    for sid in tup:
	#      plotlistX.append(sid[0])
	#      plotlistY.append(sid[1])
	#for batch in batchesData3[:i]:
	#  for tup in batch:
	#    x = 2
	    #plotlistX.append(tup[0])
	    #plotlistY.append(tup[1])
	for arr in batchesLabel1[:i]:
	  for tup in arr:
	    plotlistColor.append(tup)
	#for arr in batchesLabel2[:i]:
	#  for tup in arr:
	#    plotlistColor.append(tup[0])
	#    plotlistColor.append(tup[0])

	#plt.scatter(plotlistX,plotlistY,c=plotlistColor)
	     #+batchesLabel2[:i]+batchesLabel3[:i])
	
	#plt.show()
	new_total_data = []
	new_total_label = []
	for x in range(i):
	  for se in range(len(nets)):
	    new_total_data.append(total_data[0][x])
	    new_total_data.append(total_data[1][x])
	    new_total_data.append(total_data[2][x])
	    new_total_label.append(total_label[0][x])
	    new_total_label.append(total_label[1][x])
	    new_total_label.append(total_label[2][x])
        #differential_labels = differential_labels + dif_group_label[3*i] + dif_group_label[3*i + 1] + dif_group_label[3*i + 2]
        #visitbatches(nets, [nn1_groups_data[:i],nn2_groups_data[:i],nn3_groups_data[:i]], [nn1_groups_label[:i],nn2_groups_label[:i],nn3_groups_label[:i]], err, it=iters)
	batchesList = [batchesData1[:i],batchesData2[:i],batchesData3[:i]]
	labelList = [batchesLabel1[:i],batchesLabel2[:i],batchesLabel3[:i]]

	visitClassicBatches(nets[0], [batchesData1[:i],batchesData2[:i],batchesData3[:i]], [batchesLabel1[:i],batchesLabel2[:i],batchesLabel3[:i]], err, it=iters)
        batches2 = [batchesData1[:i]+batchesData2[:i]+batchesData3[:i]]
	list2 = [batchesLabel1[:i]+batchesLabel2[:i]+batchesLabel3[:i]]

        #visitbatches([nets[1]], [batchesData1[:i]], [batchesLabel1[:i]], err, it=iters)
	#visitbatches([nextNet], [batchesData1[:i]+batchesData2[:i]+batchesData3[:i]], [batchesLabel1[:i]+batchesLabel2[:i]+batchesLabel3[:i]], err, it=iters)

        #calculate error
        #nnClassic5 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #testAcc = accuracyClassic(nnClassic5,validation_data,validation_label,thr=.05)
        #testAcc2 = accuracy(nnClassic5,validation_data,validation_label,thr=.05)
        togetherAcc = accuracyClassic(nnTogetherClassic,validation_data,validation_label,thr=.05)
        
        
        classic = accuracyClassic(classicWing,validation_data,validation_label, thr=0.5)
	#classic2 = accuracyClassic(classicWing2,validation_data,validation_label, thr=0.5)
	classicLeft = accuracyClassic(classicLeft,validation_data,validation_label, thr=0.5)
        one = accuracyClassic(nets[0], validation_data, validation_label, thr=0.5)
        #two = accuracy(nets[1], validation_data,validation_label, thr=0.5)
        #classic2 = accuracyClassic(nnClassic2,validation_data,validation_label, thr=0.5)
        #classic3 = accuracyClassic(nnClassic3,validation_data,validation_label, thr=0.5)
        #classic4 = accuracyClassic(nnClassic4,validation_data,validation_label, thr=0.5)
        #build plottable arrays
  
        nn1Acc[te][i/10] = one
	#newAcc = accuracy(nnTogetherDif,validation_data,validation_label,thr=.5)
        print "ACCURACY"
        print one
        print "^^^Decent acc  || total acc"
        print togetherAcc
        print "MIDDLE  " + str(classic)
	print "Left side:  "+ str(classicLeft)
      
        classAcc1[te][i/10] = classic
        #classAcc2[te][i/10] = classic2
	classAcc3[te][i/10] = classicLeft
        classAcc4[te][i/10] = togetherAcc
Beispiel #7
0
def sing_run(te):
    print te
    data, label = make_moons(n_samples=2000,
                             shuffle=True,
                             noise=0.1,
                             random_state=int(time.time()))

    data, validation_data, label, validation_label = train_test_split(
        data, label, train_size=.38)
    #separate the data set into buckets

    total_data, total_label, A, B = split(data, label)

    random.seed(4)
    random.shuffle(total_data[0])
    random.seed(4)
    random.shuffle(total_data[1])
    random.seed(4)
    random.shuffle(total_data[2])
    random.seed(4)
    random.shuffle(total_label[0])
    random.seed(4)
    random.shuffle(total_label[1])
    random.seed(4)
    random.shuffle(total_label[2])
    totlistX = []
    totlistY = []
    #for item in total_data[0]:
    #x=2
    #totlistX.append(item[0])
    #totlistY.append(item[1])
    #for item in total_data[1]:
    #x=2
    #totlistX.append(item[0])
    #totlistY.append(item[1])
    #for item in total_data[2]:
    #x=2
    #totlistX.append(item[0])
    #totlistY.append(item[1])
    # print len(totlistX)

    #plt.scatter(totlistX,totlistY,c=total_label[0] + total_label[1] +total_label[2])
    #+total_label[1]+total_label[2]

    #random.shuffle(total_label[2])
    '''for i in range(3):
      for item in total_data[i]:
	for j in range(len(item)):
	  total_data[i][j] = list(total_data[i][j])'''
    #total_data = list(group_list(data,10))
    #total_label = list(group_list(label,10))
    #The two separate site sets
    #nn1_groups_data = total_data[:len(total_data)/2+1]
    #nn1_groups_data = total_data[0]#list(group_list(total_data[0],1))
    #nn1_groups_label = total_label[0]#list(group_list(total_label[0],1))
    #nn2_groups_data = total_data[1]#list(group_list(total_data[1],1))
    #nn2_groups_label = total_label[1]#list(group_list(total_label[1],1))
    #nn3_groups_data = total_data[2]#list(group_list(total_data[2],1))
    #nn3_groups_label = total_label[2]#list(group_list(total_label[2],1))

    minim = min(min(len(total_data[0]), len(total_data[1])),
                len(total_data[2]))
    #print "length of site one group data " + str(len(nn1_groups_data))
    #nn2_groups_data = total_data[len(total_data)/2:]
    #nn1_groups_label = total_label[:len(total_data)/2+1]
    #nn2_groups_label = total_label[len(total_data)/2:]

    nets = list()  #Our differential networks
    batches = list()  #a list to store every separate site set
    #Lists for our error to be plotted later

    nat = []

    for i in range((minim - minim % 10) - 10, minim - minim % 10, 10):  #
        totlistX1 = []
        totlistY1 = []
        totlistX2 = []
        totlistY2 = []
        totlistX3 = []
        totlistY3 = []
        for item in total_data[0][:i]:
            x = 2
            totlistX1.append(item[0])
            totlistY1.append(item[1])
        for item in total_data[1][:i]:
            x = 2
            totlistX1.append(item[0])
            totlistY1.append(item[1])
        for item in total_data[2][:i]:
            totlistX1.append(item[0])
            totlistY1.append(item[1])
        #print len(totlistX)
        #print len(total_label[0][:i]+total_label[1][:i]+total_label[2][:i])
        #print "y"
        #print [0 for x in total_label[0][:i]]+[1 for x in total_label[1][:i]]+[2 for x in total_label[2][:i]]
        #plt.scatter(totlistX1,totlistY1,c=[0 for x in total_label[0][:i]]+[1 for x in total_label[1][:i]]+[2 for x in total_label[2][:i]])
        #plt.scatter(totlistX2,totlistY2,c=[x + 2 for x in total_label[1][:i]])
        #plt.scatter(totlistX3,totlistY3,c=[x + 4 for x in total_label[2][:i]])
        #plt.show()
        #exit(1)
        #TODO:  Here, we need to rewrite the function so it
        groups_data = []
        groups_label = []
        nets = []
        batches = []
        #nnClassic1 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #nnClassic2 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        for x in range(number_of_nets):
            nets.append(nnDif.nn_build(1, [2, 6, 6, 1], eta=eta,
                                       nonlin=nonlin))
        print number_of_nets
        nextNet = nnDif.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)
        #Build the two site data sets
        #groups_data.append(np.asarray([item for sublist in nn1_groups_data[:i+1] for item in sublist]))
        #groups_data.append(np.asarray([item for sublist in nn2_groups_data[:i+1] for item in sublist]))
        #groups_data.append(np.asarray([item for sublist in nn3_groups_data[:i+1] for item in sublist]))

        #groups_label.append(np.asarray([item for sublist in nn1_groups_label[:i+1] for item in sublist]))
        #groups_label.append(np.asarray([item for sublist in nn2_groups_label[:i+1] for item in sublist]))
        #groups_label.append(np.asarray([item for sublist in nn3_groups_label[:i+1] for item in sublist]))
        #total_groups_data = np.asarray([item for sublist in groups_data for item in sublist])
        #total_groups_label =  np.asarray([item for sublist in groups_label for item in sublist])
        #Our classic combined nn
        #nnClassic3 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #nnClassic4 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)

        #for s in range(number_of_nets):
        #batches.append([x for x in iter_minibatches(2,groups_data[s].T, groups_label[s])])
        #t = [x for x in iter_minibatches(2,groups_data[0].T, groups_label[0])]
        #t2 = [x for x in iter_minibatches(1,groups_data[1].T, groups_label[1])]
        #t3 = [x for x in iter_minibatches(1,groups_data[2].T, groups_label[2])]
        #t4 = [x for x in iter_minibatches(1,total_groups_data.T, total_groups_label)]
        err = []
        #Run the batches through the algos
        iters = 700
        #visitClassicBatches(nnClassic2,nn2_groups_data[:i],nn2_groups_label[:i], it=iters)
        #visitClassicBatches(nnClassic3,nn3_groups_data[:i],nn3_groups_label[:i], it=iters)
        #visitClassicBatches(nnClassic4,t4, it=iters)
        #visitbatches(nets, batches, err, it=iters)
        #print "finish classics"
        #differential_groups = differential_groups + dif_group_data[3*i] +dif_group_data[3*i + 1] + dif_group_data[3*i + 2]
        batchesData1, batchesLabel1 = [
            x for x in iter_minibatches(1, total_data[0], total_label[0])
        ]
        batchesData2, batchesLabel2 = [
            x for x in iter_minibatches(1, total_data[1], total_label[1])
        ]
        batchesData3, batchesLabel3 = [
            x for x in iter_minibatches(1, total_data[2], total_label[2])
        ]
        nnTogetherClassic = nnS.nn_build(1, [2, 6, 6, 1],
                                         eta=eta,
                                         nonlin=nonlin)
        classicWing = nnS.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)
        classicWing2 = nnS.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)
        classicLeft = nnS.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)
        nnTogetherDif = nnDif.nn_build(1, [2, 6, 6, 1], eta=eta, nonlin=nonlin)
        print "LENGTH:   " + str(len(batchesData1[:i]))
        visitClassicBatches(classicWing,
                            batchesData2[:i],
                            batchesLabel2[:i],
                            it=iters)
        #visitClassicBatches(classicWing2,batchesData2[:i],batchesLabel2[:i],it=iters)
        visitClassicBatches(classicLeft,
                            batchesData1[:i],
                            batchesLabel1[:i],
                            it=iters)
        visitClassicBatches(
            nnTogetherClassic,
            batchesData1[:i] + batchesData2[:i] + batchesData3[:i],
            batchesLabel1[:i] + batchesLabel2[:i] + batchesLabel3[:i],
            it=iters)
        #visitClassicBatches(nnClassic1,batchesData1[:i],batchesLabel1[:i], it=iters)
        #visitClassicBatches(nnClassic2,batchesData2[:i],batchesLabel2[:i], it=iters)
        #visitClassicBatches(nnClassic3,batchesData3[:i],batchesLabel3[:i], it=iters)

        plotlistX = []
        plotlistY = []
        plotlistColor = []
        for batch in batchesData1[:i]:
            for tup in batch:
                plotlistX.append(tup[0])
                plotlistY.append(tup[1])
        #for batch in batchesData2[:i]:
        #  for tup in batch:
        #    for sid in tup:
        #      plotlistX.append(sid[0])
        #      plotlistY.append(sid[1])
        #for batch in batchesData3[:i]:
        #  for tup in batch:
        #    x = 2
        #plotlistX.append(tup[0])
        #plotlistY.append(tup[1])
        for arr in batchesLabel1[:i]:
            for tup in arr:
                plotlistColor.append(tup)
        #for arr in batchesLabel2[:i]:
        #  for tup in arr:
        #    plotlistColor.append(tup[0])
        #    plotlistColor.append(tup[0])

        #plt.scatter(plotlistX,plotlistY,c=plotlistColor)
        #+batchesLabel2[:i]+batchesLabel3[:i])

        #plt.show()
        new_total_data = []
        new_total_label = []
        for x in range(i):
            for se in range(len(nets)):
                new_total_data.append(total_data[0][x])
                new_total_data.append(total_data[1][x])
                new_total_data.append(total_data[2][x])
                new_total_label.append(total_label[0][x])
                new_total_label.append(total_label[1][x])
                new_total_label.append(total_label[2][x])
    #differential_labels = differential_labels + dif_group_label[3*i] + dif_group_label[3*i + 1] + dif_group_label[3*i + 2]
    #visitbatches(nets, [nn1_groups_data[:i],nn2_groups_data[:i],nn3_groups_data[:i]], [nn1_groups_label[:i],nn2_groups_label[:i],nn3_groups_label[:i]], err, it=iters)
        batchesList = [batchesData1[:i], batchesData2[:i], batchesData3[:i]]
        labelList = [batchesLabel1[:i], batchesLabel2[:i], batchesLabel3[:i]]

        visitClassicBatches(
            nets[0], [batchesData1[:i], batchesData2[:i], batchesData3[:i]],
            [batchesLabel1[:i], batchesLabel2[:i], batchesLabel3[:i]],
            err,
            it=iters)
        batches2 = [batchesData1[:i] + batchesData2[:i] + batchesData3[:i]]
        list2 = [batchesLabel1[:i] + batchesLabel2[:i] + batchesLabel3[:i]]

        #visitbatches([nets[1]], [batchesData1[:i]], [batchesLabel1[:i]], err, it=iters)
        #visitbatches([nextNet], [batchesData1[:i]+batchesData2[:i]+batchesData3[:i]], [batchesLabel1[:i]+batchesLabel2[:i]+batchesLabel3[:i]], err, it=iters)

        #calculate error
        #nnClassic5 = nnS.nn_build(1,[2,6,6,1],eta=eta,nonlin=nonlin)
        #testAcc = accuracyClassic(nnClassic5,validation_data,validation_label,thr=.05)
        #testAcc2 = accuracy(nnClassic5,validation_data,validation_label,thr=.05)
        togetherAcc = accuracyClassic(nnTogetherClassic,
                                      validation_data,
                                      validation_label,
                                      thr=.05)

        classic = accuracyClassic(classicWing,
                                  validation_data,
                                  validation_label,
                                  thr=0.5)
        #classic2 = accuracyClassic(classicWing2,validation_data,validation_label, thr=0.5)
        classicLeft = accuracyClassic(classicLeft,
                                      validation_data,
                                      validation_label,
                                      thr=0.5)
        one = accuracyClassic(nets[0],
                              validation_data,
                              validation_label,
                              thr=0.5)
        #two = accuracy(nets[1], validation_data,validation_label, thr=0.5)
        #classic2 = accuracyClassic(nnClassic2,validation_data,validation_label, thr=0.5)
        #classic3 = accuracyClassic(nnClassic3,validation_data,validation_label, thr=0.5)
        #classic4 = accuracyClassic(nnClassic4,validation_data,validation_label, thr=0.5)
        #build plottable arrays

        nn1Acc[te][i / 10] = one
        #newAcc = accuracy(nnTogetherDif,validation_data,validation_label,thr=.5)
        print "ACCURACY"
        print one
        print "^^^Decent acc  || total acc"
        print togetherAcc
        print "MIDDLE  " + str(classic)
        print "Left side:  " + str(classicLeft)

        classAcc1[te][i / 10] = classic
        #classAcc2[te][i/10] = classic2
        classAcc3[te][i / 10] = classicLeft
        classAcc4[te][i / 10] = togetherAcc