Skip to content

Commit 53b9940

Browse files
authored
Merge pull request #98 from sdpython/fixinit
Fixes #97, fix issue with deepcopy and criterion
2 parents 029928b + 8480703 commit 53b9940

File tree

4 files changed

+11
-26
lines changed

4 files changed

+11
-26
lines changed

.circleci/config.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@ jobs:
4848
command: |
4949
sudo apt-get install -y libgeos-dev libproj-dev proj-data graphviz
5050
51-
- run:
52-
name: Install llvmlite
53-
command: |
54-
sudo apt-get install lsb-release wget software-properties-common
55-
wget https://apt.llvm.org/llvm.sh
56-
chmod +x llvm.sh
57-
sudo ./llvm.sh 10
58-
ls /usr/bin/llvm*
59-
6051
- run:
6152
name: Install standard libraries
6253
command: |
@@ -74,15 +65,6 @@ jobs:
7465
pip install --no-binary shapely shapely
7566
pip install cartopy
7667
77-
- run:
78-
name: Install numba, llvmlite
79-
command: |
80-
python -m venv venv
81-
. venv/bin/activate
82-
# export LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config
83-
sudo ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
84-
pip install llvmlite numba
85-
8668
- run:
8769
name: install dependencies
8870
command: |

.travis.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ matrix:
1717

1818
before_install:
1919
- sudo apt-get install libgeos-dev libproj-dev proj-data graphviz libblas-dev liblapack-dev
20-
- wget https://apt.llvm.org/llvm.sh
21-
- chmod +x llvm.sh
22-
- sudo ./llvm.sh 10
23-
- ls /usr/bin/llvm*
24-
- export LLVM_CONFIG=/usr/bin/llvm-config
25-
# - sudo ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config
2620
- sudo apt-get -y install graphviz
2721

2822
install:

_unittests/ut_module/test_SKIP_code_style.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_style_src(self):
1616
check_pep8(src_, fLOG=fLOG,
1717
pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
1818
'W0201', 'W0221', 'E0632', 'R1702', 'W0212', 'W0223',
19-
'W0107', "R1720"),
19+
'W0107', "R1720", 'R1732'),
2020
skip=["categories_to_integers.py:174: W0640",
2121
"E0401: Unable to import 'mlinsights.mlmodel.piecewise_tree_regression_criterion",
2222
"setup.py:",
@@ -29,7 +29,8 @@ def test_style_test(self):
2929
test = os.path.normpath(os.path.join(thi, "..", ))
3030
check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
3131
pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
32-
'C0111', 'W0107', 'C0111', 'R1702', 'C0415', "R1720"),
32+
'C0111', 'W0107', 'C0111', 'R1702', 'C0415', "R1720",
33+
'R1732'),
3334
skip=["Instance of 'tuple' has no",
3435
"[E402] module level import",
3536
"E0611: No name '_test_criterion_",

mlinsights/mlmodel/_piecewise_tree_regression_common024.pyx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ cdef class CommonRegressorCriterion(Criterion):
4343
def __cinit__(self, const DOUBLE_t[:, ::1] X):
4444
self.sample_X = X
4545

46+
def __deepcopy__(self, memo=None):
47+
"""
48+
This does not a copy but mostly creates a new instance
49+
of the same criterion initialized with the same data.
50+
"""
51+
inst = self.__class__(self.sample_X)
52+
return inst
53+
4654
cdef void _update_weights(self, SIZE_t start, SIZE_t end, SIZE_t old_pos, SIZE_t new_pos) nogil:
4755
"""
4856
Updates members `weighted_n_right` and `weighted_n_left`

0 commit comments

Comments
 (0)