Ejemplo n.º 1
0
    n_nfeat = ndatas.size(2)

    ndatas = scaleEachUnitaryDatas(ndatas)

    # trans-mean-sub

    ndatas = centerDatas(ndatas)

    print("size of the datas...", ndatas.size())

    # switch to cuda
    ndatas = ndatas.cuda()
    labels = labels.cuda()

    #MAP
    lam = 10
    model = GaussianModel(n_ways, lam)
    model.initFromLabelledDatas()

    alpha = 0.2
    optim = MAP(alpha)

    optim.verbose = False
    optim.progressBar = True

    acc_test = optim.loop(model, n_epochs=20)

    print(
        "final accuracy found {:0.2f} +- {:0.2f}".format(*(100 * x
                                                           for x in acc_test)))
Ejemplo n.º 2
0
    ndatas = QRreduction(ndatas)
    n_nfeat = ndatas.size(2)
    
    ndatas = scaleEachUnitaryDatas(ndatas)

    # trans-mean-sub
   
    ndatas = centerDatas(ndatas)
    
    print("size of the datas...", ndatas.size())

    # switch to cuda
    ndatas = ndatas.cuda()
    labels = labels.cuda()
    
    #MAP
    lam = LAMBDA
    model = GaussianModel(n_ways, lam)
    model.initFromLabelledDatas()
    
    alpha = ALPHA
    optim = MAP(alpha)

    optim.verbose=False
    optim.progressBar=True

    acc_test = optim.loop(model, n_epochs=N_STEPS)
    
    print("final accuracy found {:0.2f} +- {:0.2f}".format(*(100*x for x in acc_test)))