qiboteam / qibocal

Quantum calibration, characterization and validation module for Qibo.
https://qibo.science
Apache License 2.0
31 stars 7 forks source link

classification.py dumps data to unwanted location #845

Open aorgazf opened 4 months ago

aorgazf commented 4 months ago

Hi, the train_qubit method of qibocal/fitting/classifier/run.py, called as part of protocols.characterization.classification dumps data to the folder used to launch the script:

base_dir = pathlib.Path()
...

def train_qubit(
    cls_data,
    qubit: QubitId,
):
    r"""Given a dataset `qubits_data` with qubits' information, this function performs the benchmarking of some classifiers.
    Each model's prediction `y_pred` is saved in  `basedir/qubit{qubit}/{classifier name}/predictions.npy`.

    Args:
        base_dir (path): Where save the results.
        qubit (int): Qubit ID.
        qubits_data (DataFrame): data about the qubits` states.
        classifiers (list | None, optional): List of classification models. It must be a subset of `CLS_MODULES`.

    Returns:
        - benchmarks_table (pd.DataFrame): Table with the following columns

            - **name**: model's name
            - **accuracy**: model's accuracy
            - **training_time**: training time in seconds
            - **testing_time**: testing time per item in seconds.

        - y_test (list): List of test outputs.
        - x_test (list): Tests inputs.
        - models (list): List of trained models.
        - Names (list): Models' names
        - hpars_list(list): Models' hyper-parameters.

    """
    qubit_dir = base_dir / f"qubit{qubit}"

the data should be saved within the output folder identified by the user when calling qibocal. Please note that the docstring of the train_qubit needs to be updated.

I believe that, in order to address this issue, https://github.com/qiboteam/qibocal/issues/533 should be addressed first.