Package jazzparser :: Package formalisms :: Package base :: Package semantics :: Module distance :: Class FScoreMetric
[hide private]
[frames] | no frames]

Class FScoreMetric

source code

    object --+    
             |    
DistanceMetric --+
                 |
                FScoreMetric
Known Subclasses:

Metrics that compute their distance by f-score share a lot of processing. There's no need to put in every one the code for computing f-score from matching stats. Instead, subclasses of this only need to provide the fscore_match method.

Instance Methods [hide private]
 
fscore_match(self, sem1, sem2)
Subclasses must provide this.
source code
 
distance(self, sem1, sem2)
Compares the two semantics instances and returns a float distance between them.
source code
 
total_distance(self, input_pairs)
We don't just sum up f-scores to get another f-score.
source code
 
format_distance(self, dist)
Format a distance value (as returned from distance or total_distance) as a string suitable for human-readable output.
source code

Inherited from DistanceMetric: __init__, print_computation

Inherited from DistanceMetric (private): _get_identifier

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  OPTIONS = [ModuleOption('output', filter= choose_from_list(['f...

Inherited from DistanceMetric: name

Properties [hide private]

Inherited from DistanceMetric: identifier

Inherited from object: __class__

Method Details [hide private]

fscore_match(self, sem1, sem2)

source code 

Subclasses must provide this. It should return a tuple. The first three values must be floats: score given to the matching between the two inputs; max score that could be given to the first; max score for the second. There may be more values in the tuple.

distance(self, sem1, sem2)

source code 

Compares the two semantics instances and returns a float distance between them.

Overrides: DistanceMetric.distance
(inherited documentation)

total_distance(self, input_pairs)

source code 

We don't just sum up f-scores to get another f-score.

Overrides: DistanceMetric.total_distance

format_distance(self, dist)

source code 

Format a distance value (as returned from distance or total_distance) as a string suitable for human-readable output.

Overrides: DistanceMetric.format_distance
(inherited documentation)

Class Variable Details [hide private]

OPTIONS

Value:
[ModuleOption('output', filter= choose_from_list(['f', 'precision', 'r\
ecall', 'inversef']), usage= "output=O, where O is one of 'f', 'precis\
ion', " "'recall', 'inversef'", default= 'inversef', help_text= "Selec\
t what metric to output. Choose recall " "or precision for asymmetric \
metrics. F-score ('f') " "combines these two. This is inverted ('inver\
sef') " "to get a distance, rather than similarity"),]