idk what changed

main
Brett 2024-11-22 11:14:13 -05:00
parent f5c79b5bb4
commit bd9d08b4ea
2 changed files with 50 additions and 51 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.29) project(COSC-4P80-Assignment-3 VERSION 0.0.30)
include(FetchContent) include(FetchContent)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)

View File

@ -26,7 +26,6 @@
namespace assign3 namespace assign3
{ {
som_t::som_t(const data_file_t& file, blt::size_t width, blt::size_t height, blt::size_t max_epochs, distance_function_t* dist_func, som_t::som_t(const data_file_t& file, blt::size_t width, blt::size_t height, blt::size_t max_epochs, distance_function_t* dist_func,
topology_function_t* topology_function, shape_t shape, init_t init, bool normalize): topology_function_t* topology_function, shape_t shape, init_t init, bool normalize):
array(file.data_points.begin()->bins.size(), width, height, shape), file(file), max_epochs(max_epochs), dist_func(dist_func), array(file.data_points.begin()->bins.size(), width, height, shape), file(file), max_epochs(max_epochs), dist_func(dist_func),
@ -102,7 +101,8 @@ namespace assign3
blt::size_t index; blt::size_t index;
distance_data_t(Scalar data, size_t index): data(data), index(index) distance_data_t(Scalar data, size_t index): data(data), index(index)
{} {
}
inline friend bool operator<(const distance_data_t& a, const distance_data_t& b) inline friend bool operator<(const distance_data_t& a, const distance_data_t& b)
{ {
@ -162,7 +162,8 @@ namespace assign3
{ {
min2 = min1; min2 = min1;
min1 = elem; min1 = elem;
} else if (elem.second < min2.second) }
else if (elem.second < min2.second)
min2 = elem; min2 = elem;
} }
@ -188,9 +189,9 @@ namespace assign3
for (auto [i, v] : blt::enumerate(array.get_map())) for (auto [i, v] : blt::enumerate(array.get_map()))
{ {
const 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);
// //
const auto scale = topology_function->scale(half, activation); const auto scale = topology_function->scale(half, activation);
for (const auto& [is_bad, bins] : file.data_points) for (const auto& [is_bad, bins] : file.data_points)
{ {
@ -273,6 +274,4 @@ namespace assign3
topological_errors.push_back(topological_error()); topological_errors.push_back(topological_error());
quantization_errors.push_back(quantization_error()); quantization_errors.push_back(quantization_error());
} }
} }