TemplateBasedClassifier

Histogram classifier based on a direct comparison with templates (i.e. reference histograms)


mseTopN_templates

full signature:

def mseTopN_templates( histograms, templates, n=-1 )  

comments:

calculate the mse between each histogram in histograms and each histogram in templates  
input arguments:  
- histograms: 2D numpy array of shape (nhistograms, nbins)  
- templates: 2D numpy array of shape (ntemplates,nbins)  
- n: integer representing the number of (sorted) bin squared errors to take into account (default: all)  
output:  
2D numpy array of shape (nhistograms,ntemplates) holding the mseTopN between each  

mseTopN_min

full signature:

def mseTopN_min( histograms, templates, n=-1 )  

comments:

calculate the mse betwee a histogram and each template and return the minimum  
input arguments:  
- histograms: 2D numpy array of shape (nhistograms, nbins)  
- templates: 2D numpy array of shape (ntemplates,nbins)  
- n: integer representing the number of (sorted) bin squared errors to take into account (default: all)  
output:  
1D numpy array of shape (nhistograms) holding the minimum mseTopN for each histogram  

mseTop10_min

full signature:

def mseTop10_min( histograms, templates )  

comments:

special case of above with n=10  

mseTopN_avg

full signature:

def mseTopN_avg( histograms, templates, n=-1 )  

comments:

calculate the mse betwee a histogram and each template and return the average  
input arguments:  
- histograms: 2D numpy array of shape (nhistograms, nbins)  
- templates: 2D numpy array of shape (ntemplates,nbins)  
- n: integer representing the number of (sorted) bin squared errors to take into account (default: all)  
output:  
1D numpy array of shape (nhistograms) holding the average mseTopN for each histogram  

mseTop10_avg

full signature:

def mseTop10_avg( histograms, templates )  

comments:

special case of above with n=10  

[class] TemplateBasedClassifier

comments:

histogram classifier based on a direct comparison with templates (i.e. reference histograms)  

⤷ __init__

full signature:

def __init__( self, comparemethod='minmse' )  

comments:

initializer  
input arguments:  
- comparemethod: string representing the method by which to compare a histogram with a set of templates  
  currently supported methods are:  
  - minmse: minimum mean square error between histogram and all templates  
  - avgmse: average mean square error between histogram and all templates  

⤷ train

full signature:

def train( self, templates )  

comments:

'train' the classifier, i.e. set the templates (reference histograms)  
input arguments:  
- templates: a 2D numpy array of shape (nhistograms,nbins)  

⤷ evaluate

full signature:

def evaluate( self, histograms )  

comments:

classification of a collection of histograms based on their deviation from templates  

⤷ save

full signature:

def save( self, path )  

comments:

save the classifier  

⤷ load

full signature:

def load( self, path, **kwargs )  

comments:

get a TemplateBasedClassifier instance from a pkl file