fixing ifcb and documenting

This commit is contained in:
Alejandro Moreo Fernandez 2024-02-12 12:39:18 +01:00
parent d4fb8a1930
commit 7705c92c8c
3 changed files with 5 additions and 12 deletions

View File

@ -17,7 +17,7 @@ Change Log 0.1.8
As a result, a method with a param grid of 10 combinations for the classifier and 10 combinations for the As a result, a method with a param grid of 10 combinations for the classifier and 10 combinations for the
quantifier, now implies 10 trainings of the classifier + 10*10 trainings of the aggregation function (this is quantifier, now implies 10 trainings of the classifier + 10*10 trainings of the aggregation function (this is
typically much faster than the classifier training), whereas in versions <0.1.8 this amounted to training typically much faster than the classifier training), whereas in versions <0.1.8 this amounted to training
10*10 classifiers+aggregations. 10*10 (classifiers+aggregations).
- Added different solvers for ACC and PACC quantifiers. In quapy < 0.1.8 these quantifiers try to solve the system - Added different solvers for ACC and PACC quantifiers. In quapy < 0.1.8 these quantifiers try to solve the system
of equations Ax=B exactly (by means of np.linalg.solve). As noted by Mirko Bunse (thanks!), such an exact solution of equations Ax=B exactly (by means of np.linalg.solve). As noted by Mirko Bunse (thanks!), such an exact solution

View File

@ -1,6 +1,8 @@
import os import os
import pandas as pd import pandas as pd
import math import math
from quapy.data import LabelledCollection
from quapy.protocol import AbstractProtocol from quapy.protocol import AbstractProtocol
from pathlib import Path from pathlib import Path
@ -57,7 +59,7 @@ class IFCBTrainSamplesFromDir(AbstractProtocol):
# all columns but the first where we get the class # all columns but the first where we get the class
X = s.iloc[:, 1:].to_numpy() X = s.iloc[:, 1:].to_numpy()
y = s.iloc[:, 0].to_numpy() y = s.iloc[:, 0].to_numpy()
yield X, y yield LabelledCollection(X, y, classes=self.classes)
def total(self): def total(self):
""" """

View File

@ -810,16 +810,7 @@ def fetch_IFCB(single_sample_train=True, for_model_selection=False, data_home=No
# In the case the user wants it, join all the train samples in one LabelledCollection # In the case the user wants it, join all the train samples in one LabelledCollection
if single_sample_train: if single_sample_train:
X, y = [], [] train = LabelledCollection.join(*[lc for lc in train_gen()])
for X_, y_ in train_gen():
X.append(X_)
y.append(y_)
X = np.vstack(X)
y = np.concatenate(y)
train = LabelledCollection(X, y, classes = classes)
return train, test_gen return train, test_gen
else: else:
return train_gen, test_gen return train_gen, test_gen