ModelInterface

ModelInterface: extension of Model class interfaced by HistStruct

This class is the interface between a Model (holding classifiers and fitters)
and a HistStruct (holding histogram data).
It stores the classifier and model scores for the histograms in a HistStruct.



[class] ModelInterface

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(Interface).  

⤷ __str__

full signature:

def __str__( self )  

comments:

get a printable representation of a ModelInterface  

⤷ add_setname

full signature:

def add_setname( self, setname )  

comments:

initialize empty scores for extended set  
input arguments:  
- setname: name of extended set  

⤷ check_setname

full signature:

def check_setname( self, setname )  

comments:

check if a setname is present  
input arguments:  
- setname: name of the set to check  

⤷ check_setnames

full signature:

def check_setnames( self, setnames )  

comments:

check if all names in a list of set names are present  

⤷ check_scores

full signature:

def check_scores( self, histnames=None, setnames=None )  

comments:

check if scores are present for a given set name  
input arguments:  
- histnames: list of histogram names for which to check the scores (default: all)  
- setname: list of set names for which to check the scores (default: standard set)  

⤷ check_globalscores

full signature:

def check_globalscores( self, setnames=None )  

comments:

check if global scores are present for a given set name  
input arguments:  
- setname: list of set names for which to check the scores (default: standard set)  

⤷ evaluate_store_classifier

full signature:

def evaluate_store_classifier( self, histname, histograms, mask=None, setname=None )  

comments:

same as Model.evaluate_classifier but store the result internally  
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  
- setname: name of extended set (default: standard set)  

⤷ evaluate_store_classifiers

full signature:

def evaluate_store_classifiers( self, histograms, mask=None, setname=None )  

comments:

same as Model.evaluate_classifiers but store the result internally  
input arguments:  
- histograms: dict of histnames to histogram arrays (shape (nhistograms,nbins))  
- mask: a np boolean array masking the histograms to be evaluated  
- setname: name of extended set (default: standard set)  

⤷ evaluate_store_fitter

full signature:

def evaluate_store_fitter( self, points, mask=None, setname=None, verbose=False )  

comments:

same as Model.evaluate_fitter but store the result internally  
input arguments:  
- points: dict matching histnames to scores (np array of shape (nhistograms))  
- mask: a np boolean array masking the histograms to be evaluated  
- setname: name of extended set (default: standard set)  

⤷ get_scores

full signature:

def get_scores( self, setnames=None, histname=None )  

comments:

get the scores stored internally  
input arguments:  
- setnames: list of names of extended sets (default: standard set)  
- histname: name of histogram type for which to get the scores  
  if specified, an array of scores is returned.  
  if not, a dict matching histnames to arrays of scores is returned.  

⤷ get_globalscores

full signature:

def get_globalscores( self, setnames=None )  

comments:

get the global scores stored internally  
input arguments:  
- setnames: list of name of extended sets (default: standard set)  

⤷ get_globalscores_mask

full signature:

def get_globalscores_mask( self, setnames=None, score_up=None, score_down=None )  

comments:

get a mask of global scores within boundaries  
input arguments:  
- setnames: list of name of extended sets (default: standard set)  
- score_up and score_down are upper and lower thresholds  
    if both are not None, the mask for global scores between the boundaries are returned  
    if score_up is None, the mask for global score > score_down are returned  
    if score_down is None, the mask for global score < score_up are returned  

⤷ get_globalscores_indices

full signature:

def get_globalscores_indices( self, setnames=None, score_up=None, score_down=None )  

comments:

get the indices of global scores within boundaries  
input arguments:  
- setnames: list of name of extended sets (default: standard set)  
- score_up and score_down are upper and lower thresholds  
    if both are not None, the indices with global scores between the boundaries are returned  
    if score_up is None, the indices with global score > score_down are returned  
    if score_down is None, the indices with global score < score_up are returned  

⤷ train_partial_fitters

full signature:

def train_partial_fitters( self, dimslist, points, **kwargs )  

comments:

train partial fitters on a given set of dimensions  
input arguments:  
- dimslist: list of tuples with integer dimension numbers  
- points: dict matching histnames to scores (np array of shape (nhistograms))  
- kwargs: additional keyword arguments for fitting  

⤷ save

full signature:

def save( self, path, save_classifiers=True, save_fitter=True )  

comments:

save a ModelInterface object to a pkl file  
input arguments:  
- path where to store the file  
- save_classifiers: a boolean whether to include the classifiers (alternative: only scores)  
- save_fitter: a boolean whether to include the fitter (alternative: only scores)  

⤷ load

full signature:

def load( self, path, load_classifiers=True, load_fitter=True, verbose=False )  

comments:

load a ModelInterface object  
input arguments:  
- path to a zip file containing a ModelInterface object  
- load_classifiers: a boolean whether to load the classifiers if present  
- load_fitter: a boolean whether to load the fitter if present  
- verbose: boolean whether to print some information