예제 #1
0
def test_nn():
    p = 2
    n = 1000
    samples, cov = network.nn_network(p, n)

    x = samples[:,0]
    y = samples[:,1]
    plot(x, y, 'o')
    show()
예제 #2
0
파일: lasso.py 프로젝트: pyongjoo/stat608
def nn_lasso(r = 20):
    fps = np.zeros(r)
    fns = np.zeros(r)
    norms = np.zeros(r)

    for i in range(r):
        samples, cov = network.nn_network()
        t = 1e-1
        fpr, fnr, fnorm = estimate_data(samples, cov, t)

        fps[i] = fpr
        fns[i] = fnr
        norms[i] = fnorm

    return fps.mean(), fns.mean(), norms.mean()
예제 #3
0
                default="vgg13",
                type=str)
ap.add_argument('--hidden_units',
                type=int,
                dest="hidden_units",
                action="store",
                default=120)

pa = ap.parse_args()
where = pa.data_dir
path = pa.save_dir
lr = pa.learning_rate
structure = pa.arch
dropout = pa.dropout
hidden_layer1 = pa.hidden_units
power = pa.gpu
epochs = pa.epochs

trainloader, v_loader, testloader, train_data = network.load_data(where)

model, optimizer, criterion = network.nn_network(structure, dropout,
                                                 hidden_layer1, lr, power)

network.train_network(model, optimizer, criterion, trainloader, v_loader,
                      epochs, 20, power)

network.save_checkpoint(model, train_data, path, structure, hidden_layer1,
                        dropout, lr)

print("All Set and Done. The Model is trained")