diff --git a/BUILD.md b/BUILD.md index ac4e98fd8e..9b8ec7ed9b 100644 --- a/BUILD.md +++ b/BUILD.md @@ -93,7 +93,7 @@ $ ./test/prims --gtest_list_tests # ML Primitive function tests 4. Build and install `libcumlcomms` (C++/CUDA library enabling multi-node multi-GPU communications), starting from the repository root folder: ```bash -$ cd cpp/comms +$ cd cpp/comms/std $ mkdir build && cd build $ cmake .. diff --git a/CHANGELOG.md b/CHANGELOG.md index ce58d7cbe8..3ba0cd49ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - PR #832: Stateless Decision Tree and Random Forest API - PR #857: Small modifications to comms for utilizing IB w/ Dask - PR #851: Random forest Stateless API wrappers +- PR #895: Pretty prints arguments! ## Bug Fixes @@ -34,6 +35,7 @@ - PR #849: PCA no attribute trans_input_ transform bug fix - PR #869: Removing incorrect information from KNN Docs - PR #885: libclang installation fix for GPUCI +- PR #896: Fix typo in comms build instructions # cuML 0.8.0 (27 June 2019) diff --git a/python/cuml/common/base.pyx b/python/cuml/common/base.pyx index df14dcd2c7..a5bce60be7 100644 --- a/python/cuml/common/base.pyx +++ b/python/cuml/common/base.pyx @@ -22,6 +22,7 @@ import cuml.common.handle import cuml.common.cuda +import inspect class Base: @@ -80,6 +81,27 @@ class Base: self.handle = cuml.common.handle.Handle() if handle is None else handle self.verbose = verbose + def __repr__(self): + """ + Pretty prints the arguments of a class using Sklearn standard :) + """ + cdef list signature = inspect.getfullargspec(self.__init__).args + if signature[0] == 'self': + del signature[0] + cdef dict state = self.__dict__ + cdef str string = self.__class__.__name__ + '(' + cdef str key + for key in signature: + if key not in state: + continue + if type(state[key]) is str: + string += "{}='{}', ".format(key, state[key]) + else: + if hasattr(state[key], "__str__"): + string += "{}={}, ".format(key, state[key]) + string = string.rstrip(', ') + return string + ')' + def get_param_names(self): """ Returns a list of hyperparameter names owned by this class. It is