|
1 | 1 | import sys |
2 | 2 | from _typeshed import SupportsRichComparisonT |
3 | | -from collections.abc import Hashable, Iterable, Sequence |
| 3 | +from collections.abc import Callable, Hashable, Iterable, Sequence |
4 | 4 | from decimal import Decimal |
5 | 5 | from fractions import Fraction |
6 | 6 | from typing import Any, Literal, NamedTuple, SupportsFloat, TypeVar |
@@ -28,6 +28,8 @@ __all__ = [ |
28 | 28 |
|
29 | 29 | if sys.version_info >= (3, 10): |
30 | 30 | __all__ += ["covariance", "correlation", "linear_regression"] |
| 31 | +if sys.version_info >= (3, 13): |
| 32 | + __all__ += ["kde", "kde_random"] |
31 | 33 |
|
32 | 34 | # Most functions in this module accept homogeneous collections of one of these types |
33 | 35 | _Number: TypeAlias = float | Decimal | Fraction |
@@ -130,3 +132,30 @@ if sys.version_info >= (3, 11): |
130 | 132 |
|
131 | 133 | elif sys.version_info >= (3, 10): |
132 | 134 | def linear_regression(regressor: Sequence[_Number], dependent_variable: Sequence[_Number], /) -> LinearRegression: ... |
| 135 | + |
| 136 | +if sys.version_info >= (3, 13): |
| 137 | + _Kernel: TypeAlias = Literal[ |
| 138 | + "normal", |
| 139 | + "gauss", |
| 140 | + "logistic", |
| 141 | + "sigmoid", |
| 142 | + "rectangular", |
| 143 | + "uniform", |
| 144 | + "triangular", |
| 145 | + "parabolic", |
| 146 | + "epanechnikov", |
| 147 | + "quartic", |
| 148 | + "biweight", |
| 149 | + "triweight", |
| 150 | + "cosine", |
| 151 | + ] |
| 152 | + def kde( |
| 153 | + data: Sequence[float], h: float, kernel: _Kernel = "normal", *, cumulative: bool = False |
| 154 | + ) -> Callable[[float], float]: ... |
| 155 | + def kde_random( |
| 156 | + data: Sequence[float], |
| 157 | + h: float, |
| 158 | + kernel: _Kernel = "normal", |
| 159 | + *, |
| 160 | + seed: int | float | str | bytes | bytearray | None = None, # noqa: Y041 |
| 161 | + ) -> Callable[[], float]: ... |
0 commit comments