gemseo / third_party

Show inherited members

sompy module

Self Organizing Maps

class gemseo.third_party.sompy.SOM(name, Data, mapsize=None, norm_method='var', initmethod='pca', neigh='Guassian')[source]

Bases: object

name and data, neigh== Bubble or Guassian

Parameters:
  • name (str)

  • mapsize (int | None)

  • norm_method (str) –

    By default it is set to “var”.

  • initmethod (str) –

    By default it is set to “pca”.

  • neigh (str) –

    By default it is set to “Guassian”.

calc_map_dist()[source]
Return type:

None

cluster(method='Kmeans', n_clusters=8)[source]
Parameters:
  • method (str) –

    Default value = ‘Kmeans’)

    By default it is set to “Kmeans”.

  • n_clusters (int) –

    Default value = 8)

    By default it is set to 8.

find_K_nodes(data, K=5)[source]
Parameters:
  • data – param K: (Default value = 5)

  • K (int) –

    (Default value = 5)

    By default it is set to 5.

hit_map(data=None)[source]
Parameters:

data – Default value = None)

Return type:

None

hit_map_cluster_number(data=None)[source]
Parameters:

data – Default value = None)

ind_to_xy(bm_ind)[source]
Parameters:

bm_ind

init_map()[source]
Return type:

None

node_Activation(data, wt='distance', Target=None)[source]

‘uniform’

Parameters:
  • data – param wt: (Default value = ‘distance’)

  • Target – Default value = None)

  • wt (str) –

    (Default value = ‘distance’)

    By default it is set to “distance”.

para_bmu_find(x, y, njb=1)[source]
Parameters:
  • x – param y:

  • njb (int) –

    Default value = 1)

    By default it is set to 1.

  • y

predict(X_test, K=5, wt='distance')[source]

‘uniform’

Parameters:
  • X_test – param K: (Default value = 5)

  • wt (str) –

    Default value = ‘distance’)

    By default it is set to “distance”.

  • K (int) –

    (Default value = 5)

    By default it is set to 5.

predict_Probability(data, Target, K=5)[source]
Parameters:
  • data – param Target:

  • K (int) –

    Default value = 5)

    By default it is set to 5.

  • Target

predict_by(data, Target, K=5, wt='distance')[source]

‘uniform’

Parameters:
  • data – param Target:

  • K (int) –

    Default value = 5)

    By default it is set to 5.

  • wt (str) –

    Default value = ‘distance’)

    By default it is set to “distance”.

  • Target

project_data(data)[source]
Parameters:

data

set_algorithm(initmethod='pca', algtype='batch', neighborhoodmethod='gaussian', alfatype='inv', alfaini=0.5, alfafinal=0.005)[source]

initmethod = [‘random’, ‘pca’] algos = [‘seq’,’batch’] all_neigh = [‘gaussian’,’manhatan’,’bubble’,’cut_gaussian’,’epanechicov’ ] alfa_types = [‘linear’,’inv’,’power’]

Parameters:
  • initmethod (str) –

    Default value = ‘pca’)

    By default it is set to “pca”.

  • algtype (str) –

    Default value = ‘batch’)

    By default it is set to “batch”.

  • neighborhoodmethod (str) –

    Default value = ‘gaussian’)

    By default it is set to “gaussian”.

  • alfatype (str) –

    Default value = ‘inv’)

    By default it is set to “inv”.

  • alfaini (float) –

    Default value = .5)

    By default it is set to 0.5.

  • alfafinal (float) –

    Default value = .005)

    By default it is set to 0.005.

Return type:

None

set_data_labels(dlabel=None)[source]
Parameters:

dlabel (str | None) – Default value = None)

Return type:

None

set_topology(mapsize=None, mapshape='planar', lattice='rect', mask=None, compname=None)[source]

all_mapshapes = [‘planar’,’toroid’,’cylinder’] all_lattices = [‘hexa’,’rect’]

Parameters:
  • mapsize (int | None) – Default value = None)

  • mapshape (str) –

    Default value = ‘planar’)

    By default it is set to “planar”.

  • lattice (str) –

    Default value = ‘rect’)

    By default it is set to “rect”.

  • mask – Default value = None)

  • compname (str | None) – Default value = None)

Return type:

None

train(trainlen=None, n_job=1, shared_memory='no', verbose='on')[source]
Parameters:
  • trainlen – Default value = None)

  • n_job (int) –

    Default value = 1)

    By default it is set to 1.

  • shared_memory (str) –

    Default value = ‘no’)

    By default it is set to “no”.

  • verbose (str) –

    Default value = ‘on’)

    By default it is set to “on”.

Return type:

None

update_codebook_voronoi(training_data, bmu, H, radius)[source]
Parameters:
  • training_data – param bmu:

  • H – param radius:

  • bmu

  • radius (float)

view_map(what='codebook', which_dim='all', pack='Yes', text_size=2.8, save='No', save_dir='empty', grid='No', text='Yes', cmap='None', COL_SiZe=6)[source]
Parameters:
  • what (str) –

    Default value = ‘codebook’)

    By default it is set to “codebook”.

  • which_dim (str) –

    Default value = ‘all’)

    By default it is set to “all”.

  • pack (str) –

    Default value = ‘Yes’)

    By default it is set to “Yes”.

  • text_size (float) –

    Default value = 2.8)

    By default it is set to 2.8.

  • save (str) –

    Default value = ‘No’)

    By default it is set to “No”.

  • save_dir (str) –

    Default value = ‘empty’)

    By default it is set to “empty”.

  • grid (str) –

    Default value = ‘No’)

    By default it is set to “No”.

  • text (str) –

    Default value = ‘Yes’)

    By default it is set to “Yes”.

  • cmap (str) –

    Default value = ‘None’)

    By default it is set to “None”.

  • COL_SiZe (int) –

    Default value = 6)

    By default it is set to 6.

Return type:

None

gemseo.third_party.sompy.batchtrain(self, njob=1, phase=None, shared_memory='no', verbose='on')[source]
Parameters:
  • njob (int) –

    Default value = 1)

    By default it is set to 1.

  • phase – Default value = None)

  • shared_memory (str) –

    Default value = ‘no’)

    By default it is set to “no”.

  • verbose (str) –

    Default value = ‘on’)

    By default it is set to “on”.

Return type:

None

gemseo.third_party.sompy.chunk_based_bmu_find(self, x, y, y_2)[source]
Parameters:
  • x – param y:

  • y_2

  • y

gemseo.third_party.sompy.denormalize_by(data_by, n_vect, n_method='var')[source]
Parameters:
  • data_by – param n_vect:

  • n_method (str) –

    Default value = ‘var’)

    By default it is set to “var”.

  • n_vect

gemseo.third_party.sompy.grid_dist(self, bmu_ind)[source]

som and bmu_ind depending on the lattice “hexa” or “rect” we have different grid distance functions. bmu_ind is a number between 0 and number of nodes-1. depending on the map size bmu_coord will be calculated and then distance matrix in the map will be returned

Parameters:

bmu_ind

gemseo.third_party.sompy.l(a, b)[source]
Parameters:
  • a – param b:

  • b

gemseo.third_party.sompy.lininit(self)[source]
gemseo.third_party.sompy.normalize(data, method='var')[source]
Parameters:
  • data – param method: (Default value = ‘var’)

  • method (str) –

    (Default value = ‘var’)

    By default it is set to “var”.

gemseo.third_party.sompy.normalize_by(data_raw, data, method='var')[source]
Parameters:
  • data_raw – param data:

  • method (str) –

    Default value = ‘var’)

    By default it is set to “var”.

  • data

gemseo.third_party.sompy.rect_dist(self, bmu)[source]
Parameters:

bmu

gemseo.third_party.sompy.view_1d(self, text_size, which_dim='all', what='codebook')[source]
Parameters:
  • text_size (int) – param which_dim: (Default value = ‘all’)

  • what (str) –

    Default value = ‘codebook’)

    By default it is set to “codebook”.

  • which_dim (str) –

    (Default value = ‘all’)

    By default it is set to “all”.

Return type:

None

gemseo.third_party.sompy.view_2d(self, text_size, which_dim='all', what='codebook')[source]
Parameters:
  • text_size (int) – param which_dim: (Default value = ‘all’)

  • what (str) –

    Default value = ‘codebook’)

    By default it is set to “codebook”.

  • which_dim (str) –

    (Default value = ‘all’)

    By default it is set to “all”.

Return type:

None

gemseo.third_party.sompy.view_2d_Pack(self, text_size, which_dim='all', what='codebook', save='No', grid='Yes', save_dir='empty', text='Yes', CMAP='None', col_sz=None)[source]
Parameters:
  • text_size (int) – param which_dim: (Default value = ‘all’)

  • what (str) –

    Default value = ‘codebook’)

    By default it is set to “codebook”.

  • save (str) –

    Default value = ‘No’)

    By default it is set to “No”.

  • grid (str) –

    Default value = ‘Yes’)

    By default it is set to “Yes”.

  • save_dir (str) –

    Default value = ‘empty’)

    By default it is set to “empty”.

  • text (str) –

    Default value = ‘Yes’)

    By default it is set to “Yes”.

  • CMAP (str) –

    Default value = ‘None’)

    By default it is set to “None”.

  • col_sz – Default value = None)

  • which_dim (str) –

    (Default value = ‘all’)

    By default it is set to “all”.

Return type:

None