Model

Model: grouping classifiers for different histogram types

This class represents a general model for assigning a score to a lumisection.
It consists of two distinct parts:

This class does not contain the histograms or other data; it only contains the classifiers and fitter.
Use the derived class ModelInterface to make the bridge between a HistStruct (holding the data)
and a Model (holding the classifiers and fitter).



[class] Model

comments:

(no valid documentation found)  

⤷ __init__

full signature:

def __init__( self, histnames )  

comments:

initializer  
input arguments:  
- histnames: list of the histogram names for this Model.  
  this is the only argument needed for initialization,  
  use the functions set_classifiers and set_fitter   
  to set the classifiers and fitter respectively.  

⤷ set_classifiers

full signature:

def set_classifiers( self, classifiers )  

comments:

set the classifiers for this Model  
input arguments:  
- classifiers: dict of histnames to classifiers.  
  the histnames must match the ones used to initialize this Model,  
  the classifiers must be a subtype of HistogramClassifier.  

⤷ set_fitter

full signature:

def set_fitter( self, fitter )  

comments:

set the fitter for this Model  
input arguments:  
- fitter: an (untrained) object of type CloudFitter  

⤷ check_classifier

full signature:

def check_classifier( self, histname )  

comments:

check if a classifier was initialized  
input arguments:  
- histname: type of histogram for which to check the classifier  

⤷ check_fitter

full signature:

def check_fitter( self )  

comments:

check if a fitter was initialized  

⤷ train_classifier

full signature:

def train_classifier( self, histname, histograms, **kwargs )  

comments:

train a classifier  
input arguments:  
- histname: histogram name for which to train the classifier  
- histograms: the histograms for training, np array of shape (nhistograms,nbins)  
- kwargs: additional keyword arguments for training  

⤷ train_classifiers

full signature:

def train_classifiers( self, histograms, **kwargs )  

comments:

train classifiers for all histograms in this Model  
input arguments:  
- histograms: the histograms for training, dict of histnames to np arrays of shape (nhistograms,nbins)  
- kwargs: additional keyword arguments for training  

⤷ evaluate_classifier

full signature:

def evaluate_classifier( self, histname, histograms, mask=None )  

comments:

evaluate a classifier and return the score  
input arguments:  
- histname: histogram name for which to evaluate the classifier  
- histograms: the histograms for evaluation, np array of shape (nhistograms,nbins)  
- mask: a np boolean array masking the histograms to be evaluated  
returns:  
- a np array of shape (nhistograms) with the scores  
note: masked-out indices are set to np.nan!  

⤷ evaluate_classifiers

full signature:

def evaluate_classifiers( self, histograms, mask=None )  

comments:

evaluate the classifiers and return the scores  
input arguments:  
- histograms: dict of histnames to histogram arrays (shape (nhistograms,nbins))  
- mask: a np boolean array masking the histograms to be evaluated  
returns:  
- dict of histnames to scores (shape (nhistograms))  
note: masked-out indices are set to np.nan!  

⤷ get_point_array

full signature:

def get_point_array( self, points )  

comments:

for internal use in train_fitter and evaluate_fitter  
input arguments:  
- points: dict matching histnames to scores (np array of shape (nhistograms))  

⤷ train_fitter

full signature:

def train_fitter( self, points, verbose=False, **kwargs )  

comments:

train the fitter  
input arguments:  
- points: dict matching histnames to scores (np array of shape (nhistograms))  
- kwargs: additional keyword arguments for fitting  

⤷ evaluate_fitter

full signature:

def evaluate_fitter( self, points, mask=None, verbose=False )  

comments:

evaluate the fitter and return the scores  
input arguments:  
- points: dict matching histnames to scores (np array of shape (nhistograms))  
- mask: a np boolean array masking the histograms to be evaluated  
returns:  
- a np array of shape (nhistograms) with the scores  
note: masked-out indices are set to np.nan!