<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="134096165" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6372" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6372/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6372">#6372</a> adds <code class="notranslate">get_feature_names</code> to <code class="notranslate">PolynomialFeatures</code>. It accepts a list of names of <code class="notranslate">input_features</code> (or substitutes with defaults) and constructs feature name strings that are human-readable and informative. Similar support should be available for other transformers, including feature selectors, feature agglomeration, <code class="notranslate">FunctionTransformer</code>, and perhaps even PCA (giving the top contributors to each component). <code class="notranslate">FeatureUnion</code> should be modified to handle the case where an argument is supplied. A proposal for support in <code class="notranslate">Pipeline</code> is given in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135590071" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6424" data-hovercard-type="issue" data-hovercard-url="/scikit-learn/scikit-learn/issues/6424/hovercard" href="https://github.com/scikit-learn/scikit-learn/issues/6424">#6424</a>.</p>
<p dir="auto">Modelled on <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="134096165" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6372" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6372/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6372">#6372</a>, each enhancement can be contributed as a separate PR. Note that default names for features are <code class="notranslate">[x0, x1, ...]</code></p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <code class="notranslate">PolynomialFeatures</code> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/amueller/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/amueller">@amueller</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="134096165" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6372" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6372/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6372">#6372</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> feature selection and randomized L1 <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/yenchenlin1994/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/yenchenlin1994">@yenchenlin1994</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> feature agglomeration <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/yenchenlin1994/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/yenchenlin1994">@yenchenlin1994</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <code class="notranslate">FunctionTransformer</code> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/nelson-liu/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/nelson-liu">@nelson-liu</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135753025" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6431" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6431/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6431">#6431</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> scalers, normalizers and imputers: should be trivial like <code class="notranslate">FunctionTransformer</code> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135753025" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6431" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6431/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6431">#6431</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <code class="notranslate">Binarizer</code> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135753025" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6431" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6431/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6431">#6431</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <code class="notranslate">OneHotEncoder</code> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="135957352" data-permission-text="Title is private" data-url="https://github.com/scikit-learn/scikit-learn/issues/6441" data-hovercard-type="pull_request" data-hovercard-url="/scikit-learn/scikit-learn/pull/6441/hovercard" href="https://github.com/scikit-learn/scikit-learn/pull/6441">#6441</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">FeatureUnion</code> <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/yenchenlin1994/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/yenchenlin1994">@yenchenlin1994</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> PCA?</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">SparseRandomProjection</code>?</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> <code class="notranslate">GaussianRandomProjection</code>??</li>
<li>other transformers?</li>
</ul>
<p dir="auto">The <a href="http://scikit-learn.org/dev/glossary.html#term-scoring" rel="nofollow"><code class="notranslate">scoring</code></a> parameter allows users to specify a scoring method by name. Currently a list of names is available by getting it wrong:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; from sklearn.metrics import get_scorer
&gt;&gt;&gt; get_scorer('rubbish')
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/Users/joel/repos/scikit-learn/sklearn/metrics/scorer.py&quot;, line 239, in get_scorer
    % (scoring, sorted(scorers)))
ValueError: 'rubbish' is not a valid scoring value. Valid options are ['accuracy', 'adjusted_mutual_info_score', 'adjusted_rand_score', 'average_precision', 'balanced_accuracy', 'brier_score_loss', 'completeness_score', 'explained_variance', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'fowlkes_mallows_score', 'homogeneity_score', 'mutual_info_score', 'neg_log_loss', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'neg_mean_squared_log_error', 'neg_median_absolute_error', 'normalized_mutual_info_score', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'roc_auc', 'v_measure_score']"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">metrics</span> <span class="pl-k">import</span> <span class="pl-s1">get_scorer</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">get_scorer</span>(<span class="pl-s">'rubbish'</span>)
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">"/Users/joel/repos/scikit-learn/sklearn/metrics/scorer.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">239</span>, <span class="pl-s1">in</span> <span class="pl-s1">get_scorer</span>
    <span class="pl-c1">%</span> (<span class="pl-s1">scoring</span>, <span class="pl-en">sorted</span>(<span class="pl-s1">scorers</span>)))
<span class="pl-v">ValueError</span>: <span class="pl-s">'rubbish'</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-s1">a</span> <span class="pl-s1">valid</span> <span class="pl-s1">scoring</span> <span class="pl-s1">value</span>. <span class="pl-v">Valid</span> <span class="pl-s1">options</span> <span class="pl-s1">are</span> [<span class="pl-s">'accuracy'</span>, <span class="pl-s">'adjusted_mutual_info_score'</span>, <span class="pl-s">'adjusted_rand_score'</span>, <span class="pl-s">'average_precision'</span>, <span class="pl-s">'balanced_accuracy'</span>, <span class="pl-s">'brier_score_loss'</span>, <span class="pl-s">'completeness_score'</span>, <span class="pl-s">'explained_variance'</span>, <span class="pl-s">'f1'</span>, <span class="pl-s">'f1_macro'</span>, <span class="pl-s">'f1_micro'</span>, <span class="pl-s">'f1_samples'</span>, <span class="pl-s">'f1_weighted'</span>, <span class="pl-s">'fowlkes_mallows_score'</span>, <span class="pl-s">'homogeneity_score'</span>, <span class="pl-s">'mutual_info_score'</span>, <span class="pl-s">'neg_log_loss'</span>, <span class="pl-s">'neg_mean_absolute_error'</span>, <span class="pl-s">'neg_mean_squared_error'</span>, <span class="pl-s">'neg_mean_squared_log_error'</span>, <span class="pl-s">'neg_median_absolute_error'</span>, <span class="pl-s">'normalized_mutual_info_score'</span>, <span class="pl-s">'precision'</span>, <span class="pl-s">'precision_macro'</span>, <span class="pl-s">'precision_micro'</span>, <span class="pl-s">'precision_samples'</span>, <span class="pl-s">'precision_weighted'</span>, <span class="pl-s">'r2'</span>, <span class="pl-s">'recall'</span>, <span class="pl-s">'recall_macro'</span>, <span class="pl-s">'recall_micro'</span>, <span class="pl-s">'recall_samples'</span>, <span class="pl-s">'recall_weighted'</span>, <span class="pl-s">'roc_auc'</span>, <span class="pl-s">'v_measure_score'</span>]</pre></div>
<p dir="auto">I think this error message, and maintaining it, is getting a bit absurd. Instead we should have a function <code class="notranslate">sklearn.metrics.list_scorers</code> implemented in <code class="notranslate">sklearn/metrics/scorer.py</code> and the error message should say "Use sklearn.metrics.list_scorers to get valid strings.". Perhaps we would eventually have <code class="notranslate">list_scorers</code> allow users to filter scorers by task type (binary classification, multiclass classification, multilabel classification, regression, etc.), or even to provide metadata about each scorer (a description, for instance), but initially we should just be able to list them.</p>