<spanid="quapy-method-aggregative"></span><h2>quapy.method.aggregative<aclass="headerlink"href="#module-quapy.method.aggregative"title="Permalink to this heading">¶</a></h2>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">ACC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_jobs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ACC"title="Permalink to this definition">¶</a></dt>
<p><aclass="reference external"href="https://link.springer.com/article/10.1007/s10618-008-0097-y">Adjusted Classify & Count</a>,
the “adjusted” variant of <aclass="reference internal"href="#quapy.method.aggregative.CC"title="quapy.method.aggregative.CC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">CC</span></code></a>, that corrects the predictions of CC
according to the <cite>misclassification rates</cite>.</p>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_predictions</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ACC.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">classify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ACC.classify"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">int</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ACC.fit"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">classmethod</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">getPteCondEstim</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classes</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">y</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">y_</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ACC.getPteCondEstim"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">classmethod</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">solve_adjustment</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">PteCondEstim</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">prevs_estim</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ACC.solve_adjustment"title="Permalink to this definition">¶</a></dt>
<dd><p>Solves the system linear system <spanclass="math notranslate nohighlight">\(Ax = B\)</span> with <spanclass="math notranslate nohighlight">\(A\)</span> = <cite>PteCondEstim</cite> and <spanclass="math notranslate nohighlight">\(B\)</span> = <cite>prevs_estim</cite></p>
<li><p><strong>PteCondEstim</strong>– a <cite>np.ndarray</cite> of shape <cite>(n_classes,n_classes,)</cite> with entry <cite>(i,j)</cite> being the estimate
of <spanclass="math notranslate nohighlight">\(P(y_i|y_j)\)</span>, that is, the probability that an instance that belongs to <spanclass="math notranslate nohighlight">\(y_j\)</span> ends up being
classified as belonging to <spanclass="math notranslate nohighlight">\(y_i\)</span></p></li>
<li><p><strong>prevs_estim</strong>– a <cite>np.ndarray</cite> of shape <cite>(n_classes,)</cite> with the class prevalence estimates</p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">AdjustedClassifyAndCount</span></span><aclass="headerlink"href="#quapy.method.aggregative.AdjustedClassifyAndCount"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">AggregativeProbabilisticQuantifier</span></span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeProbabilisticQuantifier"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">classify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeProbabilisticQuantifier.classify"title="Permalink to this definition">¶</a></dt>
<dd><p>Provides the label predictions for the given instances. The predictions should respect the format expected by
<codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">aggregate()</span></code>, i.e., posterior probabilities for probabilistic quantifiers, or crisp predictions for
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">AggregativeQuantifier</span></span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier"title="Permalink to this definition">¶</a></dt>
results. Aggregative Quantifiers thus implement a <aclass="reference internal"href="#quapy.method.aggregative.AggregativeQuantifier.classify"title="quapy.method.aggregative.AggregativeQuantifier.classify"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">classify()</span></code></a> method and maintain a <aclass="reference internal"href="#quapy.method.aggregative.AggregativeQuantifier.classifier"title="quapy.method.aggregative.AggregativeQuantifier.classifier"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">classifier</span></code></a>
attribute. Subclasses of this abstract class must implement the method <aclass="reference internal"href="#quapy.method.aggregative.AggregativeQuantifier.aggregate"title="quapy.method.aggregative.AggregativeQuantifier.aggregate"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">aggregate()</span></code></a> which computes the
aggregation of label predictions. The method <aclass="reference internal"href="#quapy.method.aggregative.AggregativeQuantifier.quantify"title="quapy.method.aggregative.AggregativeQuantifier.quantify"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">quantify()</span></code></a> comes with a default implementation based on
<emclass="property"><spanclass="pre">abstract</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_predictions</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">ndarray</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier.aggregate"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">classes_</span></span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier.classes_"title="Permalink to this definition">¶</a></dt>
<dd><p>Class labels, in the same order in which class prevalence values are to be computed.
This default implementation actually returns the class labels of the learner.</p>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">classifier</span></span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier.classifier"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">classify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier.classify"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">abstract</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier.fit"title="Permalink to this definition">¶</a></dt>
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<spanclass="sig-name descname"><spanclass="pre">quantify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.AggregativeQuantifier.quantify"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">CC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.CC"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_predictions</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">ndarray</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.CC.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.CC.fit"title="Permalink to this definition">¶</a></dt>
<dd><p>Trains the Classify & Count method unless <cite>fit_classifier</cite> is False, in which case, the classifier is assumed to
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">ClassifyAndCount</span></span><aclass="headerlink"href="#quapy.method.aggregative.ClassifyAndCount"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">posteriors</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">ndarray</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.DistributionMatching.aggregate"title="Permalink to this definition">¶</a></dt>
<dd><p>Searches for the mixture model parameter (the sought prevalence values) that yields a validation distribution
(the mixture) that best matches the test distribution, in terms of the divergence measure of choice.
In the multiclass case, with <cite>n</cite> the number of classes, the test and mixture distributions contain
<cite>n</cite> channels (proper distributions of binned posterior probabilities), on which the divergence is computed
independently. The matching is computed as an average of the divergence across all channels.</p>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.DistributionMatching.fit"title="Permalink to this definition">¶</a></dt>
<dd><p>Trains the classifier (if requested) and generates the validation distributions out of the training data.
The validation distributions have shape <cite>(n, ch, nbins)</cite>, with <cite>n</cite> the number of classes, <cite>ch</cite> the number of
channels, and <cite>nbins</cite> the number of bins. In particular, let <cite>V</cite> be the validation distributions; <cite>di=V[i]</cite>
are the distributions obtained from training data labelled with class <cite>i</cite>; <cite>dij = di[j]</cite> is the discrete
distribution of posterior probabilities <cite>P(Y=j|X=x)</cite> for training data labelled with class <cite>i</cite>, and <cite>dij[k]</cite>
is the fraction of instances with a value in the <cite>k</cite>-th bin.</p>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">DyS</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_bins</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">8</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">divergence</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">str</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">Callable</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">'HD'</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">tol</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">1e-05</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.DyS"title="Permalink to this definition">¶</a></dt>
DyS is a generalization of HDy method, using a Ternary Search in order to find the prevalence that
minimizes the distance between distributions.
Details for the ternary search have been got from <<aclass="reference external"href="https://dl.acm.org/doi/pdf/10.1145/3219819.3220059">https://dl.acm.org/doi/pdf/10.1145/3219819.3220059</a>></p>
<li><p><strong>classifier</strong>– a sklearn’s Estimator that generates a binary classifier</p></li>
<li><p><strong>val_split</strong>– a float in range (0,1) indicating the proportion of data to be used as a stratified held-out
validation distribution, or a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> (the split itself).</p></li>
<li><p><strong>n_bins</strong>– an int with the number of bins to use to compute the histograms.</p></li>
<li><p><strong>divergence</strong>– a str indicating the name of divergence (currently supported ones are “HD” or “topsoe”), or a
callable function computes the divergence between two distributions (two equally sized arrays).</p></li>
<li><p><strong>tol</strong>– a float with the tolerance for the ternary search algorithm.</p></li>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_posteriors</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.DyS.aggregate"title="Permalink to this definition">¶</a></dt>
<dd><p>Implements the aggregation of label predictions.</p>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.DyS.fit"title="Permalink to this definition">¶</a></dt>
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<li><p><strong>fit_classifier</strong>– whether or not to train the learner (default is True). Set to False if the
learner has been trained outside the quantifier.</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">EMQ</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">exact_train_prev</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">recalib</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.EMQ"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">classmethod</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">EM</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">tr_prev</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">posterior_probabilities</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">epsilon</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.0001</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.EMQ.EM"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">EPSILON</span></span><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">0.0001</span></em><aclass="headerlink"href="#quapy.method.aggregative.EMQ.EPSILON"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">MAX_ITER</span></span><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">1000</span></em><aclass="headerlink"href="#quapy.method.aggregative.EMQ.MAX_ITER"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_posteriors</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">epsilon</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.0001</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.EMQ.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.EMQ.fit"title="Permalink to this definition">¶</a></dt>
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<spanclass="sig-name descname"><spanclass="pre">predict_proba</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">epsilon</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.0001</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.EMQ.predict_proba"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">ExpectationMaximizationQuantifier</span></span><aclass="headerlink"href="#quapy.method.aggregative.ExpectationMaximizationQuantifier"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">HDy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.HDy"title="Permalink to this definition">¶</a></dt>
<li><p><strong>val_split</strong>– a float in range (0,1) indicating the proportion of data to be used as a stratified held-out
validation distribution, or a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> (the split itself).</p></li>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_posteriors</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.HDy.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.HDy.fit"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">HellingerDistanceY</span></span><aclass="headerlink"href="#quapy.method.aggregative.HellingerDistanceY"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">MAX</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.MAX"title="Permalink to this definition">¶</a></dt>
<p>Threshold Optimization variant for <aclass="reference internal"href="#quapy.method.aggregative.ACC"title="quapy.method.aggregative.ACC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ACC</span></code></a> as proposed by
<aclass="reference external"href="https://dl.acm.org/doi/abs/10.1145/1150402.1150423">Forman 2006</a> and
<aclass="reference external"href="https://link.springer.com/article/10.1007/s10618-008-0097-y">Forman 2008</a> that looks
for the threshold that maximizes <cite>tpr-fpr</cite>.
The goal is to bring improved stability to the denominator of the adjustment.</p>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">MS</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.MS"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">MS2</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.MS2"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">MedianSweep</span></span><aclass="headerlink"href="#quapy.method.aggregative.MedianSweep"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">MedianSweep2</span></span><aclass="headerlink"href="#quapy.method.aggregative.MedianSweep2"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">OneVsAllAggregative</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">binary_quantifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_jobs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">parallel_backend</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">'multiprocessing'</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.OneVsAllAggregative"title="Permalink to this definition">¶</a></dt>
<p>Allows any binary quantifier to perform quantification on single-label datasets.
The method maintains one binary quantifier for each class, and then l1-normalizes the outputs so that the
class prevelences sum up to 1.
This variant was used, along with the <aclass="reference internal"href="#quapy.method.aggregative.EMQ"title="quapy.method.aggregative.EMQ"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">EMQ</span></code></a> quantifier, in
<aclass="reference external"href="https://link.springer.com/content/pdf/10.1007/s13278-016-0327-z.pdf">Gao and Sebastiani, 2016</a>.</p>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_predictions</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.OneVsAllAggregative.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">classify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.OneVsAllAggregative.classify"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">PACC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_jobs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PACC"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_posteriors</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PACC.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">classify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PACC.classify"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">int</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PACC.fit"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">classmethod</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">getPteCondEstim</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classes</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">y</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">y_</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PACC.getPteCondEstim"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">PCC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PCC"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_posteriors</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PCC.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.PCC.fit"title="Permalink to this definition">¶</a></dt>
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">ProbabilisticAdjustedClassifyAndCount</span></span><aclass="headerlink"href="#quapy.method.aggregative.ProbabilisticAdjustedClassifyAndCount"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">ProbabilisticClassifyAndCount</span></span><aclass="headerlink"href="#quapy.method.aggregative.ProbabilisticClassifyAndCount"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">SLD</span></span><aclass="headerlink"href="#quapy.method.aggregative.SLD"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">SMM</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.SMM"title="Permalink to this definition">¶</a></dt>
<li><p><strong>classifier</strong>– a sklearn’s Estimator that generates a binary classifier.</p></li>
<li><p><strong>val_split</strong>– a float in range (0,1) indicating the proportion of data to be used as a stratified held-out
validation distribution, or a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> (the split itself).</p></li>
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_posteriors</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.SMM.aggregate"title="Permalink to this definition">¶</a></dt>
<dd><p>Implements the aggregation of label predictions.</p>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.SMM.fit"title="Permalink to this definition">¶</a></dt>
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<li><p><strong>fit_classifier</strong>– whether or not to train the learner (default is True). Set to False if the
learner has been trained outside the quantifier.</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">T50</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.T50"title="Permalink to this definition">¶</a></dt>
<p>Threshold Optimization variant for <aclass="reference internal"href="#quapy.method.aggregative.ACC"title="quapy.method.aggregative.ACC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ACC</span></code></a> as proposed by
<aclass="reference external"href="https://dl.acm.org/doi/abs/10.1145/1150402.1150423">Forman 2006</a> and
<aclass="reference external"href="https://link.springer.com/article/10.1007/s10618-008-0097-y">Forman 2008</a> that looks
for the threshold that makes <cite>tpr</cite> cosest to 0.5.
The goal is to bring improved stability to the denominator of the adjustment.</p>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">ThresholdOptimization</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_jobs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ThresholdOptimization"title="Permalink to this definition">¶</a></dt>
<p>Abstract class of Threshold Optimization variants for <aclass="reference internal"href="#quapy.method.aggregative.ACC"title="quapy.method.aggregative.ACC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ACC</span></code></a> as proposed by
<aclass="reference external"href="https://dl.acm.org/doi/abs/10.1145/1150402.1150423">Forman 2006</a> and
<spanclass="sig-name descname"><spanclass="pre">aggregate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classif_predictions</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ThresholdOptimization.aggregate"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">int</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.ThresholdOptimization.fit"title="Permalink to this definition">¶</a></dt>
<li><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">X</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">BaseEstimator</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0.4</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.X"title="Permalink to this definition">¶</a></dt>
<p>Threshold Optimization variant for <aclass="reference internal"href="#quapy.method.aggregative.ACC"title="quapy.method.aggregative.ACC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">ACC</span></code></a> as proposed by
<aclass="reference external"href="https://dl.acm.org/doi/abs/10.1145/1150402.1150423">Forman 2006</a> and
<aclass="reference external"href="https://link.springer.com/article/10.1007/s10618-008-0097-y">Forman 2008</a> that looks
for the threshold that yields <cite>tpr=1-fpr</cite>.
The goal is to bring improved stability to the denominator of the adjustment.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">newELM</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">svmperf_base</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">loss</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">'01'</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">C</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">1</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.newELM"title="Permalink to this definition">¶</a></dt>
<dd><p>Explicit Loss Minimization (ELM) quantifiers.
Quantifiers based on ELM represent a family of methods based on structured output learning;
these quantifiers rely on classifiers that have been optimized using a quantification-oriented loss
<li><p><strong>svmperf_base</strong>– path to the folder containing the binary files of <cite>SVM perf</cite>; if set to None (default)
this path will be obtained from qp.environ[‘SVMPERF_HOME’]</p></li>
<li><p><strong>loss</strong>– the loss to optimize (see <aclass="reference internal"href="quapy.classification.html#quapy.classification.svmperf.SVMperf.valid_losses"title="quapy.classification.svmperf.SVMperf.valid_losses"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">quapy.classification.svmperf.SVMperf.valid_losses</span></code></a>)</p></li>
<li><p><strong>C</strong>– trade-off between training error and margin (default 0.01)</p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">newSVMAE</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">svmperf_base</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">C</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">1</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.newSVMAE"title="Permalink to this definition">¶</a></dt>
<dd><p>SVM(KLD) is an Explicit Loss Minimization (ELM) quantifier set to optimize for the Absolute Error as first used by
<aclass="reference external"href="https://arxiv.org/abs/2011.02552">Moreo and Sebastiani, 2021</a>.
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">newSVMKLD</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">svmperf_base</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">C</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">1</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.newSVMKLD"title="Permalink to this definition">¶</a></dt>
<dd><p>SVM(KLD) is an Explicit Loss Minimization (ELM) quantifier set to optimize for the Kullback-Leibler Divergence
normalized via the logistic function, as proposed by
<aclass="reference external"href="https://dl.acm.org/doi/abs/10.1145/2700406">Esuli et al. 2015</a>.
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">newSVMQ</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">svmperf_base</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">C</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">1</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.newSVMQ"title="Permalink to this definition">¶</a></dt>
<dd><p>SVM(Q) is an Explicit Loss Minimization (ELM) quantifier set to optimize for the <cite>Q</cite> loss combining a
classification-oriented loss and a quantification-oriented loss, as proposed by
<aclass="reference external"href="https://www.sciencedirect.com/science/article/pii/S003132031400291X">Barranquero et al. 2015</a>.
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">newSVMRAE</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">svmperf_base</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">C</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">1</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.aggregative.newSVMRAE"title="Permalink to this definition">¶</a></dt>
<dd><p>SVM(KLD) is an Explicit Loss Minimization (ELM) quantifier set to optimize for the Relative Absolute Error as first
used by <aclass="reference external"href="https://arxiv.org/abs/2011.02552">Moreo and Sebastiani, 2021</a>.
<spanid="quapy-method-base"></span><h2>quapy.method.base<aclass="headerlink"href="#module-quapy.method.base"title="Permalink to this heading">¶</a></h2>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.base.</span></span><spanclass="sig-name descname"><spanclass="pre">BaseQuantifier</span></span><aclass="headerlink"href="#quapy.method.base.BaseQuantifier"title="Permalink to this definition">¶</a></dt>
<p>Abstract Quantifier. A quantifier is defined as an object of a class that implements the method <aclass="reference internal"href="#quapy.method.base.BaseQuantifier.fit"title="quapy.method.base.BaseQuantifier.fit"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">fit()</span></code></a> on
<emclass="property"><spanclass="pre">abstract</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.base.BaseQuantifier.fit"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p>
<emclass="property"><spanclass="pre">abstract</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">quantify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.base.BaseQuantifier.quantify"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.base.</span></span><spanclass="sig-name descname"><spanclass="pre">BinaryQuantifier</span></span><aclass="headerlink"href="#quapy.method.base.BinaryQuantifier"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.base.</span></span><spanclass="sig-name descname"><spanclass="pre">OneVsAll</span></span><aclass="headerlink"href="#quapy.method.base.OneVsAll"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.base.</span></span><spanclass="sig-name descname"><spanclass="pre">OneVsAllGeneric</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">binary_quantifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_jobs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.base.OneVsAllGeneric"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">classes_</span></span><aclass="headerlink"href="#quapy.method.base.OneVsAllGeneric.classes_"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.base.OneVsAllGeneric.fit"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p>
<spanclass="sig-name descname"><spanclass="pre">quantify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.base.OneVsAllGeneric.quantify"title="Permalink to this definition">¶</a></dt>
<dd><p>Generate class prevalence estimates for the sample’s instances</p>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.base.</span></span><spanclass="sig-name descname"><spanclass="pre">newOneVsAll</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">binary_quantifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">n_jobs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.base.newOneVsAll"title="Permalink to this definition">¶</a></dt>
<spanid="quapy-method-meta"></span><h2>quapy.method.meta<aclass="headerlink"href="#module-quapy.method.meta"title="Permalink to this heading">¶</a></h2>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.meta.</span></span><spanclass="sig-name descname"><spanclass="pre">EACC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_grid</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">optim</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_mod_sel</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">kwargs</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.EACC"title="Permalink to this definition">¶</a></dt>
<dd><p>Implements an ensemble of <aclass="reference internal"href="#quapy.method.aggregative.ACC"title="quapy.method.aggregative.ACC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.method.aggregative.ACC</span></code></a> quantifiers, as used by
<aclass="reference external"href="https://www.sciencedirect.com/science/article/pii/S1566253517303652">Pérez-Gállego et al., 2019</a>.</p>
<li><p><strong>kwargs</strong>– kwargs for the class <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a></p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.meta.</span></span><spanclass="sig-name descname"><spanclass="pre">ECC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_grid</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">optim</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_mod_sel</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">kwargs</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.ECC"title="Permalink to this definition">¶</a></dt>
<dd><p>Implements an ensemble of <aclass="reference internal"href="#quapy.method.aggregative.CC"title="quapy.method.aggregative.CC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.method.aggregative.CC</span></code></a> quantifiers, as used by
<aclass="reference external"href="https://www.sciencedirect.com/science/article/pii/S1566253517303652">Pérez-Gállego et al., 2019</a>.</p>
<li><p><strong>kwargs</strong>– kwargs for the class <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a></p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.meta.</span></span><spanclass="sig-name descname"><spanclass="pre">EEMQ</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_grid</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">optim</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_mod_sel</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">kwargs</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.EEMQ"title="Permalink to this definition">¶</a></dt>
<li><p><strong>kwargs</strong>– kwargs for the class <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a></p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.meta.</span></span><spanclass="sig-name descname"><spanclass="pre">EHDy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_grid</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">optim</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_mod_sel</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">kwargs</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.EHDy"title="Permalink to this definition">¶</a></dt>
<dd><p>Implements an ensemble of <aclass="reference internal"href="#quapy.method.aggregative.HDy"title="quapy.method.aggregative.HDy"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.method.aggregative.HDy</span></code></a> quantifiers, as used by
<aclass="reference external"href="https://www.sciencedirect.com/science/article/pii/S1566253517303652">Pérez-Gállego et al., 2019</a>.</p>
<li><p><strong>kwargs</strong>– kwargs for the class <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a></p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.meta.</span></span><spanclass="sig-name descname"><spanclass="pre">EPACC</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">classifier</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_grid</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">optim</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">param_mod_sel</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">kwargs</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.EPACC"title="Permalink to this definition">¶</a></dt>
<li><p><strong>kwargs</strong>– kwargs for the class <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a></p></li>
<spanclass="sig-name descname"><spanclass="pre">VALID_POLICIES</span></span><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">{'ave',</span><spanclass="pre">'ds',</span><spanclass="pre">'mae',</span><spanclass="pre">'mkld',</span><spanclass="pre">'mnkld',</span><spanclass="pre">'mrae',</span><spanclass="pre">'mse',</span><spanclass="pre">'ptr'}</span></em><aclass="headerlink"href="#quapy.method.meta.Ensemble.VALID_POLICIES"title="Permalink to this definition">¶</a></dt>
<li><p><strong>quantifier</strong>– base quantification member of the ensemble</p></li>
<li><p><strong>size</strong>– number of members</p></li>
<li><p><strong>red_size</strong>– number of members to retain after selection (depending on the policy)</p></li>
<li><p><strong>min_pos</strong>– minimum number of positive instances to consider a sample as valid</p></li>
<li><p><strong>policy</strong>– the selection policy; available policies include: <cite>ave</cite> (default), <cite>ptr</cite>, <cite>ds</cite>, and accuracy
(which is instantiated via a valid error name, e.g., <cite>mae</cite>)</p></li>
<li><p><strong>max_sample_size</strong>– maximum number of instances to consider in the samples (set to None
to indicate no limit, default)</p></li>
<li><p><strong>val_split</strong>– a float in range (0,1) indicating the proportion of data to be used as a stratified held-out
validation split, or a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> (the split itself).</p></li>
<li><p><strong>n_jobs</strong>– number of parallel workers (default 1)</p></li>
<li><p><strong>verbose</strong>– set to True (default is False) to get some information in standard output</p></li>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">aggregative</span></span><aclass="headerlink"href="#quapy.method.meta.Ensemble.aggregative"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">val_split</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.Ensemble.fit"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>data</strong>– a <aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.data.base.LabelledCollection</span></code></a> consisting of the training data</p>
<spanclass="sig-name descname"><spanclass="pre">get_params</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">deep</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.Ensemble.get_params"title="Permalink to this definition">¶</a></dt>
<dd><p>This function should not be used within <aclass="reference internal"href="quapy.html#quapy.model_selection.GridSearchQ"title="quapy.model_selection.GridSearchQ"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.model_selection.GridSearchQ</span></code></a> (is here for compatibility
with the abstract class).
Instead, use <cite>Ensemble(GridSearchQ(q),…)</cite>, with <cite>q</cite> a Quantifier (recommended), or
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">probabilistic</span></span><aclass="headerlink"href="#quapy.method.meta.Ensemble.probabilistic"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">quantify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.Ensemble.quantify"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_params</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">parameters</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.Ensemble.set_params"title="Permalink to this definition">¶</a></dt>
<dd><p>This function should not be used within <aclass="reference internal"href="quapy.html#quapy.model_selection.GridSearchQ"title="quapy.model_selection.GridSearchQ"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.model_selection.GridSearchQ</span></code></a> (is here for compatibility
with the abstract class).
Instead, use <cite>Ensemble(GridSearchQ(q),…)</cite>, with <cite>q</cite> a Quantifier (recommended), or
<dd><p>Ensemble factory. Provides a unified interface for instantiating ensembles that can be optimized (via model
selection for quantification) for a given evaluation metric using <aclass="reference internal"href="quapy.html#quapy.model_selection.GridSearchQ"title="quapy.model_selection.GridSearchQ"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.model_selection.GridSearchQ</span></code></a>.
If the evaluation metric is classification-oriented
(instead of quantification-oriented), then the optimization will be carried out via sklearn’s
<p>Example to instantiate an <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a> based on <aclass="reference internal"href="#quapy.method.aggregative.PACC"title="quapy.method.aggregative.PACC"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.method.aggregative.PACC</span></code></a>
in which the base members are optimized for <aclass="reference internal"href="quapy.html#quapy.error.mae"title="quapy.error.mae"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">quapy.error.mae()</span></code></a> via
<aclass="reference internal"href="quapy.html#quapy.model_selection.GridSearchQ"title="quapy.model_selection.GridSearchQ"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">quapy.model_selection.GridSearchQ</span></code></a>. The ensemble follows the policy <cite>Accuracy</cite> based
on <aclass="reference internal"href="quapy.html#quapy.error.mae"title="quapy.error.mae"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">quapy.error.mae()</span></code></a> (the same measure being optimized),
meaning that a static selection of members of the ensemble is made based on their performance
<li><p><strong>kwargs</strong>– kwargs for the class <aclass="reference internal"href="#quapy.method.meta.Ensemble"title="quapy.method.meta.Ensemble"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Ensemble</span></code></a></p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.meta.</span></span><spanclass="sig-name descname"><spanclass="pre">get_probability_distribution</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">posterior_probabilities</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">bins</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">8</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.meta.get_probability_distribution"title="Permalink to this definition">¶</a></dt>
<spanid="quapy-method-neural"></span><h2>quapy.method.neural<aclass="headerlink"href="#module-quapy.method.neural"title="Permalink to this heading">¶</a></h2>
<p>Implements the <aclass="reference external"href="https://dl.acm.org/doi/abs/10.1145/3269206.3269287">QuaNet</a> forward pass.
See <aclass="reference internal"href="#quapy.method.neural.QuaNetTrainer"title="quapy.method.neural.QuaNetTrainer"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">QuaNetTrainer</span></code></a> for training QuaNet.</p>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">device</span></span><aclass="headerlink"href="#quapy.method.neural.QuaNetModule.device"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">forward</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">doc_embeddings</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">doc_posteriors</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">statistics</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetModule.forward"title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the computation performed at every call.</p>
<p>Should be overridden by all subclasses.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>Although the recipe for forward pass needs to be defined within
this function, one should call the <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Module</span></code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.</p>
<spanclass="sig-name descname"><spanclass="pre">training</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="pre">bool</span></em><aclass="headerlink"href="#quapy.method.neural.QuaNetModule.training"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">classes_</span></span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.classes_"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">clean_checkpoint</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.clean_checkpoint"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">clean_checkpoint_dir</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.clean_checkpoint_dir"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">fit_classifier</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.fit"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">get_params</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">deep</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.get_params"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>deep</strong> (<em>bool</em><em>, </em><em>default=True</em>) – If True, will return the parameters for this estimator and
<spanclass="sig-name descname"><spanclass="pre">quantify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.quantify"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_params</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o"><spanclass="pre">**</span></span><spanclass="n"><spanclass="pre">parameters</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.QuaNetTrainer.set_params"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.neural.</span></span><spanclass="sig-name descname"><spanclass="pre">mae_loss</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">output</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">target</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.neural.mae_loss"title="Permalink to this definition">¶</a></dt>
<spanid="quapy-method-non-aggregative"></span><h2>quapy.method.non_aggregative<aclass="headerlink"href="#module-quapy.method.non_aggregative"title="Permalink to this heading">¶</a></h2>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">quapy.method.non_aggregative.</span></span><spanclass="sig-name descname"><spanclass="pre">MaximumLikelihoodPrevalenceEstimation</span></span><aclass="headerlink"href="#quapy.method.non_aggregative.MaximumLikelihoodPrevalenceEstimation"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">fit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="quapy.data.html#quapy.data.base.LabelledCollection"title="quapy.data.base.LabelledCollection"><spanclass="pre">LabelledCollection</span></a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.non_aggregative.MaximumLikelihoodPrevalenceEstimation.fit"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">quantify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">instances</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#quapy.method.non_aggregative.MaximumLikelihoodPrevalenceEstimation.quantify"title="Permalink to this definition">¶</a></dt>
<dd><p>Ignores the input instances and returns, as the class prevalence estimantes, the training prevalence.</p>