bugfix in PACC

This commit is contained in:
Alejandro Moreo Fernandez 2021-02-18 13:48:41 +01:00
parent 854d759dc4
commit 775417c8eb
2 changed files with 8 additions and 3 deletions

View File

@ -207,7 +207,7 @@ class ACC(AggregativeQuantifier):
class_count = data.counts()
# fit the learner on all data
self.learner.fit(*data.Xy)
self.learner, _ = training_helper(self.learner, data, fit_learner, val_split=None)
else:
self.learner, val_data = training_helper(self.learner, data, fit_learner, val_split=val_split)
@ -294,7 +294,7 @@ class PACC(AggregativeProbabilisticQuantifier):
y_ = np.vstack(y_)
# fit the learner on all data
self.learner.fit(*data.Xy)
self.learner, _ = training_helper(self.learner, data, fit_learner, ensure_probabilistic=True, val_split=None)
else:
self.learner, val_data = training_helper(

View File

@ -12,7 +12,8 @@ plt.rcParams['figure.dpi'] = 200
plt.rcParams['font.size'] = 16
def binary_diagonal(method_names, true_prevs, estim_prevs, pos_class=1, title=None, show_std=True, legend=True, savepath=None):
def binary_diagonal(method_names, true_prevs, estim_prevs, pos_class=1, title=None, show_std=True, legend=True,
train_prev=None, savepath=None):
fig, ax = plt.subplots()
ax.set_aspect('equal')
ax.grid()
@ -33,6 +34,10 @@ def binary_diagonal(method_names, true_prevs, estim_prevs, pos_class=1, title=No
if show_std:
ax.fill_between(x_ticks, y_ave - y_std, y_ave + y_std, alpha=0.25)
if train_prev is not None:
train_prev = train_prev[pos_class]
ax.scatter(train_prev, train_prev, c='c', label='tr-prev', linewidth=2, edgecolor='k', s=100, zorder=3)
ax.set(xlabel='true prevalence', ylabel='estimated prevalence', title=title)
ax.set_ylim(0, 1)
ax.set_xlim(0, 1)