-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG] PyPy support #11010
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
[MRG] PyPy support #11010
Changes from all commits
6e2f4df
13c2469
be622fa
5d7d25d
2857205
cb02f29
cb56013
7f381fc
40b12e7
f482cee
85e4ee7
dd3647d
7222ce7
11cc6fb
f86c60e
3d99fca
37a0294
8e90d56
275c6d7
7e80717
46878e2
4b239d6
c4c2995
456f94d
1b95ac9
02454b9
9a5d71e
5faf55e
b5fbe28
5958a23
ef14a60
2b98923
0bc6753
a300228
9c29561
ac8c286
2faea96
006ecc0
218c529
3634eaf
695585b
a7dd224
4636266
f3007a3
eb85b96
9cc0970
7cdc822
0d971d4
6c95101
5702aac
82302d6
dbc192c
4931d94
47f9f76
b538e8e
122f38b
71ec01c
9f9aebd
33f2f3a
66fcbe7
40ada79
b71e79f
6390cf6
ae76d01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
set -x | ||
set -e | ||
|
||
apt-get -yq update | ||
apt-get -yq install libatlas-dev libatlas-base-dev liblapack-dev gfortran ccache | ||
|
||
pip install virtualenv | ||
|
||
if command -v pypy3; then | ||
virtualenv -p $(command -v pypy3) pypy-env | ||
elif command -v pypy; then | ||
virtualenv -p $(command -v pypy) pypy-env | ||
fi | ||
|
||
source pypy-env/bin/activate | ||
|
||
python --version | ||
which python | ||
|
||
pip install --extra-index https://antocuni.github.io/pypy-wheels/ubuntu numpy==1.14.4 Cython pytest | ||
pip install "scipy>=1.1.0" sphinx numpydoc docutils | ||
|
||
ccache -M 512M | ||
export CCACHE_COMPRESS=1 | ||
export PATH=/usr/lib/ccache:$PATH | ||
|
||
pip install -e . | ||
|
||
make test |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1336,12 +1336,14 @@ def _resize_state(self): | |
raise ValueError('resize with smaller n_estimators %d < %d' % | ||
(total_n_estimators, self.estimators_[0])) | ||
|
||
self.estimators_.resize((total_n_estimators, self.loss_.K)) | ||
self.train_score_.resize(total_n_estimators) | ||
self.estimators_ = np.resize(self.estimators_, | ||
(total_n_estimators, self.loss_.K)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure the difference here between
Maybe @amueller or @glemaitre would have an opinion?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your comment mixes up Probably numpy should never have supported such a dangerous operation in the first place, but these things happen... On CPython, numpy can use the refcount to check if the operation is even possibly-maybe safe, and only allows it if there are no other references to the array. On PyPy, there are no refcounts, so numpy is conservative and assumes views might exist. If you're really sure that this is what you want to do, and are prepared to accept the risks, then you can pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the insightful comment!
Yes, definitely I meant |
||
self.train_score_ = np.resize(self.train_score_, total_n_estimators) | ||
if (self.subsample < 1 or hasattr(self, 'oob_improvement_')): | ||
# if do oob resize arrays or create new if not available | ||
if hasattr(self, 'oob_improvement_'): | ||
self.oob_improvement_.resize(total_n_estimators) | ||
self.oob_improvement_ = np.resize(self.oob_improvement_, | ||
total_n_estimators) | ||
else: | ||
self.oob_improvement_ = np.zeros((total_n_estimators,), | ||
dtype=np.float64) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, not using a context manager here results in an empty file when
load_svmlight_file
is called. Probably due to GC differences,