main
Brett 2024-11-21 13:30:33 -05:00
parent e3dd3d3005
commit c83208419d
2 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(COSC-4P80-Assignment-3 VERSION 0.0.27) project(COSC-4P80-Assignment-3 VERSION 0.0.28)
include(FetchContent) include(FetchContent)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)

View File

@ -167,7 +167,7 @@ namespace assign3
} }
// we can assert the neurons are neighbours if the distance between the BMUs and the nearest neighbour are equal. // we can assert the neurons are neighbours if the distance between the BMUs and the nearest neighbour are equal.
auto min_distances = neuron_t::distance(dist_func, array.get_map()[min1.first], array.get_map()[min2.first]); const auto min_distances = neuron_t::distance(dist_func, array.get_map()[min1.first], array.get_map()[min2.first]);
auto neighbour_distances = find_closest_neighbour_distance(min1.first); auto neighbour_distances = find_closest_neighbour_distance(min1.first);
if (!blt::f_equal(min_distances, neighbour_distances)) if (!blt::f_equal(min_distances, neighbour_distances))
@ -187,15 +187,15 @@ namespace assign3
for (auto [i, v] : blt::enumerate(array.get_map())) for (auto [i, v] : blt::enumerate(array.get_map()))
{ {
auto half = find_closest_neighbour_distance(i) / distance; const auto half = find_closest_neighbour_distance(i) / distance;
// auto sigma = std::sqrt(-(half * half) / (2 * std::log(requested_activation))); // auto sigma = std::sqrt(-(half * half) / (2 * std::log(requested_activation)));
// auto r = 1 / (2 * sigma * sigma); // auto r = 1 / (2 * sigma * sigma);
// //
auto scale = topology_function->scale(half, activation); const auto scale = topology_function->scale(half, activation);
for (const auto& data : file.data_points) for (const auto& [is_bad, bins] : file.data_points)
{ {
auto ds = topology_function->call(v.dist(data.bins), scale); const auto ds = topology_function->call(v.dist(bins), scale);
if (data.is_bad) if (is_bad)
v.activate(-ds); v.activate(-ds);
else else
v.activate(ds); v.activate(ds);