iq_readout.classifiers.TwoStateClassifier#

class TwoStateClassifier(params)[source]#

Template for creating two-state classifiers.

The elements to be rewritten for each specific classifier are:

  • _pdf_func_..., which specify the PDFs

  • _param_names, which specify the parameter names of the PDFs

  • statistics, which computes the relevant statistics

  • fit, which performs the fit

NB: if the classifier does not use max-likelihood classification, then predict needs to the overwritten.

__init__(params)[source]#

Loads params to this TwoStateClassifier.

Parameters:
paramsdict

The structure of the dictionary must be

{
    0: {"param1": float, ...},
    1: {"param1": float, ...}
}

Methods

fit(shots_0, shots_1, **kargs)

Runs fit to the given data.

from_yaml(filename)

Load the TwoStateClassifier from YAML file.

pdf_0(z)

Returns \(p(z|0)\).

pdf_1(z)

Returns \(p(z|1)\).

predict(z[, p_0])

Classifies the given data to 0 or 1 using maximum-likelihood classification, which is defined by

to_yaml(filename)

Stores parameters in a YAML file.

Attributes

params

Returns the parameters required to set up the classifier.

statistics

Returns dictionary with general statistical data: