diff --git a/.idea/workspace (conflicted copy 2024-11-20 204137).xml b/.idea/workspace (conflicted copy 2024-11-20 204137).xml deleted file mode 100644 index 9be7327..0000000 --- a/.idea/workspace (conflicted copy 2024-11-20 204137).xml +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - - - { - "useNewFormat": true -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - "associatedIndex": 7 -} - - - - { - "keyToString": { - "CMake Application.Assign3 Tests.executor": "Run", - "CMake Application.COSC-4P80-Assignment-3.executor": "Run", - "NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix", - "NIXITCH_NIX_CONF_DIR": "", - "NIXITCH_NIX_OTHER_STORES": "", - "NIXITCH_NIX_PATH": "/home/brett/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels", - "NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/brett /home/brett/.local/state/nix/profile /nix/profile /home/brett/.nix-profile", - "NIXITCH_NIX_REMOTE": "", - "NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/brett", - "RunOnceActivity.RadMigrateCodeStyle": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "RunOnceActivity.cidr.known.project.marker": "true", - "RunOnceActivity.readMode.enableVisualFormatting": "true", - "RunOnceActivity.west.config.association.type.startup.service": "true", - "SHARE_PROJECT_CONFIGURATION_FILES": "true", - "cf.advertisement.text.has.clang-format": "true", - "cf.first.check.clang-format": "false", - "cidr.known.project.marker": "true", - "git-widget-placeholder": "main", - "last_opened_file_path": "/home/brett/Documents/Brock/CS 4P80/COSC-4P80-Assignment-3", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "run.code.analysis.last.selected.profile": "pProject Default", - "settings.editor.selected.configurable": "advanced.settings", - "structure.view.defaults.are.configured": "true", - "vue.rearranger.settings.migration": "true" - } -} - - - - - - - - - PYTHONTEX - - - - - - - - PDFLATEX - - - OKULAR - - - - - - {projectDir}/out - {projectDir}/auxil - false - PDF - TEXLIVE - false - [] - [] - - - - - - MAKEINDEX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1730483030448 - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build_emscripten.sh b/build_emscripten.sh old mode 100755 new mode 100644 diff --git a/src/som.cpp b/src/som.cpp index 3cdc8ca..a8dfb0e 100644 --- a/src/som.cpp +++ b/src/som.cpp @@ -47,15 +47,15 @@ namespace assign3 for (auto& current_data : file.data_points) { - auto v0_idx = get_closest_neuron(current_data.bins); - auto v0 = array.get_map()[v0_idx]; - v0.update(current_data.bins, 1, eta); + const auto v0_idx = get_closest_neuron(current_data.bins); + auto& v0 = array.get_map()[v0_idx]; + v0.update(current_data.bins, v0.dist(current_data.bins), eta); // find the closest neighbour neuron to v0 - auto distance_min = find_closest_neighbour_distance(v0_idx); + const auto distance_min = find_closest_neighbour_distance(v0_idx); // this will find the required scaling factor to make a point in the middle between v0 and its closest neighbour activate 50% // from the perspective of the gaussian function - auto scale = topology_function->scale(distance_min * 0.5f, 0.5); + const auto scale = topology_function->scale(distance_min * 0.5f, 0.5); for (auto [i, n] : blt::enumerate(array.get_map())) { @@ -204,7 +204,7 @@ namespace assign3 min = std::min(min, v.get_activation()); max = std::max(max, v.get_activation()); } - + for (auto& n : array.get_map()) n.set_activation(2 * (n.get_activation() - min) / (max - min) - 1); }