This is an automated email from the ASF dual-hosted git repository.
zero323 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 564a16ddd51 [SPARK-3723][FOLLOW-UP][PYTHON][MLLIB] Rename method type
and dist name literals
564a16ddd51 is described below
commit 564a16ddd51e6fe16aafe981f3b09ed3aa4aaa94
Author: zero323 <[email protected]>
AuthorDate: Mon Apr 11 11:00:32 2022 +0200
[SPARK-3723][FOLLOW-UP][PYTHON][MLLIB] Rename method type and dist name
literals
### What changes were proposed in this pull request?
This PR renames the following literal types:
- `CorrelationMethod` -> `CorrMethodType`
- `DistName`-> `KolmogorovSmirnovTestDistNameType`
in `pyspark.mllib._typing`
### Why are the changes needed?
Consistency with existing codebase.
### Does this PR introduce _any_ user-facing change?
No, this feature hasn't been released yet.
### How was this patch tested?
Existing tests.
Closes #36130 from zero323/SPARK-37234-FOLLOWUP.
Authored-by: zero323 <[email protected]>
Signed-off-by: zero323 <[email protected]>
---
python/pyspark/mllib/_typing.pyi | 4 ++--
python/pyspark/mllib/stat/_statistics.py | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/python/pyspark/mllib/_typing.pyi b/python/pyspark/mllib/_typing.pyi
index 4fbaeca39be..f196bd544bf 100644
--- a/python/pyspark/mllib/_typing.pyi
+++ b/python/pyspark/mllib/_typing.pyi
@@ -28,6 +28,6 @@ VectorLike = Union[ndarray, Vector, List[float], Tuple[float,
...]]
C = TypeVar("C", bound=type)
JavaObjectOrPickleDump = Union[JavaObject, bytearray, bytes]
-CorrelationMethod = Union[Literal["spearman"], Literal["pearson"]]
-DistName = Literal["norm"]
+CorrMethodType = Union[Literal["spearman"], Literal["pearson"]]
+KolmogorovSmirnovTestDistNameType = Literal["norm"]
NormType = Union[None, float, Literal["fro"], Literal["nuc"]]
diff --git a/python/pyspark/mllib/stat/_statistics.py
b/python/pyspark/mllib/stat/_statistics.py
index 25095d99dd9..a784e0e3173 100644
--- a/python/pyspark/mllib/stat/_statistics.py
+++ b/python/pyspark/mllib/stat/_statistics.py
@@ -28,7 +28,7 @@ from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.stat.test import ChiSqTestResult,
KolmogorovSmirnovTestResult
if TYPE_CHECKING:
- from pyspark.mllib._typing import CorrelationMethod, DistName
+ from pyspark.mllib._typing import CorrMethodType,
KolmogorovSmirnovTestDistNameType
__all__ = ["MultivariateStatisticalSummary", "Statistics"]
@@ -106,19 +106,19 @@ class Statistics:
@overload
@staticmethod
- def corr(x: RDD[Vector], *, method: Optional["CorrelationMethod"] = ...)
-> Matrix:
+ def corr(x: RDD[Vector], *, method: Optional["CorrMethodType"] = ...) ->
Matrix:
...
@overload
@staticmethod
- def corr(x: RDD[float], y: RDD[float], method:
Optional["CorrelationMethod"] = ...) -> float:
+ def corr(x: RDD[float], y: RDD[float], method: Optional["CorrMethodType"]
= ...) -> float:
...
@staticmethod
def corr(
x: Union[RDD[Vector], RDD[float]],
y: Optional[RDD[float]] = None,
- method: Optional["CorrelationMethod"] = None,
+ method: Optional["CorrMethodType"] = None,
) -> Union[float, Matrix]:
"""
Compute the correlation (matrix) for the input RDD(s) using the
@@ -313,7 +313,7 @@ class Statistics:
@staticmethod
def kolmogorovSmirnovTest(
- data: RDD[float], distName: "DistName" = "norm", *params: float
+ data: RDD[float], distName: "KolmogorovSmirnovTestDistNameType" =
"norm", *params: float
) -> KolmogorovSmirnovTestResult:
"""
Performs the Kolmogorov-Smirnov (KS) test for data sampled from
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]