Skip to content

Commit

Permalink
Merge branch 't-doc' into xgboostlss
Browse files Browse the repository at this point in the history
  • Loading branch information
fkiraly committed Jan 25, 2025
2 parents 55e90d0 + e817003 commit c1d9bd9
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 6 deletions.
41 changes: 40 additions & 1 deletion extension_templates/distributions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
"""Extension template for probability distributions - simple pattern."""
"""Extension template for probability distributions - simple pattern.
Purpose of this implementation template:
quick implementation of new estimators following the template
NOT a concrete class to import! This is NOT a base class or concrete class!
This is to be used as a "fill-in" coding template.
How to use this implementation template to implement a new distribution:
- make a copy of the template in a suitable location, give it a descriptive name.
- work through all the "todo" comments below
- fill in code for mandatory methods, and optionally for optional methods
- do not write to reserved attributes: index, columns, head, tail, loc, iloc, at, iat,
shape, ndim, _bc_params, _tags, _tags_dynamic, _config, _config_dynamic
- you can add more private methods, but do not override BaseEstimator's private methods
an easy way to be safe is to prefix your methods with "_custom"
- change docstrings for functions and the file
- ensure interface compatibility by skpro.utils.estimator_checks.check_estimator
- once complete: use as a local library, or contribute to skpro via PR
- more details:
https://www.sktime.net/en/stable/developer_guide/add_estimators.html
Mandatory methods to implement: at least one, better both of
sampling - sample(self, n_samples=None)
ppf - _ppf(self, p)
Optional methods to implement:
mean - _mean(self)
variance - _var(self)
pdf - _pdf(self, x)
log_pdf - _log_pdf(self, x)
pmf - _pmf(self, x)
log_pmf - _log_pmf(self, x)
cdf - _cdf(self, x)
ppf - _ppf(self, p)
energy_self - _energy_self(self)
energy_x - _energy_x(self, x)
Testing - required for test framework and check_estimator usage:
get default parameters for test instance(s) - get_test_params()
"""
# todo: write an informative docstring for the file or module, remove the above
# todo: add an appropriate copyright notice for your estimator
# estimators contributed to skpro should have the copyright notice at the top
Expand Down
37 changes: 36 additions & 1 deletion extension_templates/regression.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
"""Extension template for regressors."""
"""Extension template for regressors.
Purpose of this implementation template:
quick implementation of new estimators following the template
NOT a concrete class to import! This is NOT a base class or concrete class!
This is to be used as a "fill-in" coding template.
How to use this implementation template to implement a new distribution:
- make a copy of the template in a suitable location, give it a descriptive name.
- work through all the "todo" comments below
- fill in code for mandatory methods, and optionally for optional methods
- do not write to reserved attributes: is_fitted, _is_fitted, _X_metadata, _y_metadata,
_tags, _tags_dynamic, _config, _config_dynamic
- you can add more private methods, but do not override BaseEstimator's private methods
an easy way to be safe is to prefix your methods with "_custom"
- change docstrings for functions and the file
- ensure interface compatibility by skpro.utils.estimator_checks.check_estimator
- once complete: use as a local library, or contribute to skpro via PR
- more details:
https://www.sktime.net/en/stable/developer_guide/add_estimators.html
Mandatory methods to implement:
fitting - _fit(self, X, y)
At least one of the following probabilistic prediction methods:
predicting quantiles - _predict_quantiles(self, X, alpha=None)
OR predicting intervals - _predict_interval(self, X, coverage=None)
OR predicting distribution - _predict_proba(self, X)
Optional methods to implement:
predicting variance - _predict_var(self, X, cov=False)
updating - _update(self, X, y)
Testing - required for test framework and check_estimator usage:
get default parameters for test instance(s) - get_test_params()
"""
# todo: write an informative docstring for the file or module, remove the above
# todo: add an appropriate copyright notice for your estimator
# estimators contributed to skpro should have the copyright notice at the top
Expand Down
39 changes: 38 additions & 1 deletion extension_templates/survival.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
"""Extension template for time-to-event predictors aka survival predictors."""
"""Extension template for time-to-event predictors aka survival predictors.
Purpose of this implementation template:
quick implementation of new estimators following the template
NOT a concrete class to import! This is NOT a base class or concrete class!
This is to be used as a "fill-in" coding template.
How to use this implementation template to implement a new distribution:
- make a copy of the template in a suitable location, give it a descriptive name.
- work through all the "todo" comments below
- fill in code for mandatory methods, and optionally for optional methods
- do not write to reserved attributes: is_fitted, _is_fitted, _X_metadata, _y_metadata,
_tags, _tags_dynamic, _config, _config_dynamic
- you can add more private methods, but do not override BaseEstimator's private methods
an easy way to be safe is to prefix your methods with "_custom"
- change docstrings for functions and the file
- ensure interface compatibility by skpro.utils.estimator_checks.check_estimator
- once complete: use as a local library, or contribute to skpro via PR
- more details:
https://www.sktime.net/en/stable/developer_guide/add_estimators.html
Mandatory methods to implement:
fitting - _fit(self, X, y, C=None)
The method must handle the case C=None, as well as the case where C is a pd.DataFrame.
At least one of the following probabilistic prediction methods:
predicting quantiles - _predict_quantiles(self, X, alpha=None)
OR predicting intervals - _predict_interval(self, X, coverage=None)
OR predicting distribution - _predict_proba(self, X)
Optional methods to implement:
predicting variance - _predict_var(self, X, cov=False)
updating - _update(self, X, y)
Testing - required for test framework and check_estimator usage:
get default parameters for test instance(s) - get_test_params()
"""
# todo: write an informative docstring for the file or module, remove the above
# todo: add an appropriate copyright notice for your estimator
# estimators contributed to skpro should have the copyright notice at the top
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ classifiers = [
]
requires-python = ">=3.9,<3.14"
dependencies = [
"numpy>=1.21.0,<2.2",
"numpy>=1.21.0,<2.3",
"pandas>=1.1.0,<2.3.0",
"packaging",
"scikit-base>=0.6.1,<0.13.0",
Expand Down
4 changes: 2 additions & 2 deletions skpro/distributions/t.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class TDistribution(BaseDistribution):
Parameters
----------
mean : float or array of float (1D or 2D)
median of the t-distribution distribution.
median of the t-distribution.
Same as the mean, if it exists.
sd : float or array of float (1D or 2D), must be positive
scale parameter of the t-distribution.
Same as the standard deviation in the limit of large degrees of freedom.
df : float or array of float (1D or 2D), must be positive
Degrees of freedom of the t-distribution
Degrees of freedom of the t-distribution.
index : pd.Index, optional, default = RangeIndex
columns : pd.Index, optional, default = RangeIndex
Expand Down

0 comments on commit c1d9bd9

Please sign in to comment.