Skip to content

Commit

Permalink
Fix docs and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Sep 18, 2024
1 parent 8915cdb commit 72f8315
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/user_guide/fit_predict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The default quantiles can be overwritten at prediction time by specifying a valu
>>> y_pred.ndim == 1
True

The output of the `predict` method is an array with one column for each specified quantile or a single column if no quantiles are specified. The order of the output columns corresponds to the order of the quantiles, which can be specified in any order (i.e., they do not need to be monotonically ordered)::
The output of the `predict` method is an array with one column for each specified quantile or a single column if an individual quantile is specified. The order of the output columns corresponds to the order of the quantiles, which can be specified in any order (i.e., they do not need to be monotonically ordered)::

>>> y_pred = qrf.predict(X_test, quantiles=[0.5, 0.25, 0.75])
>>> bool((y_pred[:, 0] >= y_pred[:, 1]).all())
Expand Down
10 changes: 5 additions & 5 deletions quantile_forest/_quantile_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _get_y_train_leaves_slice(
Returns
-------
y_train_leaves_slice : array-like of shape \
(n_leaves, n_outputs, n_samples)
(n_leaves, n_outputs, n_indices)
Mapping of training sample indices to tree's leaf nodes. Nodes with
no samples (e.g., internal nodes) are empty. Internal nodes are
included so that leaf node indices match their ``est.apply``
Expand Down Expand Up @@ -590,7 +590,7 @@ def _get_unsampled_indices(self, estimator, duplicates=None):
Returns
-------
unsampled_indices : array of shape (n_unsampled)
unsampled_indices : array of shape (n_unsampled,)
Unsampled indices.
"""
if not self.bootstrap:
Expand Down Expand Up @@ -686,7 +686,7 @@ def predict(
Returns
-------
y_pred : array of shape (n_samples, n_quantiles) or \
y_pred : array of shape (n_samples,) or (n_samples, n_quantiles) or \
(n_samples, n_outputs, n_quantiles)
If quantiles is set to 'mean', then return ``E(Y | X)``. Else, for
all quantiles, return ``y`` at ``q`` for which ``F(Y=y|x) = q``,
Expand Down Expand Up @@ -811,7 +811,7 @@ def quantile_ranks(
``dtype=np.float32``. If a sparse matrix is provided, it will be
converted into a sparse ``csr_matrix``.
y : array-like of shape (n_samples) or (n_samples, n_outputs)
y : array-like of shape (n_samples,) or (n_samples, n_outputs)
The target values for which to calculate ranks.
kind : {"rank", "weak", "strict", "mean"}, default="rank"
Expand Down Expand Up @@ -848,7 +848,7 @@ def quantile_ranks(
Returns
-------
y_ranks : array of shape (n_samples) or (n_samples, n_outputs)
y_ranks : array of shape (n_samples,) or (n_samples, n_outputs)
Quantile ranks in range [0, 1].
"""
check_is_fitted(self)
Expand Down
6 changes: 3 additions & 3 deletions quantile_forest/_quantile_forest_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ cpdef vector[double] calc_quantile(
Returns
-------
out : array-like of shape (n_quantiles)
out : array-like of shape (n_quantiles,)
Quantiles for `inputs` as floats. Empty list if empty inputs.
"""
cdef double C = 1
Expand Down Expand Up @@ -255,7 +255,7 @@ cpdef vector[double] calc_weighted_quantile(
Returns
-------
out : array-like of shape (n_quantiles)
out : array-like of shape (n_quantiles,)
Quantiles for `inputs` as floats. Empty list if empty inputs.
"""
cdef double C = 1
Expand Down Expand Up @@ -572,7 +572,7 @@ cdef class QuantileForest:
Parameters
----------
quantiles : list of floats
Quantiles the in range [0, 1] to compute. -1 to compute mean.
Quantiles in the range [0, 1] to compute. -1 to compute mean.
X_leaves : array-like of shape (n_samples, n_estimators)
Target leaf node indices along samples and trees.
Expand Down
8 changes: 4 additions & 4 deletions quantile_forest/_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cpdef vector[intp_t] generate_unsampled_indices(
Parameters
----------
sample_indices : array-like of shape (n_samples)
sample_indices : array-like of shape (n_samples,)
Sampled indices.
n_total_samples : int
Expand Down Expand Up @@ -112,7 +112,7 @@ cpdef group_indices_by_value(cnp.ndarray[intp_t, ndim=1] a):
Parameters
----------
a : array-like of shape (n_samples)
a : array-like of shape (n_samples,)
Input array. The array is expected to contain integers, and the
function will group the indices of elements with the same value.
Expand Down Expand Up @@ -198,7 +198,7 @@ cpdef map_indices_to_leaves(
Parameters
----------
y_train_leaves_slice : array-like of shape (n_leaves, n_outputs, n_samples)
y_train_leaves_slice : array-like of shape (n_leaves, n_outputs, n_indices)
Unpopulated mapping representing a list of nodes, each with a list of
indices of the training samples residing at that node.
Expand All @@ -213,7 +213,7 @@ cpdef map_indices_to_leaves(
Returns
-------
y_train_leaves_slice : array-like of shape (n_leaves, n_outputs, n_samples)
y_train_leaves_slice : array-like of shape (n_leaves, n_outputs, n_indices)
Populated mapping of training sample indices to leaf nodes. Nodes with
no samples (e.g., internal nodes) are empty. Internal nodes are
included so that leaf node indices match their ``est.apply`` outputs.
Expand Down

0 comments on commit 72f8315

Please sign in to comment.