2 Commits

Author SHA1 Message Date
633aa52849 Refactor sample build 2024-06-06 12:04:55 +02:00
61de687476 Fix library creation problem 2024-06-06 11:13:50 +02:00
6 changed files with 15 additions and 37 deletions

View File

@@ -1,13 +1,9 @@
cmake_minimum_required(VERSION 3.20)
project(mdlp)
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif ()
set(CMAKE_CXX_STANDARD 11)
add_library(mdlp CPPFImdlp.cpp Metrics.cpp)
add_library(mdlp CPPFImdlp.cpp Metrics.cpp BinDisc.cpp)
add_subdirectory(sample)
add_subdirectory(tests)

View File

@@ -23,12 +23,10 @@ The algorithm returns the cut points for the variable.
To run the sample, just execute the following commands:
```bash
cd sample
cmake -B build
cd build
make
./sample -f iris -m 2
./sample -h
cmake -B build -S .
cmake --build build
build/sample/sample -f iris -m 2
build/sample/sample -h
```
## Test

View File

@@ -1,21 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "lldb puro",
"type": "cppdbg",
// "targetArchitecture": "arm64",
"request": "launch",
"program": "${workspaceRoot}/build/sample",
"args": [
"-f",
"iris"
],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/build/",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
},
]
}

View File

@@ -2,4 +2,5 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
add_executable(sample sample.cpp ../tests/ArffFiles.cpp ../Metrics.cpp ../CPPFImdlp.cpp)
add_executable(sample sample.cpp ../tests/ArffFiles.cpp)
target_link_libraries(sample mdlp)

View File

@@ -11,7 +11,7 @@
using namespace std;
using namespace mdlp;
const string PATH = "../../tests/datasets/";
const string PATH = "tests/datasets/";
/* print a description of all supported options */
void usage(const char* path)
@@ -131,6 +131,12 @@ void process_file(const string& path, const string& file_name, bool class_last,
}
cout << "Total cut points ...: " << total << endl;
cout << "Total feature states: " << total + attributes.size() << endl;
cout << "Version ............: " << test.version() << endl;
cout << "Transformed data ...: " << endl;
auto data = test.transform(X[0]);
for (int i = 0; i < 5; i++) {
cout << fixed << setprecision(1) << X[0][i] << " " << data[i] << endl;
}
}
void process_all_files(const map<string, bool>& datasets, const string& path, int max_depth, int min_length,

View File

@@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 11)
cmake_policy(SET CMP0135 NEW)
include(FetchContent)
include_directories(${GTEST_INCLUDE_DIRS})
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip