mirror of
https://github.com/rmontanana/mdlp.git
synced 2025-08-19 09:25:58 +00:00
Compare commits
6 Commits
main
...
77125ac34d
Author | SHA1 | Date | |
---|---|---|---|
77125ac34d
|
|||
479cb01c6b
|
|||
b9cab7f61c
|
|||
2fe31ee453
|
|||
fa1b063be0
|
|||
4e5f39f803
|
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
@@ -19,29 +19,26 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install sonar-scanner and build-wrapper
|
- name: Install sonar-scanner and build-wrapper
|
||||||
uses: SonarSource/sonarcloud-github-c-cpp@v2
|
uses: SonarSource/sonarcloud-github-c-cpp@v2
|
||||||
- name: Install Python and Conan
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get -y install python3 python3-pip
|
|
||||||
pip3 install conan
|
|
||||||
- name: Install lcov & gcovr
|
- name: Install lcov & gcovr
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y install lcov
|
sudo apt-get -y install lcov
|
||||||
sudo apt-get -y install gcovr
|
sudo apt-get -y install gcovr
|
||||||
- name: Setup Conan profileson
|
- name: Install Libtorch
|
||||||
run: |
|
run: |
|
||||||
conan profile detect --force
|
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.3.1%2Bcpu.zip
|
||||||
conan remote add cimmeria https://conan.rmontanana.es/artifactory/api/conan/Cimmeria
|
unzip libtorch-cxx11-abi-shared-with-deps-2.3.1+cpu.zip
|
||||||
- name: Install dependencies with Conan
|
|
||||||
run: |
|
|
||||||
conan install . --build=missing -of build_debug -s build_type=Debug -o enable_testing=True
|
|
||||||
- name: Configure with CMake
|
|
||||||
run: |
|
|
||||||
cmake -S . -B build_debug -DCMAKE_TOOLCHAIN_FILE=build_debug/build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON
|
|
||||||
- name: Tests & build-wrapper
|
- name: Tests & build-wrapper
|
||||||
run: |
|
run: |
|
||||||
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build_debug --config Debug -j 4
|
cmake -S . -B build -Wno-dev -DCMAKE_PREFIX_PATH=$(pwd)/libtorch -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON
|
||||||
cp -r tests/datasets build_debug/tests/datasets
|
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Debug
|
||||||
cd build_debug/tests
|
cmake --build build -j 4
|
||||||
ctest --output-on-failure -j 4
|
cd build
|
||||||
|
ctest -C Debug --output-on-failure -j 4
|
||||||
|
gcovr -f ../src/CPPFImdlp.cpp -f ../src/Metrics.cpp -f ../src/BinDisc.cpp -f ../src/Discretizer.cpp --txt --sonarqube=coverage.xml
|
||||||
|
- name: Run sonar-scanner
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
run: |
|
||||||
|
sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
|
||||||
|
--define sonar.coverageReportPaths=build/coverage.xml
|
@@ -5,14 +5,6 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [2.1.1] - 2025-07-17
|
|
||||||
|
|
||||||
### Internal Changes
|
|
||||||
|
|
||||||
- Updated Libtorch to version 2.7.1
|
|
||||||
- Updated ArffFiles library to version 1.2.1
|
|
||||||
- Enhance CMake configuration for better compatibility
|
|
||||||
|
|
||||||
## [2.1.0] - 2025-06-28
|
## [2.1.0] - 2025-06-28
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@@ -4,7 +4,7 @@ project(fimdlp
|
|||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
DESCRIPTION "Discretization algorithm based on the paper by Fayyad & Irani Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning."
|
DESCRIPTION "Discretization algorithm based on the paper by Fayyad & Irani Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning."
|
||||||
HOMEPAGE_URL "https://github.com/rmontanana/mdlp"
|
HOMEPAGE_URL "https://github.com/rmontanana/mdlp"
|
||||||
VERSION 2.1.1
|
VERSION 2.1.0
|
||||||
)
|
)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
cmake_policy(SET CMP0135 NEW)
|
cmake_policy(SET CMP0135 NEW)
|
||||||
|
@@ -7,11 +7,9 @@ This directory contains the Conan package configuration for the fimdlp library.
|
|||||||
The package manages the following dependencies:
|
The package manages the following dependencies:
|
||||||
|
|
||||||
### Build Requirements
|
### Build Requirements
|
||||||
|
|
||||||
- **libtorch/2.4.1** - PyTorch C++ library for tensor operations
|
- **libtorch/2.4.1** - PyTorch C++ library for tensor operations
|
||||||
|
|
||||||
### Test Requirements (when testing enabled)
|
### Test Requirements (when testing enabled)
|
||||||
|
|
||||||
- **catch2/3.8.1** - Modern C++ testing framework
|
- **catch2/3.8.1** - Modern C++ testing framework
|
||||||
- **arff-files** - ARFF file format support (included locally in tests/lib/Files/)
|
- **arff-files** - ARFF file format support (included locally in tests/lib/Files/)
|
||||||
|
|
||||||
@@ -69,7 +67,7 @@ conan create . -o shared=True --profile:build=default --profile:host=default
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Add Cimmeria remote
|
# Add Cimmeria remote
|
||||||
conan remote add cimmeria https://conan.rmontanana.es/artifactory/api/conan/Cimmeria
|
conan remote add cimmeria <cimmeria-server-url>
|
||||||
|
|
||||||
# Login to Cimmeria
|
# Login to Cimmeria
|
||||||
conan remote login cimmeria <username>
|
conan remote login cimmeria <username>
|
||||||
|
31
Makefile
31
Makefile
@@ -1,5 +1,5 @@
|
|||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := release
|
||||||
.PHONY: debug release install test conan-create viewcoverage
|
.PHONY: debug release install test conan-create viewcoverage
|
||||||
lcov := lcov
|
lcov := lcov
|
||||||
|
|
||||||
@@ -11,18 +11,18 @@ docscdir = docs
|
|||||||
define build_target
|
define build_target
|
||||||
@echo ">>> Building the project for $(1)..."
|
@echo ">>> Building the project for $(1)..."
|
||||||
@if [ -d $(2) ]; then rm -fr $(2); fi
|
@if [ -d $(2) ]; then rm -fr $(2); fi
|
||||||
@conan install . --build=missing -of $(2) -s build_type=$(1) $(4)
|
@conan install . --build=missing -of $(2) -s build_type=$(1)
|
||||||
@cmake -S . -B $(2) -DCMAKE_TOOLCHAIN_FILE=$(2)/build/$(1)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(1) -D$(3)
|
@cmake -S . -B $(2) -DCMAKE_TOOLCHAIN_FILE=$(2)/build/$(1)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(1) -D$(3)
|
||||||
@cmake --build $(2) --config $(1) -j 8
|
@cmake --build $(2) --config $(1) -j 8
|
||||||
endef
|
endef
|
||||||
|
|
||||||
debug: ## Build Debug version of the library
|
debug: ## Build Debug version of the library
|
||||||
@$(call build_target,"Debug","$(f_debug)", "ENABLE_TESTING=ON", "-o enable_testing=True")
|
@$(call build_target,"Debug","$(f_debug)", "ENABLE_TESTING=ON")
|
||||||
|
|
||||||
release: ## Build Release version of the library
|
release: ## Build Release version of the library
|
||||||
@$(call build_target,"Release","$(f_release)", "ENABLE_TESTING=OFF", "-o enable_testing=False")
|
@$(call build_target,"Release","$(f_release)", "ENABLE_TESTING=OFF")
|
||||||
|
|
||||||
install: ## Install the library
|
install: ## Install the project
|
||||||
@echo ">>> Installing the project..."
|
@echo ">>> Installing the project..."
|
||||||
@cmake --build $(f_release) --target install -j 8
|
@cmake --build $(f_release) --target install -j 8
|
||||||
|
|
||||||
@@ -31,8 +31,7 @@ test: ## Build Debug version and run tests
|
|||||||
@$(MAKE) debug;
|
@$(MAKE) debug;
|
||||||
@cp -r tests/datasets $(f_debug)/tests/datasets
|
@cp -r tests/datasets $(f_debug)/tests/datasets
|
||||||
@cd $(f_debug)/tests && ctest --output-on-failure -j 8
|
@cd $(f_debug)/tests && ctest --output-on-failure -j 8
|
||||||
@echo ">>> Generating coverage report..."
|
@cd $(f_debug)/tests && $(lcov) --capture --directory ../ --demangle-cpp --ignore-errors source,source --ignore-errors mismatch --output-file coverage.info >/dev/null 2>&1; \
|
||||||
@cd $(f_debug)/tests && $(lcov) --capture --directory ../ --demangle-cpp --ignore-errors source,source --ignore-errors mismatch --ignore-errors inconsistent --output-file coverage.info >/dev/null 2>&1; \
|
|
||||||
$(lcov) --remove coverage.info '/usr/*' --output-file coverage.info >/dev/null 2>&1; \
|
$(lcov) --remove coverage.info '/usr/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||||
$(lcov) --remove coverage.info 'lib/*' --output-file coverage.info >/dev/null 2>&1; \
|
$(lcov) --remove coverage.info 'lib/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||||
$(lcov) --remove coverage.info 'libtorch/*' --output-file coverage.info >/dev/null 2>&1; \
|
$(lcov) --remove coverage.info 'libtorch/*' --output-file coverage.info >/dev/null 2>&1; \
|
||||||
@@ -67,19 +66,5 @@ conan-create: ## Create the conan package
|
|||||||
conan create . --build=missing -tf "" -s:a build_type=Debug -o "&:enable_testing=False"
|
conan create . --build=missing -tf "" -s:a build_type=Debug -o "&:enable_testing=False"
|
||||||
@echo ">>> Done"
|
@echo ">>> Done"
|
||||||
|
|
||||||
help: ## Show help message
|
|
||||||
@IFS=$$'\n' ; \
|
|
||||||
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
|
|
||||||
printf "%s\n\n" "Usage: make [task]"; \
|
|
||||||
printf "%-20s %s\n" "task" "help" ; \
|
|
||||||
printf "%-20s %s\n" "------" "----" ; \
|
|
||||||
for help_line in $${help_lines[@]}; do \
|
|
||||||
IFS=$$':' ; \
|
|
||||||
help_split=($$help_line) ; \
|
|
||||||
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
|
|
||||||
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
|
|
||||||
printf '\033[36m'; \
|
|
||||||
printf "%-20s %s" $$help_command ; \
|
|
||||||
printf '\033[0m'; \
|
|
||||||
printf "%s\n" $$help_info; \
|
|
||||||
done
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
[](https://sonarcloud.io/summary/new_code?id=rmontanana_mdlp)
|
[](https://sonarcloud.io/summary/new_code?id=rmontanana_mdlp)
|
||||||
[](html/index.html)
|
[](html/index.html)
|
||||||
[](https://deepwiki.com/rmontanana/mdlp)
|
[](https://deepwiki.com/rmontanana/mdlp)
|
||||||
[](https://doi.org/10.5281/zenodo.16025501)
|
[](https://doi.org/10.5281/zenodo.14245443)
|
||||||
|
|
||||||
# <img src="logo.png" alt="logo" width="50"/> mdlp
|
# <img src="logo.png" alt="logo" width="50"/> mdlp
|
||||||
|
|
||||||
@@ -18,7 +18,9 @@ Other features:
|
|||||||
|
|
||||||
- Intervals with the same value of the variable are not taken into account for cutpoints.
|
- Intervals with the same value of the variable are not taken into account for cutpoints.
|
||||||
- Intervals have to have more than two examples to be evaluated (mdlp).
|
- Intervals have to have more than two examples to be evaluated (mdlp).
|
||||||
|
|
||||||
- The algorithm returns the cut points for the variable.
|
- The algorithm returns the cut points for the variable.
|
||||||
|
|
||||||
- The transform method uses the cut points returning its index in the following way:
|
- The transform method uses the cut points returning its index in the following way:
|
||||||
|
|
||||||
cut[i - 1] <= x < cut[i]
|
cut[i - 1] <= x < cut[i]
|
||||||
|
@@ -51,10 +51,10 @@ class FimdlpConan(ConanFile):
|
|||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
# PyTorch dependency for tensor operations
|
# PyTorch dependency for tensor operations
|
||||||
self.requires("libtorch/2.7.1")
|
self.requires("libtorch/2.7.0")
|
||||||
|
|
||||||
def build_requirements(self):
|
def build_requirements(self):
|
||||||
self.requires("arff-files/1.2.1") # for tests and sample
|
self.requires("arff-files/1.2.0") # for tests and sample
|
||||||
if self.options.enable_testing:
|
if self.options.enable_testing:
|
||||||
self.test_requires("gtest/1.16.0")
|
self.test_requires("gtest/1.16.0")
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ namespace mdlp {
|
|||||||
Discretizer* disc = new BinDisc(4, strategy_t::UNIFORM);
|
Discretizer* disc = new BinDisc(4, strategy_t::UNIFORM);
|
||||||
auto version = disc->version();
|
auto version = disc->version();
|
||||||
delete disc;
|
delete disc;
|
||||||
EXPECT_EQ("2.1.1", version);
|
EXPECT_EQ("2.1.0", version);
|
||||||
}
|
}
|
||||||
TEST(Discretizer, BinIrisUniform)
|
TEST(Discretizer, BinIrisUniform)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user