def __init__(self, inputdim, outputdim, hidden_unit_lim, rng): self.inputdim = inputdim self.outputdim = outputdim #self.inputarr=inputarr #self explanatory self.hidden_unit_lim = hidden_unit_lim self.rng = rng rest_set, test_set = pimadataf.give_data() self.restx = rest_set[0] resty = rest_set[1] self.testx = test_set[0] testy = test_set[1] self.resty = np.ravel(resty) self.testy = np.ravel(testy) self.rest_setx = tf.Variable(initial_value=self.restx, name='rest_setx', dtype=tf.float32) self.rest_sety = tf.Variable(initial_value=self.resty, name='rest_sety', dtype=tf.int32) self.test_setx = tf.Variable(initial_value=self.testx, name='rest_sety', dtype=tf.float32) self.test_sety = tf.Variable(initial_value=self.testy, name='test_sety', dtype=tf.int32) #self.inputarr = inputarr self.inputarr = self.restx
def __init__(self, max_no_of_hidden_units, dimtup, size=5, limittup=(-1, 1)): self.size = size self.max_no_of_hidden_units = max_no_of_hidden_units self.dimtup = dimtup self.list_chromo = self.aux_pop(size, limittup) #a numpy array self.fits_pops = [] rest_set, test_set = pimadataf.give_data( ) #one time thing #RTC required here self.trainx = rest_set[0] self.trainy = rest_set[1] #print("hmm",self.trainy) self.testx = test_set[0] self.testy = test_set[1] self.net_err = network.Neterr(inputdim=self.dimtup[0], outputdim=self.dimtup[1], arr_of_net=self.list_chromo, trainx=self.trainx, trainy=self.trainy, testx=self.testx, testy=self.testy)
def __init__(self,rng, max_hidden_units, size=50, limittup=(-1,1)): self.dimtup = pimadataf.get_dimension() rest_set, test_set = pimadataf.give_data() tup = pimadataf.give_datainshared() self.rng=rng self.size = size self.max_hidden_units = max_hidden_units self.list_chromo = self.aux_pop(size, limittup) #a numpy array self.fits_pops = [] self.trainx = rest_set[0] self.trainy = rest_set[1] self.testx = test_set[0] self.testy = test_set[1] self.strainx, self.strainy = tup[0] self.stestx, self.stesty = tup[1] self.net_err = Network.Neterr(inputdim=self.dimtup[0], outputdim=self.dimtup[1], arr_of_net=self.list_chromo, trainx=self.trainx, trainy=self.trainy, testx=self.testx, testy=self.testy,strainx=self.strainx, strainy=self.strainy, stestx=self.stestx, stesty=self.stesty) self.net_dict={} #dictionary of networks for back-propagation, one for each n_hid
def __init__(self,rng, max_hidden_units, size=5, limittup=(-1,1)): self.dimtup = pimadataf.get_dimension() rest_set, test_set = pimadataf.give_data() restx=rest_set[0] resty=rest_set[1] testx=test_set[0] testy=test_set[1] resty=np.ravel(resty) testy=np.ravel(testy) self.rng=rng self.size = size self.max_hidden_units = max_hidden_units self.list_chromo = self.aux_pop(size, limittup) #a numpy array self.fits_pops = [] restn=538 #a flaw here ,one has to know no. of datapoints in both set before opening it(inside program) testn=230 print("here you",rest_set[1].shape) self.rest_setx=tf.Variable(initial_value=np.zeros((restn,self.dimtup[0])),name='rest_setx',dtype=tf.float64) self.rest_sety=tf.Variable(initial_value=np.zeros((restn,)),name='rest_sety',dtype=tf.int32) self.test_setx=tf.Variable(initial_value=np.zeros((testn,self.dimtup[0])),name='rest_sety',dtype=tf.float64) self.test_sety=tf.Variable(initial_value=np.zeros((testn,)),name='test_sety',dtype=tf.int32) if not os.path.isfile('/home/robita/forgit/neuro-evolution/05/state/tf/indep_pima/input/model.ckpt.meta'): rxn=self.rest_setx.assign(restx) ryn=self.rest_sety.assign(resty) txn=self.test_setx.assign(testx) tyn=self.test_sety.assign(testy) var_lis=[self.rest_setx,self.rest_sety,self.test_setx,self.test_sety] nodelis=[rxn,ryn,txn,tyn] savo=tf.train.Saver(var_list=var_lis) with tf.Session() as sess: sess.run([i for i in nodelis]) print("saving checkpoint") save_path = savo.save(sess, "/home/robita/forgit/neuro-evolution/05/state/tf/indep_pima/input/model.ckpt") self.net_err = Network.Neterr(inputdim=self.dimtup[0], outputdim=self.dimtup[1], arr_of_net=self.list_chromo,rest_setx=self.rest_setx,rest_sety=self.rest_sety,test_setx=self.test_setx,test_sety=self.test_sety,rng=self.rng) self.net_dict={} #dictionary of networks for back-propagation, one for each n_hid