Ejemplo n.º 1
0
    x = np.zeros((n_data, 64 * 64), dtype=float)
    y = np.zeros((n_data), dtype=int)

    for i, add in enumerate(adds):
        xp = imread(add)
        xp = xp.reshape(-1)
        xp = np.array(xp, dtype=int)
        x[i] = xp
        if 'B' in add:
            y[i] = 0
        else:
            y[i] = 1

    return x, y


X_test, y_test = batch()

add = './res/'
mce.ch_mkdir(add)

if j < 6:
    res = full_test(X_test, X_test, y_test, j, levs, o_list)
    with open(add + dr_name[j] + '_' + str(i) + '.pkl', 'wb') as f:
        pickle.dump(res, f)

else:
    res = sk_check(X_test, X_test, y_test, o_list)
    with open(add + 'sk_' + str(i) + '.pkl', 'wb') as f:
        pickle.dump(res, f)
Ejemplo n.º 2
0
import sys
import numpy as np
import drama as drm
#import matplotlib.pylab as plt
#from matplotlib import gridspec

n_ftrs = 100
noise = 0.8
scl = 0.00
sft = 0.00

i_sig = int(sys.argv[1])
n_train = int(sys.argv[2])
nn = int(sys.argv[3])
dir_add = './' + sys.argv[0][:-3] + '_res/'
drm.ch_mkdir(dir_add)

if os.path.exists(dir_add + str(i_sig) + '_' + str(n_train) + '_' + str(nn) +
                  '.pickle'):
    exit()

x = np.linspace(0, 1, n_ftrs)
X, y = drm.synt_mix(i_sig,
                    n_ftrs,
                    x=x,
                    n_inlier=1000,
                    n_outlier=5,
                    sigma=noise,
                    n1=scl,
                    n2=sft,
                    n3=scl,