Skip to content

Fixes #97, fix issue with deepcopy and criterion #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ jobs:
command: |
sudo apt-get install -y libgeos-dev libproj-dev proj-data graphviz

- run:
name: Install llvmlite
command: |
sudo apt-get install lsb-release wget software-properties-common
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 10
ls /usr/bin/llvm*

- run:
name: Install standard libraries
command: |
Expand All @@ -74,15 +65,6 @@ jobs:
pip install --no-binary shapely shapely
pip install cartopy

- run:
name: Install numba, llvmlite
command: |
python -m venv venv
. venv/bin/activate
# export LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config
sudo ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
pip install llvmlite numba

- run:
name: install dependencies
command: |
Expand Down
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ matrix:

before_install:
- sudo apt-get install libgeos-dev libproj-dev proj-data graphviz libblas-dev liblapack-dev
- wget https://apt.llvm.org/llvm.sh
- chmod +x llvm.sh
- sudo ./llvm.sh 10
- ls /usr/bin/llvm*
- export LLVM_CONFIG=/usr/bin/llvm-config
# - sudo ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
- sudo apt-get -y install graphviz

install:
Expand Down
5 changes: 3 additions & 2 deletions _unittests/ut_module/test_SKIP_code_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_style_src(self):
check_pep8(src_, fLOG=fLOG,
pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
'W0201', 'W0221', 'E0632', 'R1702', 'W0212', 'W0223',
'W0107', "R1720"),
'W0107', "R1720", 'R1732'),
skip=["categories_to_integers.py:174: W0640",
"E0401: Unable to import 'mlinsights.mlmodel.piecewise_tree_regression_criterion",
"setup.py:",
Expand All @@ -29,7 +29,8 @@ def test_style_test(self):
test = os.path.normpath(os.path.join(thi, "..", ))
check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
'C0111', 'W0107', 'C0111', 'R1702', 'C0415', "R1720"),
'C0111', 'W0107', 'C0111', 'R1702', 'C0415', "R1720",
'R1732'),
skip=["Instance of 'tuple' has no",
"[E402] module level import",
"E0611: No name '_test_criterion_",
Expand Down
8 changes: 8 additions & 0 deletions mlinsights/mlmodel/_piecewise_tree_regression_common024.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ cdef class CommonRegressorCriterion(Criterion):
def __cinit__(self, const DOUBLE_t[:, ::1] X):
self.sample_X = X

def __deepcopy__(self, memo=None):
"""
This does not a copy but mostly creates a new instance
of the same criterion initialized with the same data.
"""
inst = self.__class__(self.sample_X)
return inst

cdef void _update_weights(self, SIZE_t start, SIZE_t end, SIZE_t old_pos, SIZE_t new_pos) nogil:
"""
Updates members `weighted_n_right` and `weighted_n_left`
Expand Down