Exemple #1
0
def main(datafile):
    _, _, _, x, y = mlmusings.io.load_arff(datafile)
    print('3-nearest-neighbor accuracy on original data: %.4f' % nn.nn_acc(nn.nns(x, 3), y))
    print('KernelPCA...')
    kpcasum(x, y)
Exemple #2
0
def kpcasum(x, y, sigmas=[1E-9, 1E-6, 1E-3, 1, 1E3, 1E6, 1E9]):
    for sigma in sigmas:
        kpcax = dr.kpca(x, sigma=sigma)[0]
        acc = nn.nn_acc(nn.nns(kpcax, 3), y)
        vr = nn.vizrank(kpcax, y)[0]
        print('sigma=%G,acc=%.4f,vr(%d,%d)=%.4f' % (sigma, acc, vr[1], vr[2], vr[0]))