Exemplo n.º 1
0
sys.path += ['..']

import numpy as np
import scipy.stats


from graph_labeling import graph_cut, make_neighbourhood
from scipy.spatial import cKDTree

from case_study_bm import setup_case_study_ore

CHECK_VALID = False

if __name__ == "__main__":
    locations,data,min_values,max_values,scale,var_types,targets = setup_case_study_ore()
    seed = 1634120
    
    np.random.seed(seed)
    lambda_value = 0.25
    NC = 3
    target = False
    force = False
    
    file_template = '../results/bm_{set}_swfc_%d.csv'%NC

    best_centroids = np.loadtxt(file_template.format(set='centroids'),delimiter=",")
    best_weights = np.loadtxt(file_template.format(set='weights'),delimiter=",")
    best_u = np.loadtxt(file_template.format(set='u'),delimiter=",")

    clusters = np.argmax(best_u,axis=1) 
Exemplo n.º 2
0
import clusteringlib as cl
import numpy as np
import scipy.stats

import clustering_ga

from scipy.spatial.distance import pdist
from sklearn.cluster import KMeans
from cluster_utils import fix_weights

CHECK_VALID = False

from case_study_bm import attributes, setup_case_study_ore, setup_case_study_all, setup_distances

if __name__ == "__main__":
    locations, data, min_values, max_values, scale, var_types, categories = setup_case_study_ore(
        a=0.999)
    N, ND = data.shape

    print(N, ND)
    #print(min_values)
    #print(max_values)
    #print(scale)

    seed = 1634120

    #targets = np.asfortranarray(np.percentile(data[:,-1], [15,50,85]),dtype=np.float32)
    #var_types[-1] = 2

    #print('targets',targets)

    m = 2.0