Skip to content

Commit 866e939

Browse files
committed
Improving docstrings
1 parent 751b585 commit 866e939

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

sklearn/preprocessing/label.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ class LabelEncoder(BaseEstimator, TransformerMixin):
6868
- If an integer value is passed, then re-label with this value.
6969
N.B. that default values are in [0, 1, ...], so caution should be
7070
taken if a non-negative value is passed to not accidentally
71-
intersect.
71+
intersect. Additionally, ``inverse_transform`` will fail for a
72+
value that does not intersect with the ``fit``-time label set.
7273
7374
Attributes
7475
----------
7576
`classes_` : array of shape (n_class,)
76-
Holds the label for each class.
77+
Holds the label for each class that were seen at fit. See
78+
``get_classes()`` to retrieve all observed labels.
7779
7880
`new_label_mapping_` : dictionary
7981
Stores the mapping for classes not seen during original ``fit``.
@@ -130,6 +132,7 @@ def get_classes(self):
130132
"""
131133
# If we've seen updates, include them in the order they were added.
132134
if len(self.new_label_mapping_) > 0:
135+
# Sort the post-fit time labels to return into the class array.
133136
sorted_new, _ = zip(*sorted(self.new_label_mapping_.iteritems(),
134137
key=operator.itemgetter(1)))
135138
return np.append(self.classes_, sorted_new)

0 commit comments

Comments
 (0)