예제 #1
0
파일: slide.py 프로젝트: dad/lcscore
	def compare(self, scc):
		# Return a score between 0.0 (most dissimilar) and 1.0 (most similar)
		# For normalized histograms, the maximum chiSq distance = 1.0, minimum 0.0
		dist = stats.chiSquaredHistogramDistance(self._vec, scc._vec)
		res = 1.0 - dist
		return res
예제 #2
0
	def testknown(self):
		"""Histogram distance, known"""
		a = [1,3]
		b = [3,1]
		d = stats.chiSquaredHistogramDistance(a,b)
		self.assertAlmostEqual(d,1.0)
예제 #3
0
	def testuneq(self):
		"""Histogram distance, equal"""
		a = [1,3,5,2,4,0,7,7.01]
		b = [1,3,5,2,4,0,7,7.01]
		d = stats.chiSquaredHistogramDistance(a,b)
		self.assertAlmostEqual(d, 0.0)
예제 #4
0
	def testeq(self):
		"""Histogram distance, unequal"""
		a = [1,3,5,2,4,0,7,7.01]
		b = [1,3,5,2,4,0,7,8]
		d = stats.chiSquaredHistogramDistance(a,b)
		self.assertTrue(d>0.0)
예제 #5
0
 def compare(self, scc):
     # Return a score between 0.0 (most dissimilar) and 1.0 (most similar)
     # For normalized histograms, the maximum chiSq distance = 1.0, minimum 0.0
     dist = stats.chiSquaredHistogramDistance(self._vec, scc._vec)
     res = 1.0 - dist
     return res