This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
__init__.pyi
273 lines (260 loc) · 9.18 KB
/
__init__.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http:https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import overload
from typing import Any, Dict, Generic, Iterable, List, Optional, Tuple, TypeVar, Union
from pyspark.ml import linalg as newlinalg
from pyspark.sql.types import StructType, UserDefinedType
from numpy import float64, ndarray # type: ignore[import]
QT = TypeVar("QT")
RT = TypeVar("RT")
class VectorUDT(UserDefinedType):
@classmethod
def sqlType(cls) -> StructType: ...
@classmethod
def module(cls) -> str: ...
@classmethod
def scalaUDT(cls) -> str: ...
def serialize(
self, obj: Vector
) -> Tuple[int, Optional[int], Optional[List[int]], List[float]]: ...
def deserialize(self, datum: Any) -> Vector: ...
def simpleString(self) -> str: ...
class MatrixUDT(UserDefinedType):
@classmethod
def sqlType(cls) -> StructType: ...
@classmethod
def module(cls) -> str: ...
@classmethod
def scalaUDT(cls) -> str: ...
def serialize(
self, obj
) -> Tuple[
int, int, int, Optional[List[int]], Optional[List[int]], List[float], bool
]: ...
def deserialize(self, datum: Any) -> Matrix: ...
def simpleString(self) -> str: ...
class Vector:
__UDT__: VectorUDT
def toArray(self) -> ndarray: ...
def asML(self) -> newlinalg.Vector: ...
class DenseVector(Vector):
array: ndarray
@overload
def __init__(self, *elements: float) -> None: ...
@overload
def __init__(self, __arr: bytes) -> None: ...
@overload
def __init__(self, __arr: Iterable[float]) -> None: ...
@staticmethod
def parse(s) -> DenseVector: ...
def __reduce__(self) -> Tuple[type, bytes]: ...
def numNonzeros(self) -> int: ...
def norm(self, p: Union[float, str]) -> float64: ...
def dot(self, other: Iterable[float]) -> float64: ...
def squared_distance(self, other: Iterable[float]) -> float64: ...
def toArray(self) -> ndarray: ...
def asML(self) -> newlinalg.DenseVector: ...
@property
def values(self) -> ndarray: ...
def __getitem__(self, item: int) -> float64: ...
def __len__(self) -> int: ...
def __eq__(self, other: Any) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
def __hash__(self) -> int: ...
def __getattr__(self, item: str) -> Any: ...
def __neg__(self) -> DenseVector: ...
def __add__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __sub__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __mul__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __div__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __truediv__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __mod__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __radd__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __rsub__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __rmul__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __rdiv__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __rtruediv__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
def __rmod__(self, other: Union[float, Iterable[float]]) -> DenseVector: ...
class SparseVector(Vector):
size: int
indices: ndarray
values: ndarray
@overload
def __init__(self, size: int, *args: Tuple[int, float]) -> None: ...
@overload
def __init__(self, size: int, __indices: bytes, __values: bytes) -> None: ...
@overload
def __init__(
self, size: int, __indices: Iterable[int], __values: Iterable[float]
) -> None: ...
@overload
def __init__(self, size: int, __pairs: Iterable[Tuple[int, float]]) -> None: ...
@overload
def __init__(self, size: int, __map: Dict[int, float]) -> None: ...
def numNonzeros(self) -> int: ...
def norm(self, p: Union[float, str]) -> float64: ...
def __reduce__(self): ...
@staticmethod
def parse(s: str) -> SparseVector: ...
def dot(self, other: Iterable[float]) -> float64: ...
def squared_distance(self, other: Iterable[float]) -> float64: ...
def toArray(self) -> ndarray: ...
def asML(self) -> newlinalg.SparseVector: ...
def __len__(self) -> int: ...
def __eq__(self, other) -> bool: ...
def __getitem__(self, index: int) -> float64: ...
def __ne__(self, other) -> bool: ...
def __hash__(self) -> int: ...
class Vectors:
@overload
@staticmethod
def sparse(size: int, *args: Tuple[int, float]) -> SparseVector: ...
@overload
@staticmethod
def sparse(size: int, __indices: bytes, __values: bytes) -> SparseVector: ...
@overload
@staticmethod
def sparse(
size: int, __indices: Iterable[int], __values: Iterable[float]
) -> SparseVector: ...
@overload
@staticmethod
def sparse(size: int, __pairs: Iterable[Tuple[int, float]]) -> SparseVector: ...
@overload
@staticmethod
def sparse(size: int, __map: Dict[int, float]) -> SparseVector: ...
@overload
@staticmethod
def dense(self, *elements: float) -> DenseVector: ...
@overload
@staticmethod
def dense(self, __arr: bytes) -> DenseVector: ...
@overload
@staticmethod
def dense(self, __arr: Iterable[float]) -> DenseVector: ...
@staticmethod
def fromML(vec: newlinalg.DenseVector) -> DenseVector: ...
@staticmethod
def stringify(vector: Vector) -> str: ...
@staticmethod
def squared_distance(v1: Vector, v2: Vector) -> float64: ...
@staticmethod
def norm(vector: Vector, p: Union[float, str]) -> float64: ...
@staticmethod
def parse(s: str) -> Vector: ...
@staticmethod
def zeros(size: int) -> DenseVector: ...
class Matrix:
__UDT__: MatrixUDT
numRows: int
numCols: int
isTransposed: bool
def __init__(
self, numRows: int, numCols: int, isTransposed: bool = ...
) -> None: ...
def toArray(self): ...
def asML(self): ...
class DenseMatrix(Matrix):
values: Any
@overload
def __init__(
self, numRows: int, numCols: int, values: bytes, isTransposed: bool = ...
) -> None: ...
@overload
def __init__(
self,
numRows: int,
numCols: int,
values: Iterable[float],
isTransposed: bool = ...,
) -> None: ...
def __reduce__(self) -> Tuple[type, Tuple[int, int, bytes, int]]: ...
def toArray(self) -> ndarray: ...
def toSparse(self) -> SparseMatrix: ...
def asML(self) -> newlinalg.DenseMatrix: ...
def __getitem__(self, indices: Tuple[int, int]) -> float64: ...
def __eq__(self, other) -> bool: ...
class SparseMatrix(Matrix):
colPtrs: ndarray
rowIndices: ndarray
values: ndarray
@overload
def __init__(
self,
numRows: int,
numCols: int,
colPtrs: bytes,
rowIndices: bytes,
values: bytes,
isTransposed: bool = ...,
) -> None: ...
@overload
def __init__(
self,
numRows: int,
numCols: int,
colPtrs: Iterable[int],
rowIndices: Iterable[int],
values: Iterable[float],
isTransposed: bool = ...,
) -> None: ...
def __reduce__(self) -> Tuple[type, Tuple[int, int, bytes, bytes, bytes, int]]: ...
def __getitem__(self, indices: Tuple[int, int]) -> float64: ...
def toArray(self) -> ndarray: ...
def toDense(self) -> DenseMatrix: ...
def asML(self) -> newlinalg.SparseMatrix: ...
def __eq__(self, other) -> bool: ...
class Matrices:
@overload
@staticmethod
def dense(
numRows: int, numCols: int, values: bytes, isTransposed: bool = ...
) -> DenseMatrix: ...
@overload
@staticmethod
def dense(
numRows: int, numCols: int, values: Iterable[float], isTransposed: bool = ...
) -> DenseMatrix: ...
@overload
@staticmethod
def sparse(
numRows: int,
numCols: int,
colPtrs: bytes,
rowIndices: bytes,
values: bytes,
isTransposed: bool = ...,
) -> SparseMatrix: ...
@overload
@staticmethod
def sparse(
numRows: int,
numCols: int,
colPtrs: Iterable[int],
rowIndices: Iterable[int],
values: Iterable[float],
isTransposed: bool = ...,
) -> SparseMatrix: ...
@staticmethod
def fromML(mat: newlinalg.Matrix) -> Matrix: ...
class QRDecomposition(Generic[QT, RT]):
def __init__(self, Q: QT, R: RT) -> None: ...
@property
def Q(self) -> QT: ...
@property
def R(self) -> RT: ...