示例#1
0
from helpers.DataLoader import DataLoader
from recsom.RecSom import RecSom
from plotting_helpers.plot_utils import *
from helpers.norms import *

dim = 26
rows = 30
cols = 30
metric = euclidean_distance

top_left = np.array((0, 0))
bottom_right = np.array((rows - 1, cols - 1))

lambda_s = metric(top_left, bottom_right) * 0.5

train_data = DataLoader.load_data('random_strings')

for i in range(1):
    model = MergeSom(dim, rows, cols)
    model.train(train_data,
                metric=metric,
                alpha_s=1.0,
                alpha_f=0.05,
                lambda_s=lambda_s,
                lambda_f=1,
                eps=20,
                in3d=False,
                trace=True,
                trace_interval=5,
                sliding_window_size=10,
                log=True,
from helpers.DataLoader import DataLoader
from recsom.RecSom import RecSom
from helpers.norms import *

dimension = 26
number_of_rows = 30
number_of_columns = 30
metric = euclidean_distance

top_left = np.array((0, 0))
bottom_right = np.array((number_of_rows - 1, number_of_columns - 1))

lambda_s = metric(top_left, bottom_right) * 0.5

train_data = DataLoader.load_data('abcd_short')

alpha_values = [x*.01 for x in range(0, 101)]
for alpha in alpha_values:
    log_file_name = 'abs.csv'
    model = RecSom(input_dimension=dimension, rows_count=number_of_rows, columns_count=number_of_columns)

    model.train(train_data, metric=metric, alpha_s=1.0, alpha_f=0.05, lambda_s=lambda_s,
                lambda_f=1, eps=20, in3d=False, trace=False, trace_interval=5, sliding_window_size=10, log=True,
                log_file_name=log_file_name, alpha=alpha)




# print(model.distances_between_adjacent_neurons_horizontal())
# print(model.distances_between_adjacent_neurons_vertical())