diff --git a/.clang-uml b/.clang-uml index 3578601..e5e6e41 100644 --- a/.clang-uml +++ b/.clang-uml @@ -4,7 +4,7 @@ diagrams: Platform: type: class glob: - - src/Platform/*.cc + - src/*.cc - src/Command/*.cc using_namespace: platform include: @@ -25,7 +25,6 @@ diagrams: - platform include: paths: - - src/Command - - src/Platform + - src start_from: - function: main(int,const char **) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1e30c2d..25c9e26 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -22,7 +22,7 @@ "type": "lldb", "request": "launch", "name": "experimentPy", - "program": "${workspaceFolder}/build_debug/src/Platform/b_main", + "program": "${workspaceFolder}/build_debug/src/b_main", "args": [ "-m", "STree", @@ -39,7 +39,7 @@ "type": "lldb", "request": "launch", "name": "gridsearch", - "program": "${workspaceFolder}/build_debug/src/Platform/b_grid", + "program": "${workspaceFolder}/build_debug/src/b_grid", "args": [ "-m", "KDB", @@ -55,7 +55,7 @@ "type": "lldb", "request": "launch", "name": "experimentBayes", - "program": "${workspaceFolder}/build_debug/src/Platform/b_main", + "program": "${workspaceFolder}/build_debug/src/b_main", "args": [ "-m", "TAN", @@ -72,7 +72,7 @@ "type": "lldb", "request": "launch", "name": "best", - "program": "${workspaceFolder}/build_debug/src/Platform/b_best", + "program": "${workspaceFolder}/build_debug/src/b_best", "args": [ "-m", "BoostAODE", @@ -86,7 +86,7 @@ "type": "lldb", "request": "launch", "name": "manage", - "program": "${workspaceFolder}/build_debug/src/Platform/b_manage", + "program": "${workspaceFolder}/build_debug/src/b_manage", "args": [ "-n", "20" @@ -97,7 +97,7 @@ "type": "lldb", "request": "launch", "name": "list", - "program": "${workspaceFolder}/build_debug/src/Platform/b_list", + "program": "${workspaceFolder}/build_debug/src/b_list", "args": [], //"cwd": "/Users/rmontanana/Code/discretizbench", "cwd": "${workspaceFolder}/../discretizbench", diff --git a/CMakeLists.txt b/CMakeLists.txt index 5762f4c..b54c2f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) project(Platform - VERSION 1.0.1 + VERSION 1.0.2 DESCRIPTION "Platform to run Experiments with classifiers." HOMEPAGE_URL "https://github.com/rmontanana/platform" LANGUAGES CXX @@ -78,11 +78,11 @@ message("XLSXWRITER_LIB=${XLSXWRITER_LIB}") # Subdirectories # -------------- -set(Platform_MODULES ${Platform_SOURCE_DIR}/src/Platform/modules/) +set(Platform_MODULES ${Platform_SOURCE_DIR}/src/modules/) add_subdirectory(config) -add_subdirectory(src/Platform) +add_subdirectory(src) add_subdirectory(sample) -file(GLOB Platform_SOURCES CONFIGURE_DEPENDS ${Platform_SOURCE_DIR}/src/Platform/*.cc) +file(GLOB Platform_SOURCES CONFIGURE_DEPENDS ${Platform_SOURCE_DIR}/src/*.cc) # Testing # ------- diff --git a/Makefile b/Makefile index 2af685e..f788e9c 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ install: ## Copy binary files to bin folder @echo "*******************************************" @for item in $(app_targets); do \ echo ">>> Copying $$item" ; \ - cp $(f_release)/src/Platform/$$item $(dest) ; \ + cp $(f_release)/src/$$item $(dest) ; \ done dependency: ## Create a dependency graph diagram of the project (build/dependency.png) diff --git a/lib/PyClassifiers b/lib/PyClassifiers index 5a6d38e..bd6f6f5 160000 --- a/lib/PyClassifiers +++ b/lib/PyClassifiers @@ -1 +1 @@ -Subproject commit 5a6d38e900736c4ffd9b91de26d290559ee69c08 +Subproject commit bd6f6f58375407ce1c9cae671d8e82fa5429f9e3 diff --git a/lib/catch2 b/lib/catch2 index bbba3d8..ed6ac8a 160000 --- a/lib/catch2 +++ b/lib/catch2 @@ -1 +1 @@ -Subproject commit bbba3d8a068aeb5ec677db30947fe97fe047a2ba +Subproject commit ed6ac8a629f9a4206575be784c1e340da2a94855 diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index f062ca4..2545059 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -1,10 +1,10 @@ include_directories( - ${Platform_SOURCE_DIR}/src/Platform/modules - ${Platform_SOURCE_DIR}/lib/PyClassifiers/src/PyClassifiers + ${Platform_SOURCE_DIR}/src/modules + ${Platform_SOURCE_DIR}/lib/PyClassifiers/src ${Python3_INCLUDE_DIRS} ${Platform_SOURCE_DIR}/lib/Files ${Platform_SOURCE_DIR}/lib/argparse/include - ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/src/BayesNet + ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/src ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/folding ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/mdlp ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/json/include diff --git a/src/Platform/CMakeLists.txt b/src/CMakeLists.txt similarity index 93% rename from src/Platform/CMakeLists.txt rename to src/CMakeLists.txt index 8b44388..23f3b32 100644 --- a/src/Platform/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,9 @@ include_directories( - ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/src/BayesNet + ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/src ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/folding ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/mdlp ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/json/include - ${Platform_SOURCE_DIR}/lib/PyClassifiers/src/PyClassifiers + ${Platform_SOURCE_DIR}/lib/PyClassifiers/src ${Platform_MODULES} ${Platform_SOURCE_DIR}/lib/Files ${Platform_SOURCE_DIR}/lib/mdlp diff --git a/src/Platform/b_best.cc b/src/b_best.cc similarity index 100% rename from src/Platform/b_best.cc rename to src/b_best.cc diff --git a/src/Platform/b_grid.cc b/src/b_grid.cc similarity index 100% rename from src/Platform/b_grid.cc rename to src/b_grid.cc diff --git a/src/Platform/b_list.cc b/src/b_list.cc similarity index 100% rename from src/Platform/b_list.cc rename to src/b_list.cc diff --git a/src/Platform/b_main.cc b/src/b_main.cc similarity index 100% rename from src/Platform/b_main.cc rename to src/b_main.cc diff --git a/src/Platform/b_manage.cc b/src/b_manage.cc similarity index 100% rename from src/Platform/b_manage.cc rename to src/b_manage.cc diff --git a/src/Platform/modules/BestResults.cc b/src/modules/BestResults.cc similarity index 100% rename from src/Platform/modules/BestResults.cc rename to src/modules/BestResults.cc diff --git a/src/Platform/modules/BestResults.h b/src/modules/BestResults.h similarity index 100% rename from src/Platform/modules/BestResults.h rename to src/modules/BestResults.h diff --git a/src/Platform/modules/BestResultsExcel.cc b/src/modules/BestResultsExcel.cc similarity index 100% rename from src/Platform/modules/BestResultsExcel.cc rename to src/modules/BestResultsExcel.cc diff --git a/src/Platform/modules/BestResultsExcel.h b/src/modules/BestResultsExcel.h similarity index 100% rename from src/Platform/modules/BestResultsExcel.h rename to src/modules/BestResultsExcel.h diff --git a/src/Platform/modules/BestScore.h b/src/modules/BestScore.h similarity index 100% rename from src/Platform/modules/BestScore.h rename to src/modules/BestScore.h diff --git a/src/Platform/modules/CLocale.h b/src/modules/CLocale.h similarity index 100% rename from src/Platform/modules/CLocale.h rename to src/modules/CLocale.h diff --git a/src/Platform/modules/Colors.h b/src/modules/Colors.h similarity index 100% rename from src/Platform/modules/Colors.h rename to src/modules/Colors.h diff --git a/src/Platform/modules/CommandParser.cc b/src/modules/CommandParser.cc similarity index 100% rename from src/Platform/modules/CommandParser.cc rename to src/modules/CommandParser.cc diff --git a/src/Platform/modules/CommandParser.h b/src/modules/CommandParser.h similarity index 100% rename from src/Platform/modules/CommandParser.h rename to src/modules/CommandParser.h diff --git a/src/Platform/modules/Dataset.cc b/src/modules/Dataset.cc similarity index 100% rename from src/Platform/modules/Dataset.cc rename to src/modules/Dataset.cc diff --git a/src/Platform/modules/Dataset.h b/src/modules/Dataset.h similarity index 100% rename from src/Platform/modules/Dataset.h rename to src/modules/Dataset.h diff --git a/src/Platform/modules/Datasets.cc b/src/modules/Datasets.cc similarity index 100% rename from src/Platform/modules/Datasets.cc rename to src/modules/Datasets.cc diff --git a/src/Platform/modules/Datasets.h b/src/modules/Datasets.h similarity index 100% rename from src/Platform/modules/Datasets.h rename to src/modules/Datasets.h diff --git a/src/Platform/modules/DotEnv.h b/src/modules/DotEnv.h similarity index 100% rename from src/Platform/modules/DotEnv.h rename to src/modules/DotEnv.h diff --git a/src/Platform/modules/ExcelFile.cc b/src/modules/ExcelFile.cc similarity index 100% rename from src/Platform/modules/ExcelFile.cc rename to src/modules/ExcelFile.cc diff --git a/src/Platform/modules/ExcelFile.h b/src/modules/ExcelFile.h similarity index 100% rename from src/Platform/modules/ExcelFile.h rename to src/modules/ExcelFile.h diff --git a/src/Platform/modules/Experiment.cc b/src/modules/Experiment.cc similarity index 100% rename from src/Platform/modules/Experiment.cc rename to src/modules/Experiment.cc diff --git a/src/Platform/modules/Experiment.h b/src/modules/Experiment.h similarity index 100% rename from src/Platform/modules/Experiment.h rename to src/modules/Experiment.h diff --git a/src/Platform/modules/GridData.cc b/src/modules/GridData.cc similarity index 100% rename from src/Platform/modules/GridData.cc rename to src/modules/GridData.cc diff --git a/src/Platform/modules/GridData.h b/src/modules/GridData.h similarity index 100% rename from src/Platform/modules/GridData.h rename to src/modules/GridData.h diff --git a/src/Platform/modules/GridSearch.cc b/src/modules/GridSearch.cc similarity index 100% rename from src/Platform/modules/GridSearch.cc rename to src/modules/GridSearch.cc diff --git a/src/Platform/modules/GridSearch.h b/src/modules/GridSearch.h similarity index 100% rename from src/Platform/modules/GridSearch.h rename to src/modules/GridSearch.h diff --git a/src/Platform/modules/HyperParameters.cc b/src/modules/HyperParameters.cc similarity index 100% rename from src/Platform/modules/HyperParameters.cc rename to src/modules/HyperParameters.cc diff --git a/src/Platform/modules/HyperParameters.h b/src/modules/HyperParameters.h similarity index 100% rename from src/Platform/modules/HyperParameters.h rename to src/modules/HyperParameters.h diff --git a/src/Platform/modules/ManageResults.cc b/src/modules/ManageResults.cc similarity index 100% rename from src/Platform/modules/ManageResults.cc rename to src/modules/ManageResults.cc diff --git a/src/Platform/modules/ManageResults.h b/src/modules/ManageResults.h similarity index 100% rename from src/Platform/modules/ManageResults.h rename to src/modules/ManageResults.h diff --git a/src/Platform/modules/Models.cc b/src/modules/Models.cc similarity index 100% rename from src/Platform/modules/Models.cc rename to src/modules/Models.cc diff --git a/src/Platform/modules/Models.h b/src/modules/Models.h similarity index 100% rename from src/Platform/modules/Models.h rename to src/modules/Models.h diff --git a/src/Platform/modules/PartialResult.h b/src/modules/PartialResult.h similarity index 100% rename from src/Platform/modules/PartialResult.h rename to src/modules/PartialResult.h diff --git a/src/Platform/modules/Paths.h b/src/modules/Paths.h similarity index 100% rename from src/Platform/modules/Paths.h rename to src/modules/Paths.h diff --git a/src/Platform/modules/ReportBase.cc b/src/modules/ReportBase.cc similarity index 100% rename from src/Platform/modules/ReportBase.cc rename to src/modules/ReportBase.cc diff --git a/src/Platform/modules/ReportBase.h b/src/modules/ReportBase.h similarity index 100% rename from src/Platform/modules/ReportBase.h rename to src/modules/ReportBase.h diff --git a/src/Platform/modules/ReportConsole.cc b/src/modules/ReportConsole.cc similarity index 100% rename from src/Platform/modules/ReportConsole.cc rename to src/modules/ReportConsole.cc diff --git a/src/Platform/modules/ReportConsole.h b/src/modules/ReportConsole.h similarity index 100% rename from src/Platform/modules/ReportConsole.h rename to src/modules/ReportConsole.h diff --git a/src/Platform/modules/ReportExcel.cc b/src/modules/ReportExcel.cc similarity index 100% rename from src/Platform/modules/ReportExcel.cc rename to src/modules/ReportExcel.cc diff --git a/src/Platform/modules/ReportExcel.h b/src/modules/ReportExcel.h similarity index 100% rename from src/Platform/modules/ReportExcel.h rename to src/modules/ReportExcel.h diff --git a/src/Platform/modules/Result.cc b/src/modules/Result.cc similarity index 100% rename from src/Platform/modules/Result.cc rename to src/modules/Result.cc diff --git a/src/Platform/modules/Result.h b/src/modules/Result.h similarity index 100% rename from src/Platform/modules/Result.h rename to src/modules/Result.h diff --git a/src/Platform/modules/Results.cc b/src/modules/Results.cc similarity index 100% rename from src/Platform/modules/Results.cc rename to src/modules/Results.cc diff --git a/src/Platform/modules/Results.h b/src/modules/Results.h similarity index 100% rename from src/Platform/modules/Results.h rename to src/modules/Results.h diff --git a/src/Platform/modules/Statistics.cc b/src/modules/Statistics.cc similarity index 100% rename from src/Platform/modules/Statistics.cc rename to src/modules/Statistics.cc diff --git a/src/Platform/modules/Statistics.h b/src/modules/Statistics.h similarity index 100% rename from src/Platform/modules/Statistics.h rename to src/modules/Statistics.h diff --git a/src/Platform/modules/Symbols.h b/src/modules/Symbols.h similarity index 100% rename from src/Platform/modules/Symbols.h rename to src/modules/Symbols.h diff --git a/src/Platform/modules/Timer.h b/src/modules/Timer.h similarity index 100% rename from src/Platform/modules/Timer.h rename to src/modules/Timer.h diff --git a/src/Platform/modules/Utils.h b/src/modules/Utils.h similarity index 100% rename from src/Platform/modules/Utils.h rename to src/modules/Utils.h diff --git a/src/Platform/modules/modelRegister.h b/src/modules/modelRegister.h similarity index 100% rename from src/Platform/modules/modelRegister.h rename to src/modules/modelRegister.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a0d9e4e..d0a401b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,7 @@ if(ENABLE_TESTING) set(TEST_PLATFORM "unit_tests_platform") include_directories( - ${Platform_SOURCE_DIR}/src/Platform + ${Platform_SOURCE_DIR}/src ${Platform_SOURCE_DIR}/lib/argparse/include ${Platform_SOURCE_DIR}/lib/PyClassifiers/lib/BayesNet/lib/mdlp ${Platform_SOURCE_DIR}/lib/Files diff --git a/tests/TestPlatform.cc b/tests/TestPlatform.cc index 3737f21..37f3c32 100644 --- a/tests/TestPlatform.cc +++ b/tests/TestPlatform.cc @@ -6,65 +6,11 @@ #include #include #include "TestUtils.h" +#include "config.h" + TEST_CASE("Test Python Classifiers score", "[PyClassifiers]") { - map , float> scores = { - // Diabetes - {{"diabetes", "STree"}, 0.81641}, {{"diabetes", "ODTE"}, 0.84635}, {{"diabetes", "SVC"}, 0.76823}, {{"diabetes", "RandomForest"}, 1.0}, - // Ecoli - {{"ecoli", "STree"}, 0.8125}, {{"ecoli", "ODTE"}, 0.84821}, {{"ecoli", "SVC"}, 0.89583}, {{"ecoli", "RandomForest"}, 1.0}, - // Glass - {{"glass", "STree"}, 0.57009}, {{"glass", "ODTE"}, 0.77103}, {{"glass", "SVC"}, 0.35514}, {{"glass", "RandomForest"}, 1.0}, - // Iris - {{"iris", "STree"}, 0.99333}, {{"iris", "ODTE"}, 0.98667}, {{"iris", "SVC"}, 0.97333}, {{"iris", "RandomForest"}, 1.0}, - }; - - std::string file_name = GENERATE("glass", "iris", "ecoli", "diabetes"); - auto raw = RawDatasets(file_name, false); - - SECTION("Test STree classifier (" + file_name + ")") - { - auto clf = pywrap::STree(); - clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); - auto score = clf.score(raw.Xt, raw.yt); - REQUIRE(score == Catch::Approx(scores[{file_name, "STree"}]).epsilon(raw.epsilon)); - } - SECTION("Test ODTE classifier (" + file_name + ")") - { - auto clf = pywrap::ODTE(); - clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); - auto score = clf.score(raw.Xt, raw.yt); - REQUIRE(score == Catch::Approx(scores[{file_name, "ODTE"}]).epsilon(raw.epsilon)); - } - SECTION("Test SVC classifier (" + file_name + ")") - { - auto clf = pywrap::SVC(); - clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); - auto score = clf.score(raw.Xt, raw.yt); - REQUIRE(score == Catch::Approx(scores[{file_name, "SVC"}]).epsilon(raw.epsilon)); - } - SECTION("Test RandomForest classifier (" + file_name + ")") - { - auto clf = pywrap::RandomForest(); - clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); - auto score = clf.score(raw.Xt, raw.yt); - REQUIRE(score == Catch::Approx(scores[{file_name, "RandomForest"}]).epsilon(raw.epsilon)); - } -} -TEST_CASE("Classifiers features", "[PyClassifiers]") -{ - auto raw = RawDatasets("iris", true); - auto clf = pywrap::STree(); - clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); - REQUIRE(clf.getNumberOfNodes() == 3); - REQUIRE(clf.getNumberOfEdges() == 2); -} -TEST_CASE("Get num features & num edges", "[PyClassifiers]") -{ - auto raw = RawDatasets("iris", true); - auto clf = pywrap::ODTE(); - clf.fit(raw.Xt, raw.yt, raw.featurest, raw.classNamet, raw.statest); - REQUIRE(clf.getNumberOfNodes() == 10); - REQUIRE(clf.getNumberOfEdges() == 10); + std::string version = { project_version.begin(), project_version.end() }; + REQUIRE(version == "1.0.2"); } \ No newline at end of file