def build_inputName(Network,target): L = int(np.sqrt(Network.infos['Visible Units'])) dataFileName = 'data/measurements/L' dataFileName += str(L) dataFileName += '/' dataFileName += NET.build_fileName(Network,target) return dataFileName
args.bs, args.CD, args.lr, args.L2, args.T) pathToNetwork = '../' pathToNetwork += NET.build_networkPath(Network) Trained_Network = cPickle.load(open(pathToNetwork)) Network.load(Trained_Network) outputName = '../data/measurements/L' outputName += str(args.L) outputName += '/' outputName += NET.build_fileName(Network,'logZ') outputFile = open(outputName, 'w') outputFile.write('# logZ \n') annealed = Z(n_v,args.hid,args.beta,args.runs) annealed.get_parameters(Network.infos) annealed.get_Z(outputFile) #logZ = np.log(annealed.Z) #print ('\nLog Partition Function: %f' % logZ) #NET.update_logZ(pathToNetwork,Network,logZ,args.K,args.M) #-------------------------------------------------
def build_outputName(Network,target): outputName = 'data/observables/temp/' outputName += NET.build_fileName(Network,'observables') return outputName
n_v = args.L*args.L Network = NET.Network(n_v, args.model, args.hid, args.ep, args.bs, args.CD, args.lr, args.L2, args.T) dataFileName = '../data/measurements/L' dataFileName += str(args.L) dataFileName += '/' dataFileName += NET.build_fileName(Network,args.targ) outputName = '../data/observables/temp/' outputName += NET.build_fileName(Network,'Ising_observables') outputFile = open(outputName,'w') temperatureFile = open('../data/datasets/Ising2d_Temperatures.txt','r') T_array = np.loadtxt(temperatureFile) T = T_array[args.T] dataFile = open(dataFileName,'r') [obs,data] = load_data(dataFile) [avg,err] = observables(obs,data,n_v,T) write_output(outputFile,avg,err,T)