示例#1
0
    dims_dg = [[256, 1024], [256, 1024]]
    lr = [lr_pre, lr_ae, lr_dg, lr_h]
    epochs = [epochs_pre, epochs_total, epochs_h]

    for j in range(num):
        data = Dataset('coil_2views')
        x1, x2, gt = data.load_data()
        x1 = data.normalize(x1, 0)
        x2 = data.normalize(x2, 0)
        X[str(0)], X[str(1)] = x1, x2
        n_clusters = len(set(gt))
        H, gt = model_multi_view(X, gt, para_lambda, dims_ae, dims_dg, act, lr,
                                 epochs, batch_size)

        acc_H_all[j], acc_H_std, nmi_H_all[j], nmi_H_std, RI_H_all[j], RI_std, f1_H_all[j], f1_std = \
            cluster(n_clusters, H, gt, count=1)
        print('clustering h      : acc = {:.4f}, nmi = {:.4f}'.format(
            acc_H_all[j], nmi_H_all[j]))

    acc_mean = np.mean(acc_H_all)
    nmi_mean = np.mean(nmi_H_all)
    acc_std = np.std(acc_H_all)
    nmi_std = np.std(nmi_H_all)

    RI_mean = np.mean(RI_H_all)
    RI_std = np.std(RI_H_all)

    fs_mean = np.mean(f1_H_all)
    fs_std = np.std(f1_H_all)

    arg = [
示例#2
0
def print_result(n_clusters, H, gt, count=10):
    acc_avg,nmi_avg,ari_avg,f1_avg = cluster(n_clusters, H, gt, count=count)
    print('clustering h      : acc = {:.4f}, nmi = {:.4f},ari = {:.4f}, f1 = {:.4f}'.format(acc_avg, nmi_avg,ari_avg, f1_avg))
示例#3
0
    act = [act_ae1, act_ae2, act_dg1, act_dg2]
    dims = [dims_ae1, dims_ae2, dims_dg1, dims_dg2]
    lr = [lr_pre, lr_ae, lr_dg, lr_h]
    epochs = [epochs_pre, epochs_total, epochs_h]

    for j in range(num):
        data = Dataset('ORL_2views')
        x1, x2, gt = data.load_data()
        x1 = data.normalize(x1, 0)
        x2 = data.normalize(x2, 0)
        n_clusters = len(set(gt))
        H, gt = model(x1, x2, gt, para_lambda, dims, act, lr, epochs, batch_size)

        acc_H_all[j], acc_H_std, nmi_H_all[j], nmi_H_std, RI_H_all[j], RI_std, f1_H_all[j], f1_std = cluster(n_clusters,
                                                                                                             H, gt,
                                                                                                             count=1)
        print('clustering h      : acc = {:.4f}, nmi = {:.4f}'.format(acc_H_all[j], nmi_H_all[j]))

    acc_mean = np.mean(acc_H_all)
    nmi_mean = np.mean(nmi_H_all)
    acc_std = np.std(acc_H_all)
    nmi_std = np.std(nmi_H_all)

    RI_mean = np.mean(RI_H_all)
    RI_std = np.std(RI_H_all)

    fs_mean = np.mean(f1_H_all)
    fs_std = np.std(f1_H_all)

    arg = ['lambda', para_lambda, 'batch_size', batch_size, 'lr_pre', lr_pre, 'lr_ae', lr_ae,
示例#4
0
    dims = [dims_ae1, dims_ae2, dims_dg1, dims_dg2]
    lr = [lr_pre, lr_ae, lr_dg, lr_h]
    epochs = [epochs_pre, epochs_total, epochs_h]

    for j in range(num):
        data = Dataset('handwritten_2views')
        x1, x2, gt = data.load_data()
        x1 = data.normalize(x1, 0)
        x2 = data.normalize(x2, 0)
        n_clusters = len(set(gt))
        H, gt = model(x1, x2, gt, para_lambda, dims, act, lr, epochs,
                      batch_size)

        acc_H_all[j], acc_H_std, nmi_H_all[j], nmi_H_std, RI_H_all[
            j], RI_std, f1_H_all[j], f1_std = cluster(n_clusters,
                                                      H,
                                                      gt,
                                                      count=1)
        print('clustering h      : acc = {:.4f}, nmi = {:.4f}'.format(
            acc_H_all[j], nmi_H_all[j]))

    acc_mean = np.mean(acc_H_all)
    nmi_mean = np.mean(nmi_H_all)
    acc_std = np.std(acc_H_all)
    nmi_std = np.std(nmi_H_all)

    RI_mean = np.mean(RI_H_all)
    RI_std = np.std(RI_H_all)

    fs_mean = np.mean(f1_H_all)
    fs_std = np.std(f1_H_all)