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-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 309514d..63552dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,6 +2,10 @@
+
+
+
+
diff --git a/.idea/workspace (conflicted copy 2024-11-20 204137).xml b/.idea/workspace (conflicted copy 2024-11-20 204137).xml
new file mode 100644
index 0000000..9be7327
--- /dev/null
+++ b/.idea/workspace (conflicted copy 2024-11-20 204137).xml
@@ -0,0 +1,278 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "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
+
+
+ 1730483030448
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace (conflicted copy 2024-11-20 214622).xml b/.idea/workspace (conflicted copy 2024-11-20 214622).xml
new file mode 100644
index 0000000..8081792
--- /dev/null
+++ b/.idea/workspace (conflicted copy 2024-11-20 214622).xml
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "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": "editor.preferences.inline.completion",
+ "structure.view.defaults.are.configured": "true",
+ "vue.rearranger.settings.migration": "true"
+ }
+}
+
+
+
+
+
+
+
+
+ PYTHONTEX
+
+
+
+
+
+
+
+ PDFLATEX
+
+
+ OKULAR
+
+
+
+
+
+ {projectDir}/out
+ {projectDir}/auxil
+ false
+ PDF
+ TEXLIVE
+ false
+ []
+ []
+
+
+
+
+
+ MAKEINDEX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1730483030448
+
+
+ 1730483030448
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 227a303..fad41fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
-project(COSC-4P80-Assignment-3 VERSION 0.0.26)
+project(COSC-4P80-Assignment-3 VERSION 0.0.27)
include(FetchContent)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
diff --git a/build_emscripten.sh b/build_emscripten.sh
old mode 100644
new mode 100755
diff --git a/default.nix b/default.nix
index 1c2c439..8259cac 100644
--- a/default.nix
+++ b/default.nix
@@ -1,6 +1,9 @@
{ pkgs ? (import {
config.allowUnfree = true;
config.segger-jlink.acceptLicense = true;
+}), customPkgs ? (import /home/brett/my-nixpkgs {
+ config.allowUnfree = true;
+ config.segger-jlink.acceptLicense = true;
}), ... }:
pkgs.mkShell
{
@@ -10,7 +13,8 @@ pkgs.mkShell
clang
emscripten
ninja
- jetbrains.clion
+ customPkgs.jetbrains.clion
+ #clion = import ~/my-nixpkgs/pkgs/applications/editors/jetbrains {};
renderdoc
valgrind
];
diff --git a/lib/blt-with-graphics b/lib/blt-with-graphics
index 3610837..29286e6 160000
--- a/lib/blt-with-graphics
+++ b/lib/blt-with-graphics
@@ -1 +1 @@
-Subproject commit 361083780325a2a73c9467320dcd5c7ced51e754
+Subproject commit 29286e66daa724ef08692d9a65e9c88e5467d9b2
diff --git a/plot_heatmap.py b/plot_heatmap.py
index 7d53964..01c4fd9 100644
--- a/plot_heatmap.py
+++ b/plot_heatmap.py
@@ -23,11 +23,12 @@ plt.yticks(np.arange(height), np.arange(height))
plt.xlabel('X Pos')
plt.ylabel('Y Pos')
-plt.suptitle('Heatmap of Motor Data (Bins: {})'.format(size))
-plt.title(subtitle)
+plt.suptitle('Heatmap of Motor Data (Bins: {})'.format(size), fontsize=16)
+plt.title(subtitle, fontsize=11)
plt.gca().invert_yaxis()
-plt.colorbar()
+cbar = plt.colorbar()
+cbar.ax.set_ylabel("Bad (Red) / Good (Blue)", fontsize=10)
-plt.savefig("heatmap.png")
+plt.savefig("heatmap{}.png".format(size))
diff --git a/plot_line_graph.py b/plot_line_graph.py
index dc3aaee..c0cfa97 100644
--- a/plot_line_graph.py
+++ b/plot_line_graph.py
@@ -15,16 +15,6 @@ else:
subtitle1 = ""
subtitle2 = ""
-print(file1)
-print(file2)
-dir_path = os.path.dirname(os.path.realpath(__file__))
-cwd = os.getcwd()
-print(dir_path)
-print(cwd)
-
-with open(file1, "r+") as f:
- print(f.name)
-
df1 = pd.read_csv(file1)
df2 = pd.read_csv(file2)
@@ -62,8 +52,8 @@ else:
plt.tick_params(axis='y', labelcolor='b')
plt.ylim(0, 1)
- plt.suptitle("Topological Error (Bins: {})".format(bins))
- plt.title(subtitle1)
+ plt.suptitle("Topological Error (Bins: {})".format(bins), fontsize=16)
+ plt.title(subtitle1, fontsize=11)
plt.savefig("errors-topological{}.png".format(bins))
@@ -73,8 +63,8 @@ else:
plt.tick_params(axis='y', labelcolor='b')
plt.ylim(y_min, y_max)
- plt.suptitle("Quantization Error (Bins: {})".format(bins))
- plt.title(subtitle2)
+ plt.suptitle("Quantization Error (Bins: {})".format(bins), fontsize=16)
+ plt.title(subtitle2, fontsize=11)
plt.savefig("errors-quantization{}.png".format(bins))
diff --git a/src/main.cpp b/src/main.cpp
index cf63636..7426b99 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -12,24 +12,29 @@
#include
#include
-void plot_heatmap(const std::string& activations_csv, const blt::size_t bin_size, const std::string& subtitle)
+void plot_heatmap(const std::string& path, const std::string& activations_csv, const blt::size_t bin_size, const std::string& subtitle)
{
#ifdef __linux__
- const auto path = std::filesystem::current_path().string();
- const std::string command = "cd '" + path + "' && python3 ../plot_heatmap.py '" + activations_csv + "' '" + std::to_string(bin_size) + "' '" +
- subtitle + "'";
+ auto pwd = std::filesystem::current_path().string();
+ if (!blt::string::ends_with(pwd, '/'))
+ pwd += '/';
+ const std::string command = "cd '" + path + "' && python3 '" + pwd + "../plot_heatmap.py' '" + activations_csv + "' '" + std::to_string(bin_size)
+ +
+ "' '" + subtitle + "'";
BLT_TRACE(command);
std::system(command.c_str());
#endif
}
-void plot_line_graph(const std::string& topological_csv, const std::string& quantization_csv, blt::size_t bin_size,
+void plot_line_graph(const std::string& path, const std::string& topological_csv, const std::string& quantization_csv, blt::size_t bin_size,
const std::string& subtitle, const std::string& subtitle2)
{
#ifdef __linux__
- const auto path = std::filesystem::current_path().string();
- const std::string command = "cd '" + path + "' && python3 ../plot_line_graph.py \"" + topological_csv + "\" \"" + quantization_csv + "\" " +
- std::to_string(bin_size) + " true \"" + subtitle + "\" \"" + subtitle2 + "\"";
+ auto pwd = std::filesystem::current_path().string();
+ if (!blt::string::ends_with(pwd, '/'))
+ pwd += '/';
+ const std::string command = "cd '" + path + "' && python3 '" + pwd + "../plot_line_graph.py' \"" + topological_csv + "\" \"" + quantization_csv +
+ "\" " + std::to_string(bin_size) + " true \"" + subtitle + "\" \"" + subtitle2 + "\"";
BLT_TRACE(command);
std::system(command.c_str());
#endif
@@ -140,7 +145,20 @@ void action_test(const std::vector& argv_vector)
std::vector threads;
std::mutex task_mutex;
- tasks.emplace_back(&data.files[1], 5, 5, 1000, shape_t::GRID, init_t::RANDOM_DATA, 0.1);
+ for (auto& file : data.files)
+ {
+ for (blt::u32 size = 5; size <= 7; size++)
+ {
+ for (int shape = 0; shape < 4; shape++)
+ {
+ for (int init = 0; init < 3; init++)
+ {
+ tasks.emplace_back(&file, size, size, 2000, static_cast(shape), static_cast(init), 1);
+ }
+ }
+ }
+ }
+
static blt::size_t runs = 30;
@@ -206,54 +224,71 @@ void action_test(const std::vector& argv_vector)
for (auto [index, v] : blt::enumerate(vec))
average_activations[index] += v;
- auto min_quant = *std::min_element(average_quantization_errors.begin(), average_quantization_errors.end()) / static_cast(runs);
- auto max_quant = *std::max_element(average_quantization_errors.begin(), average_quantization_errors.end()) / static_cast(runs);
+ auto min_quant =
+ *std::min_element(average_quantization_errors.begin(), average_quantization_errors.end()) / static_cast(runs);
+ auto max_quant =
+ *std::max_element(average_quantization_errors.begin(), average_quantization_errors.end()) / static_cast(runs);
auto min_topo = *std::min_element(average_topological_errors.begin(), average_topological_errors.end()) / static_cast(runs);
auto max_topo = *std::max_element(average_topological_errors.begin(), average_topological_errors.end()) / static_cast(runs);
- std::ofstream topological{path + "topological_avg.csv"};
- std::ofstream quantization{path + "quantization_avg.csv"};
- std::ofstream activations_avg{path + "activations_avg.csv"};
- std::ofstream activations{path + "activations.csv"};
+ {
+ std::ofstream topological{path + "topological_avg.csv"};
+ std::ofstream quantization{path + "quantization_avg.csv"};
+ std::ofstream activations_avg{path + "activations_avg.csv"};
+ std::ofstream activations{path + "activations.csv"};
- topological << "error\n";
- quantization << "error\n";
- for (auto [i, v] : blt::enumerate(average_topological_errors))
- {
- topological << v / static_cast(runs) << '\n';
- }
- for (auto [i, v] : blt::enumerate(average_quantization_errors))
- {
- quantization << v / static_cast(runs) << '\n';
- }
- for (auto [i, v] : blt::enumerate(average_activations))
- {
- activations_avg << v / static_cast(runs);
- if (i % task.width == task.width - 1)
- activations_avg << '\n';
- else
- activations_avg << ',';
+ topological << "error\n";
+ quantization << "error\n";
+ for (auto [i, v] : blt::enumerate(average_topological_errors))
+ {
+ topological << v / static_cast(runs) << '\n';
+ }
+ for (auto [i, v] : blt::enumerate(average_quantization_errors))
+ {
+ quantization << v / static_cast(runs) << '\n';
+ }
+ for (auto [i, v] : blt::enumerate(average_activations))
+ {
+ activations_avg << v / static_cast(runs);
+ if (i % task.width == task.width - 1)
+ activations_avg << '\n';
+ else
+ activations_avg << ',';
+ }
+ for (auto [i, v] : blt::enumerate(task.activations.front()))
+ {
+ activations << v;
+ if (i % task.width == task.width - 1)
+ activations << '\n';
+ else
+ activations << ',';
+ }
}
- for (auto [i, v] : blt::enumerate(task.activations.front()))
- {
- activations << v / static_cast(runs);
- if (i % task.width == task.width - 1)
- activations << '\n';
- else
- activations << ',';
- }
-
- plot_heatmap(path + "activations.csv", task.file->data_points.front().bins.size(),
+ plot_heatmap(path, "activations.csv", task.file->data_points.front().bins.size(),
std::to_string(task.width) + "x" + std::to_string(task.height) + " " += shape_name + ", " += init_name + ", " +
- std::to_string(task.max_epochs) + " Epochs");
+ std::to_string(
+ task.max_epochs) +
+ " Epochs");
- plot_line_graph(path + "topological_avg.csv", path + "quantization_avg.csv", task.file->data_points.front().bins.size(),
+ plot_line_graph(path, "topological_avg.csv", "quantization_avg.csv", task.file->data_points.front().bins.size(),
std::to_string(task.width) + "x" + std::to_string(task.height) + " " += shape_name + ", " += init_name + ", Min: " +
- std::to_string(min_topo) + ", Max: " + std::to_string(max_topo) + ", " + std::to_string(task.max_epochs) + " Epochs",
+ std::to_string(
+ min_topo) +
+ ", Max: " +
+ std::to_string(
+ max_topo) +
+ ", " + std::to_string(
+ task.max_epochs) + " Epochs",
std::to_string(task.width) + "x" + std::to_string(task.height) + " " += shape_name + ", " += init_name + ", Min: " +
- std::to_string(min_quant) + ", Max: " + std::to_string(max_quant) + ", " + std::to_string(task.max_epochs) +
+ std::to_string(
+ min_quant) +
+ ", Max: " +
+ std::to_string(
+ max_quant) +
+ ", " + std::to_string(
+ task.max_epochs) +
" Epochs");
BLT_INFO("Task '%s' Complete", path.c_str());