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] Small fixes for mid-release bug squash #2829

Merged
merged 11 commits into from
Sep 18, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- PR #2810: Update Rf MNMG threshold to prevent sporadic test failure
- PR #2808: Relax Doxygen version required in CMake to coincide with integration repo
- PR #2818: Fix parsing of singlegpu option in build command
- PR #2829: Fixing description for labels in docs and removing row number constraint from PCA xform/inverse_xform

# cuML 0.15.0 (Date TBD)

Expand Down
17 changes: 10 additions & 7 deletions cpp/src/pca/pca.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,15 @@ void pcaInverseTransform(const raft::handle_t &handle, math_t *trans_input,
cudaStream_t stream) {
ASSERT(prms.n_cols > 1,
"Parameter n_cols: number of columns cannot be less than two");
ASSERT(prms.n_rows > 1,
"Parameter n_rows: number of rows cannot be less than two");
ASSERT(prms.n_rows > 0,
"Parameter n_rows: number of rows cannot be less than one");
ASSERT(
prms.n_components > 0,
"Parameter n_components: number of components cannot be less than one");

if (prms.whiten) {
math_t scalar = math_t(1 / sqrt(prms.n_rows - 1));
math_t sqrt_n_samples = sqrt(prms.n_rows - 1);
math_t scalar = prms.n_rows - 1 > 0 ? math_t(1 / sqrt_n_samples) : 0;
LinAlg::scalarMultiply(components, components, scalar,
prms.n_rows * prms.n_components, stream);
Matrix::matrixVectorBinaryMultSkipZero(components, singular_vals,
Expand All @@ -190,7 +191,8 @@ void pcaInverseTransform(const raft::handle_t &handle, math_t *trans_input,
Matrix::matrixVectorBinaryDivSkipZero(components, singular_vals,
prms.n_rows, prms.n_components, true,
true, stream);
math_t scalar = math_t(sqrt(prms.n_rows - 1));
math_t sqrt_n_samples = sqrt(prms.n_rows - 1);
math_t scalar = prms.n_rows - 1 > 0 ? math_t(1 / sqrt_n_samples) : 0;
LinAlg::scalarMultiply(components, components, scalar,
prms.n_rows * prms.n_components, stream);
}
Expand Down Expand Up @@ -226,8 +228,8 @@ void pcaTransform(const raft::handle_t &handle, math_t *input,
cudaStream_t stream) {
ASSERT(prms.n_cols > 1,
"Parameter n_cols: number of columns cannot be less than two");
ASSERT(prms.n_rows > 1,
"Parameter n_rows: number of rows cannot be less than two");
ASSERT(prms.n_rows > 0,
"Parameter n_rows: number of rows cannot be less than one");
ASSERT(
prms.n_components > 0,
"Parameter n_components: number of components cannot be less than one");
Expand All @@ -251,7 +253,8 @@ void pcaTransform(const raft::handle_t &handle, math_t *input,
Matrix::matrixVectorBinaryMultSkipZero(components, singular_vals,
prms.n_rows, prms.n_components, true,
true, stream);
math_t scalar = math_t(1 / sqrt(prms.n_rows - 1));
math_t sqrt_n_samples = sqrt(prms.n_rows - 1);
math_t scalar = prms.n_rows - 1 > 0 ? math_t(1 / sqrt_n_samples) : 0;
LinAlg::scalarMultiply(components, components, scalar,
prms.n_rows * prms.n_components, stream);
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/tsvd/tsvd.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ void tsvdTransform(const raft::handle_t &handle, math_t *input,

ASSERT(prms.n_cols > 1,
"Parameter n_cols: number of columns cannot be less than two");
ASSERT(prms.n_rows > 1,
"Parameter n_rows: number of rows cannot be less than two");
ASSERT(prms.n_rows > 0,
"Parameter n_rows: number of rows cannot be less than one");
ASSERT(
prms.n_components > 0,
"Parameter n_components: number of components cannot be less than one");
Expand Down Expand Up @@ -303,7 +303,7 @@ void tsvdInverseTransform(const raft::handle_t &handle, math_t *trans_input,

ASSERT(prms.n_cols > 1,
"Parameter n_cols: number of columns cannot be less than one");
ASSERT(prms.n_rows > 1,
ASSERT(prms.n_rows > 0,
"Parameter n_rows: number of rows cannot be less than one");
ASSERT(
prms.n_components > 0,
Expand Down
6 changes: 5 additions & 1 deletion python/cuml/common/doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,14 @@ def deco(func):
pass

# X and y are the most common
elif par in ['X', 'y'] and par not in skip_parameters:
elif par == 'X' and par not in skip_parameters:
func.__doc__ += \
_parameters_docstrings[X].format(name=par,
shape=X_shape)
elif par == 'y' and par not in skip_parameters:
func.__doc__ += \
_parameters_docstrings[y].format(name=par,
shape=y_shape)

# convert_dtype requires some magic to distinguish
# whether we use the fit version or the version
Expand Down