diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 9624835..7c8f924 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -63,13 +63,16 @@ jobs: mingw-w64-x86_64-gcc mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-wheel + mingw-w64-x86_64-python-pandas + git + mingw-w64-x86_64-meson - uses: actions/checkout@v3 - - name: Install pybind11 + - name: Add requirements # This is required because --no-build-isolation disable dependences # installation - run: pip install pybind11 + run: python -m pip install gitpython pybind11 meson-python - name: Build and install # --no-build-isolation is required because the vanilla setuptool does not @@ -80,4 +83,6 @@ jobs: run: pip install --no-build-isolation . - name: Test - run: python tests/test.py + run: | + pip install pytest + pytest diff --git a/.gitignore b/.gitignore index b2ceca6..09888a7 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ _no_* **/__pycache__/ *pymurtree_data/ **/*.cpython* +*.pyd \ No newline at end of file diff --git a/setup.py b/setup.py index 287566d..553198e 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,9 @@ "murtree/code/MurTree/Data Structures/", "src/pymurtree/"], # passing in the version to the compiled code - define_macros=[('VERSION_INFO', __version__)] + define_macros=[('VERSION_INFO', __version__)], + language='c++', + cxx_std=11 ) ] diff --git a/src/pymurtree/OptimalDecisionTreeClassifier.py b/src/pymurtree/OptimalDecisionTreeClassifier.py index 53dabb0..b6241cc 100644 --- a/src/pymurtree/OptimalDecisionTreeClassifier.py +++ b/src/pymurtree/OptimalDecisionTreeClassifier.py @@ -1,6 +1,5 @@ import pandas as pd import numpy as np - from . import lib from pymurtree.parameters import Parameters @@ -34,10 +33,10 @@ class OptimalDecisionTreeClassifier: def __init__(self, time: int = 600, max_depth: int = 3, - max_num_nodes: int = 7, + max_num_nodes: int = None, sparse_coefficient: float = 0.0, - verbose: bool = True, - all_trees: bool = True, + verbose: bool = False, + all_trees: bool = False, incremental_frequency: bool = True, similarity_lower_bound: bool = True, node_selection: int = 0, @@ -50,6 +49,10 @@ def __init__(self, self.__solver = None self.__tree = None + if max_num_nodes is None: + max_num_nodes = 2**max_depth - 1 + max_num_nodes = min(2**max_depth - 1, max_num_nodes) + self.__params = Parameters(time, max_depth, max_num_nodes, sparse_coefficient, verbose, all_trees, incremental_frequency, diff --git a/src/pymurtree/exporttree.h b/src/pymurtree/exporttree.h index 0dedaf8..3946964 100644 --- a/src/pymurtree/exporttree.h +++ b/src/pymurtree/exporttree.h @@ -1,4 +1,5 @@ #include "solver_result.h" +#include class ExportTree {