Skip to content
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

[REVIEW] Reduce duplicated cython code in RF #2237

Merged
merged 51 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0b4ccb5
update cython code
Salonijain27 May 11, 2020
bad3bda
pull 0.14 into branch
Salonijain27 May 11, 2020
9a9800a
update cython code
Salonijain27 May 13, 2020
5b3d59c
update branch using 0.14
Salonijain27 May 13, 2020
f229b79
update common file
Salonijain27 May 13, 2020
a77a468
ypdate predict func
Salonijain27 May 13, 2020
f4ddf13
created cdef class to assign rfmetadata
Salonijain27 May 14, 2020
6e64046
updated rf cython code
Salonijain27 May 21, 2020
546dd8c
update by pulling 0.14 into the branch
Salonijain27 May 21, 2020
69fba83
update the cython code and pull 0.14 into the branch
Salonijain27 May 27, 2020
32bc933
Merge branch 'branch-0.15' of https://github.com/rapidsai/cuml into r…
Salonijain27 May 27, 2020
89512da
updated docs and code:
Salonijain27 May 29, 2020
96f6d3a
merge 0.15 with code
Salonijain27 May 29, 2020
cff16d7
style check
Salonijain27 May 29, 2020
0fc2df1
fix style errors
Salonijain27 May 29, 2020
0c02d92
update CHANGELOG.md
Salonijain27 May 29, 2020
2dc70fd
updated code
Salonijain27 May 29, 2020
728600f
fixed style errors
Salonijain27 May 29, 2020
a7072d7
add error to obtain_treelite_handle func
Salonijain27 May 31, 2020
b120d7f
fix spacing issue
Salonijain27 May 31, 2020
edb6546
updated Changelog.md
Salonijain27 May 31, 2020
483e678
Merge branch 'branch-0.15' of https://github.com/rapidsai/cuml into r…
Salonijain27 Jun 1, 2020
81a34f3
update rf common
Salonijain27 Jun 2, 2020
494cdf6
remove rf common py file
Salonijain27 Jun 2, 2020
8f77cdf
update docs
Salonijain27 Jun 3, 2020
5866f17
update _create_model func to __init__
Salonijain27 Jun 10, 2020
3bfe631
update n_streams warning
Salonijain27 Jun 10, 2020
1fad538
Merge branch 'branch-0.15' into reduce_cython_dupli
Salonijain27 Jun 10, 2020
2a31c0c
update code based on reviews
Salonijain27 Jun 17, 2020
3de7ec8
Merge branch 'reduce_cython_dupli' of https://github.com/Salonijain27…
Salonijain27 Jun 17, 2020
acdc381
fix style errors
Salonijain27 Jun 17, 2020
4ed2fb7
remove obtain_treelite_model func from common
Salonijain27 Jun 17, 2020
61a6eb6
update by pulling 0.15
Salonijain27 Jun 17, 2020
f46a989
update rf and fil to accept storage type as bool or 'auto'
Salonijain27 Jun 17, 2020
a5fecce
update docs
Salonijain27 Jun 17, 2020
6afbad3
pull 0.15 into PR branch and fix conflicts
Salonijain27 Jun 17, 2020
fc0a713
fix merge conficts
Salonijain27 Jun 18, 2020
aee0037
update rf code
Salonijain27 Jun 19, 2020
845ec93
remove debugging code from base
Salonijain27 Jun 19, 2020
8fdccd4
update fil to accept string and boolean
Salonijain27 Jun 19, 2020
49915f1
update fil tests
Salonijain27 Jun 19, 2020
2c7f0be
Merge branch 'branch-0.15' into reduce_cython_dupli
dantegd Jun 22, 2020
3112675
update PR by pulling 0.15
Salonijain27 Jun 29, 2020
4e350d5
update CHANGELOG.md
Salonijain27 Jun 29, 2020
e567d96
Merge branch 'branch-0.15' of https://github.com/rapidsai/cuml into r…
Salonijain27 Jun 30, 2020
78e8b34
update benchmark algo.py file
Salonijain27 Jul 1, 2020
3da2a6b
update PR by pulling 0.15
Salonijain27 Jul 1, 2020
ddc5910
removed unnecessary cimport from common.pyx
Salonijain27 Jul 2, 2020
4e3f47f
resolve conflict
Salonijain27 Jul 9, 2020
33a0d89
resolve merge conflicts
Salonijain27 Jul 13, 2020
3a8f41b
update PR by resolving conflicts
Salonijain27 Jul 13, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- PR #2440: Use Treelite Conda package
- PR #2403: Support for input and output type consistency in logistic regression predict_proba
- PR #2468: Add `_n_features_in_` attribute to all single GPU estimators that implement fit
- PR #2237: Refactor RF cython code

## Bug Fixes
- PR #2369: Update RF code to fix set_params memory leak
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/benchmark/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def all_algorithms():
fil_algo="AUTO",
output_class=False,
threshold=0.5,
storage_type="AUTO",
storage_type="auto",
),
name="FIL",
accepts_labels=False,
Expand Down
3 changes: 2 additions & 1 deletion python/cuml/dask/ensemble/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ def _concat_treelite_models(self):
model._concatenate_treelite_handle(all_tl_mod_handles)
for tl_handle in all_tl_mod_handles:
TreeliteModel.free_treelite_model(tl_handle)

return model

def _predict_using_fil(self, X, delayed, **kwargs):
if self.local_model is None:
self.local_model = self._concat_treelite_models()
data = DistributedDataHandler.create(X, client=self.client)
self.datatype = data.datatype
return self._predict(X, delayed=delayed, **kwargs)
Expand Down
21 changes: 6 additions & 15 deletions python/cuml/dask/ensemble/randomforestclassifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,24 +295,15 @@ def predict(self, X, output_class=True, algo='auto', threshold=0.5,

else:
preds = \
self.predict_using_fil(X, output_class=output_class,
algo=algo,
threshold=threshold,
num_classes=self.num_classes,
convert_dtype=convert_dtype,
predict_model="GPU",
fil_sparse_format=fil_sparse_format,
delayed=delayed)
self._predict_using_fil(X, output_class=output_class,
algo=algo,
threshold=threshold,
convert_dtype=convert_dtype,
fil_sparse_format=fil_sparse_format,
delayed=delayed)

return preds

def predict_using_fil(self, X, delayed, **kwargs):
if self.local_model is None:
self.local_model = self._concat_treelite_models()

return self._predict_using_fil(X=X,
delayed=delayed,
**kwargs)
"""
TODO : Update function names used for CPU predict.
Cuml issue #1854 has been created to track this.
Expand Down
17 changes: 5 additions & 12 deletions python/cuml/dask/ensemble/randomforestregressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,13 @@ def predict(self, X, predict_model="GPU", algo='auto',

else:
preds = \
self.predict_using_fil(X, predict_model=predict_model,
algo=algo,
convert_dtype=convert_dtype,
fil_sparse_format=fil_sparse_format,
delayed=delayed)
self._predict_using_fil(X,
algo=algo,
convert_dtype=convert_dtype,
fil_sparse_format=fil_sparse_format,
delayed=delayed)
return preds

def predict_using_fil(self, X, delayed, **kwargs):
if self.local_model is None:
self.local_model = self._concat_treelite_models()
return self._predict_using_fil(X=X,
delayed=delayed,
**kwargs)

"""
TODO : Update function names used for CPU predict.
Cuml issue #1854 has been created to track this.
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/ensemble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
from cuml.ensemble.randomforestclassifier import RandomForestClassifier
from cuml.ensemble.randomforestregressor import RandomForestRegressor
from cuml.ensemble.randomforest_common import _check_fil_parameter_validity, \
_check_fil_sparse_format_value, _obtain_treelite_model, _obtain_fil_model
_obtain_fil_model
94 changes: 0 additions & 94 deletions python/cuml/ensemble/randomforest_common.py

This file was deleted.

Loading