Skip to content

Commit

Permalink
chore: fix docstrings in skll.metrics module.
Browse files Browse the repository at this point in the history
  • Loading branch information
desilinguist committed Jun 14, 2023
1 parent 0fd87ce commit c0ebc36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion skll/learner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def get_feature_names_out(self) -> np.ndarray:
------
ValueError
If ``self.feat_vectorizer`` is either ``None`` or a
:class:`sklearn.feature_extraction.FeatureHasher``.
:class:`sklearn.feature_extraction.FeatureHasher`.
"""
if isinstance(self.feat_vectorizer, DictVectorizer):
return self.feat_vectorizer.get_feature_names_out()[self.feat_selector.get_support()]
Expand Down
11 changes: 4 additions & 7 deletions skll/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,19 @@ def kappa(
The true/actual/gold labels for the data.
y_pred : numpy.ndarray
The predicted/observed labels for the data.
weights : Optional[Union[str, numpy.ndarray]]
weights : Optional[Union[str, numpy.ndarray]], default=None
Specifies the weight matrix for the calculation.
Possible values are: ``None`` (unweighted-kappa), ``"quadratic"``
(quadratically weighted kappa), ``"linear"`` (linearly weighted kappa),
and a two-dimensional numpy array (a custom matrix of weights). Each
weight in this array corresponds to the :math:`w_{ij}` values in the
Wikipedia description of how to calculate weighted Cohen's kappa.
Defaults to ``None``.
allow_off_by_one : bool
allow_off_by_one : bool, default=False
If true, ratings that are off by one are counted as
equal, and all other differences are reduced by
one. For example, 1 and 2 will be considered to be
equal, whereas 1 and 3 will have a difference of 1
for when building the weights matrix.
Defaults to ``False``.
Returns
-------
Expand Down Expand Up @@ -181,10 +179,9 @@ def correlation(y_true: np.ndarray, y_pred: np.ndarray, corr_type: str = "pearso
The true/actual/gold labels for the data.
y_pred : numpy.ndarray
The predicted/observed labels for the data.
corr_type : str
corr_type : str, default="pearson"
Which type of correlation to compute. Possible
choices are "pearson", "spearman", and "kendall_tau".
Defaults to "pearson".
Returns
-------
Expand Down Expand Up @@ -237,7 +234,7 @@ def register_custom_metric(custom_metric_path: PathOrStr, custom_metric_name: st
Parameters
----------
custom_metric_path : PathOrStr
custom_metric_path : :class:`skll.types.PathOrStr`
The path to a custom metric.
custom_metric_name : str
The name of the custom metric function to load. This function must take
Expand Down

0 comments on commit c0ebc36

Please sign in to comment.