np.random.seed(seed + t) idx = np.random.permutation(num) df1 = df.ix[idx[:m1], :] df2 = df.ix[idx[m1:m2], :] # save dirname2 = '%s/result_%02d' % (dirname, t) if not os.path.exists(dirname2): os.mkdir(dirname2) trfile = '%s/%s_train_%02d.csv' % (dirname2, prefix, t) tefile = '%s/%s_test_%02d.csv' % (dirname2, prefix, t) df1.to_csv(trfile, header=None, index=False) df2.to_csv(tefile, header=None, index=False) # demo_R Kmax = 10 restart = 20 njobs = 10 maxitr = 3000 tol = 1e-2 treenum = 100 paper_sub_itr.run(prefix, Kmax, restart, trial, treenum=treenum, modeltype='classification', maxitr=maxitr, tol=tol, njobs=njobs)
for t in range(trial): # data - train np.random.seed(seed + t) Xtr = np.random.rand(num, dim) ytr = np.zeros(num) ytr = np.logical_xor(Xtr[:, 0] > 0.5, Xtr[:, 1] > 0.5) ytr = np.logical_xor(ytr, np.random.rand(num) > b) # data - test Xte = np.random.rand(num, dim) yte = np.zeros(num) yte = np.logical_xor(Xte[:, 0] > 0.5, Xte[:, 1] > 0.5) yte = np.logical_xor(yte, np.random.rand(num) > b) # save dirname2 = '%s/result_%02d' % (dirname, t) if not os.path.exists(dirname2): os.mkdir(dirname2) trfile = '%s/%s_train_%02d.csv' % (dirname2, prefix, t) tefile = '%s/%s_test_%02d.csv' % (dirname2, prefix, t) np.savetxt(trfile, np.c_[Xtr, ytr], delimiter=',') np.savetxt(tefile, np.c_[Xte, yte], delimiter=',') # demo_R Kmax = 10 restart = 20 njobs = 4 treenum = 100 paper_sub_itr.run(prefix, Kmax, restart, trial, treenum=treenum, modeltype='classification', njobs=njobs, rftype='SL')
os.mkdir(dirname) for t in range(trial): # data - train & test np.random.seed(seed + t) idx = np.random.permutation(num) df1 = df.iloc[idx[:m1], :] df2 = df.iloc[idx[m1:m2], :] # save dirname2 = '%s/result_%02d' % (dirname, t) if not os.path.exists(dirname2): os.mkdir(dirname2) trfile = '%s/%s_train_%02d.csv' % (dirname2, prefix, t) tefile = '%s/%s_test_%02d.csv' % (dirname2, prefix, t) df1.to_csv(trfile, header=None, index=False) df2.to_csv(tefile, header=None, index=False) # demo_R Kmax = 10 restart = 200 njobs = 4 treenum = 100 paper_sub_itr.run(prefix, Kmax, restart, trial, treenum=treenum, modeltype='regression', njobs=njobs)
if not os.path.exists('./result/'): os.mkdir('./result/') dirname = './result/result_%s_itr' % (prefix,) if not os.path.exists(dirname): os.mkdir(dirname) for t in range(trial): # data - train & test np.random.seed(seed + t) idx = np.random.permutation(num) df1 = df.ix[idx[:m1], :] df2 = df.ix[idx[m1:m2], :] # save dirname2 = '%s/result_%02d' % (dirname, t) if not os.path.exists(dirname2): os.mkdir(dirname2) trfile = '%s/%s_train_%02d.csv' % (dirname2, prefix, t) tefile = '%s/%s_test_%02d.csv' % (dirname2, prefix, t) df1.to_csv(trfile, header=None, index=False) df2.to_csv(tefile, header=None, index=False) # demo_R Kmax = 10 restart = 20 njobs = 10 maxitr = 3000 tol = 1e-2 treenum = 100 paper_sub_itr.run(prefix, Kmax, restart, trial, treenum=treenum, modeltype='classification', maxitr=maxitr, tol=tol, njobs=njobs)
# data if not os.path.exists('./result/'): os.mkdir('./result/') dirname = './result/result_%s_itr' % (prefix,) if not os.path.exists(dirname): os.mkdir(dirname) for t in range(trial): # data - train & test np.random.seed(seed + t) idx = np.random.permutation(num) df1 = df.ix[idx[:m1], :] df2 = df.ix[idx[m1:m2], :] # save dirname2 = '%s/result_%02d' % (dirname, t) if not os.path.exists(dirname2): os.mkdir(dirname2) trfile = '%s/%s_train_%02d.csv' % (dirname2, prefix, t) tefile = '%s/%s_test_%02d.csv' % (dirname2, prefix, t) df1.to_csv(trfile, header=None, index=False) df2.to_csv(tefile, header=None, index=False) # demo_R Kmax = 10 restart = 200 njobs = 10 treenum = 100 paper_sub_itr.run(prefix, Kmax, restart, trial, treenum=treenum, modeltype='regression', njobs=njobs)