idk what changed
parent
f5c79b5bb4
commit
bd9d08b4ea
|
@ -1,5 +1,5 @@
|
|||
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)
|
||||
|
||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||
|
|
19
src/som.cpp
19
src/som.cpp
|
@ -26,11 +26,10 @@
|
|||
|
||||
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,
|
||||
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),
|
||||
topology_function(topology_function)
|
||||
array(file.data_points.begin()->bins.size(), width, height, shape), file(file), max_epochs(max_epochs), dist_func(dist_func),
|
||||
topology_function(topology_function)
|
||||
{
|
||||
for (auto& v : array.get_map())
|
||||
v.randomize(std::random_device{}(), init, normalize, file);
|
||||
|
@ -102,7 +101,8 @@ namespace assign3
|
|||
blt::size_t 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)
|
||||
{
|
||||
|
@ -162,7 +162,8 @@ namespace assign3
|
|||
{
|
||||
min2 = min1;
|
||||
min1 = elem;
|
||||
} else if (elem.second < min2.second)
|
||||
}
|
||||
else if (elem.second < min2.second)
|
||||
min2 = elem;
|
||||
}
|
||||
|
||||
|
@ -188,9 +189,9 @@ namespace assign3
|
|||
for (auto [i, v] : blt::enumerate(array.get_map()))
|
||||
{
|
||||
const auto half = find_closest_neighbour_distance(i) / distance;
|
||||
// auto sigma = std::sqrt(-(half * half) / (2 * std::log(requested_activation)));
|
||||
// auto r = 1 / (2 * sigma * sigma);
|
||||
//
|
||||
// auto sigma = std::sqrt(-(half * half) / (2 * std::log(requested_activation)));
|
||||
// auto r = 1 / (2 * sigma * sigma);
|
||||
//
|
||||
const auto scale = topology_function->scale(half, activation);
|
||||
for (const auto& [is_bad, bins] : file.data_points)
|
||||
{
|
||||
|
@ -273,6 +274,4 @@ namespace assign3
|
|||
topological_errors.push_back(topological_error());
|
||||
quantization_errors.push_back(quantization_error());
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue