Skip to content

Commit edbd6fe

Browse files
committed
move Identifiable to ml.util
1 parent 44c2405 commit edbd6fe

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

python/pyspark/ml/param/__init__.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,12 @@
1515
# limitations under the License.
1616
#
1717

18-
import uuid
1918
from abc import ABCMeta
2019

21-
__all__ = ['Param', 'Params']
22-
23-
24-
class Identifiable(object):
25-
"""
26-
Object with a unique ID.
27-
"""
20+
from pyspark.ml.util import Identifiable
2821

29-
def __init__(self):
30-
#: A unique id for the object. The default implementation
31-
#: concatenates the class name, "-", and 8 random hex chars.
32-
self.uid = type(self).__name__ + "-" + uuid.uuid4().hex[:8]
3322

34-
def __repr__(self):
35-
return self.uid
23+
__all__ = ['Param', 'Params']
3624

3725

3826
class Param(object):

python/pyspark/ml/util.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18+
import uuid
19+
1820

1921
def inherit_doc(cls):
2022
for name, func in vars(cls).items():
@@ -28,3 +30,17 @@ def inherit_doc(cls):
2830
func.__doc__ = parent_func.__doc__
2931
break
3032
return cls
33+
34+
35+
class Identifiable(object):
36+
"""
37+
Object with a unique ID.
38+
"""
39+
40+
def __init__(self):
41+
#: A unique id for the object. The default implementation
42+
#: concatenates the class name, "-", and 8 random hex chars.
43+
self.uid = type(self).__name__ + "-" + uuid.uuid4().hex[:8]
44+
45+
def __repr__(self):
46+
return self.uid

0 commit comments

Comments
 (0)