Пример #1
0
if __name__ == '__main__':
    print("PIC")
    """ load data """
    # dataset = 'dataset/COIL20_32.txt'    # K=5  v=1
    # dataset = 'dataset/Isolet.txt'    # K=25  v=10
    # dataset = 'dataset/Jaffe.txt'    # K=15  v=10
    # dataset = 'dataset/lung.txt'    # K=15  v=10
    # dataset = 'dataset/mnist.txt'    # K=25  v=1
    # dataset = 'dataset/TOX.txt'    # K=15  v=10
    # dataset = 'dataset/USPS.txt'    # K=20  v=1

    # data = np.loadtxt(dataset)
    # fea = data[:, :-1]
    # labels = data[:, -1]
    # print("dataset = %s    data.shape = %s" % (dataset, fea.shape))
    fea, labels = loadData.load_coil100()  # K=10  v=1

    print("------ Normalizing data ------")
    # fea = tool.data_Normalized(fea)
    Normalizer = MinMaxScaler()
    Normalizer.fit(fea)
    fea = Normalizer.transform(fea)

    print("------ Clustering ------")
    start = time.time()
    # u = 1
    dist = cdist(fea, fea)
    dist = dist - np.diag(np.diag(dist))

    K = 10
    v = 1
Пример #2
0
if __name__ == '__main__':
    print("PK DPC")
    # dataset = 'dataset/COIL20_32.txt'    # K=10
    # dataset = 'dataset/Isolet.txt'    # K=5
    # dataset = 'dataset/Jaffe.txt'    # K=5
    # dataset = 'dataset/lung.txt'    # K=25
    # dataset = 'dataset/mnist.txt'    # K=15
    # dataset = 'dataset/TOX.txt'    # K=10
    # dataset = 'dataset/USPS.txt'    # K=25

    # data = np.loadtxt(dataset)
    # fea = data[:, :-1]
    # labels = data[:, -1]
    # print("dataset = %s    data.shape = %s" % (dataset, fea.shape))

    fea, labels = loadData.load_coil100()
    print("------ Normalizing data ------")
    # fea = tool.data_Normalized(fea)
    Normalizer = MinMaxScaler()
    Normalizer.fit(fea)
    fea = Normalizer.transform(fea)

    print("------ PCA decomposition ------")
    # fea,b,c = tool.PCA.pca(fea, 150)
    pca = PCA(n_components=150)
    fea = pca.fit_transform(fea)
    print("fea.shape =", fea.shape)

    K = 5
    groupNumber = len(np.unique(labels))
Пример #3
0
from sklearn.preprocessing import MinMaxScaler
from tool import tool, measure, loadData
import time

if __name__ == '__main__':
    print("KROD PIC")
    print("------ Loading data ------")
    # data_set = 'dataset/COIL20_32.txt'    # K=20 u=1
    # data_set = 'dataset/mnist.txt'    # K=20 u=1
    # data_set = 'dataset/lung.txt'    # K=10 u=0.1
    # data_set = 'dataset/USPS.txt'    # K=20 u=1
    # data_set = 'dataset/Isolet.txt'    # K=25 u=10
    # data_set = 'dataset/TOX.txt'    # K=20 u=10
    # data_set = 'dataset/Jaffe.txt'    # K=10  u=0.1

    fea, labels = loadData.load_coil100()  # K=25 u=1 v=0.1

    # data = np.loadtxt(data_set)
    # fea = data[:, :-1]
    # labels = data[:, -1]
    # print("data_set = %s    data.shape = %s" % (data_set, fea.shape))

    print("------ Normalizing data ------")
    # tool.data_Normalized(fea)
    Normalizer = MinMaxScaler()
    Normalizer.fit(fea)
    fea = Normalizer.transform(fea)

    # u = 1
    # dist = tool.rank_dis_c(fea, u)
    dist = tool.rank_order_dis(fea)