This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
class Metric(object): | |
"""Abstract class""" | |
def distance(self,x,y): | |
raise NotImplementedError("Derived classes should implement this.") | |
class EuclideanMetric(Metric): | |
"""Calculates distance from origin in R according to Pythagorean distance""" | |
def distance(self,x,y): |