Skip to content

Commit

Permalink
minor changes to docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
arogozhnikov committed Apr 23, 2015
1 parent 270ebcc commit fc0ad15
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions rep/report/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@

__author__ = 'Alex Rogozhnikov'

"""
About
this file contains definitions for useful metrics.
# About
# this file contains definitions for useful metrics in specific format.
In general case, metrics follows standard sklearn convention for **estimators**, provides:
# In general case, metrics follows standard sklearn convention for estimators, provides
# - constructor
# m = metrics(parameter=1)
# - fitting, where checks and heavy computations performed.
# m.fit(X, y, sample_weight=None)
# - computation of metrics by probabilities:
# proba = classifier.predict_proba(X)
# m(proba)
Constructor
>>> m = metrics(parameter=1)
Fitting, where checks and heavy computations performed.
>>> m.fit(X, y, sample_weight=None)
Computation of metrics by probabilities:
>>> proba = classifier.predict_proba(X)
>>> m(y, proba, sample_weight=None)
"""


class MetricMixin(object):
"""Class with helpful methods for metrics,
metrics are expected (but not obliged) to be derived from it."""
def prepare(self, X, y, sample_weight):
assert len(X) == len(y), 'Lengths are different!'
sample_weight = check_sample_weight(y, sample_weight=sample_weight)
Expand Down

0 comments on commit fc0ad15

Please sign in to comment.