Skip to content

Commit

Permalink
Fix docstrings (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson authored Feb 15, 2024
1 parent ae4e43d commit 2f72d83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions quantile_forest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""`quantile_forest` module that implements quantile regression forests."""

import os
import sys

Expand Down
10 changes: 7 additions & 3 deletions quantile_forest/_quantile_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(
max_samples=None,
max_samples_leaf=1,
):
"""Initialize base quantile forest regressor."""
init_dict = {
(
"base_estimator" if sklearn_version < parse_version("1.2.0") else "estimator"
Expand Down Expand Up @@ -208,6 +209,7 @@ def fit(self, X, y, sample_weight=None, sparse_pickle=False):

def _get_y_train_leaves(self, X, y_dim, sorter=None, sample_weight=None):
"""Return a mapping of each leaf node to its list of training indices.
The ``apply`` function is used on the ``X`` values to obtain the leaf
indices for the appropriate training indices, as sorted by ``sorter``.
Expand Down Expand Up @@ -612,7 +614,7 @@ def quantile_ranks(
indices=None,
duplicates=None,
):
"""Returns quantile ranks for X with scores y.
"""Return quantile ranks for X with scores y.
A quantile rank of, for example, 0.8 means that 80% of the scores in
`inputs` are below the given score.
Expand Down Expand Up @@ -716,7 +718,7 @@ def proximity_counts(
indices=None,
duplicates=None,
):
"""Returns training proximity counts for input samples.
"""Return training proximity counts for input samples.
Parameters
----------
Expand Down Expand Up @@ -811,7 +813,7 @@ def proximity_counts(
return proximities

def score(self, X, y, quantiles=0.5, sample_weight=None):
"""Returns the coefficient of determination R^2 of the prediction.
"""Return the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the residual
sum of squares ((y_true - y_pred) ** 2).sum() and v is the total
Expand Down Expand Up @@ -1093,6 +1095,7 @@ def __init__(
ccp_alpha=0.0,
max_samples=None,
):
"""Initialize random forest quantile regressor."""
init_dict = {
"estimator": DecisionTreeRegressor(),
"n_estimators": n_estimators,
Expand Down Expand Up @@ -1381,6 +1384,7 @@ def __init__(
ccp_alpha=0.0,
max_samples=None,
):
"""Initialize extra trees quantile regressor."""
init_dict = {
"estimator": ExtraTreeRegressor(),
"n_estimators": n_estimators,
Expand Down
1 change: 1 addition & 0 deletions quantile_forest/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Test module."""

0 comments on commit 2f72d83

Please sign in to comment.