 '''<STR_LIT>''' <EOL> import numpy as np <EOL> class Linear ( object ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self ) : <EOL> pass <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' <EOL> def calc ( self , v1 , v2 ) : <EOL> if v2 == None : v2 = v1 <EOL> return np . dot ( v1 . T , v2 ) <EOL> class Polynomial ( object ) : <EOL> '''<STR_LIT>''' <EOL> __degree = <NUM_LIT:0> <EOL> def __init__ ( self , deg = <NUM_LIT:2> ) : <EOL> self . __degree = deg <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' . format ( degree = self . __degree ) <EOL> def calc ( self , v1 , v2 = None ) : <EOL> if v2 == None : v2 = v1 <EOL> return np . power ( np . dot ( v1 . T , v2 ) , self . __degree ) <EOL> class RBF ( object ) : <EOL> '''<STR_LIT>''' <EOL> __gamma = <NUM_LIT:0> <EOL> def __init__ ( self , gamma = <NUM_LIT:1> ) : <EOL> self . __gamma = gamma <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' . format ( gamma = self . __gamma ) <EOL> def calc ( self , v1 , v2 = None ) : <EOL> if v2 == None : v2 = v1 <EOL> l2 = np . linalg . norm ( v1 - v2 ) 
 return np . exp ( - self . __gamma * l2 ** <NUM_LIT:2> ) </s>

 '''<STR_LIT>''' <EOL> import numpy as np <EOL> class Linear ( object ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self ) : <EOL> pass <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' <EOL> def calc ( self , v1 , v2 ) : <EOL> if v2 == None : v2 = v1 <EOL> return np . dot ( v1 . T , v2 ) <EOL> class Polynomial ( object ) : <EOL> '''<STR_LIT>''' <EOL> __degree = <NUM_LIT:0> <EOL> def __init__ ( self , deg = <NUM_LIT:2> ) : <EOL> self . __degree = deg <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' . format ( degree = self . __degree ) <EOL> def calc ( self , v1 , v2 = None ) : <EOL> if v2 == None : v2 = v1 <EOL> return np . power ( np . dot ( v1 . T , v2 ) , self . __degree ) <EOL> class RBF ( object ) : <EOL> '''<STR_LIT>''' <EOL> __gamma = <NUM_LIT:0> <EOL> def __init__ ( self , gamma = <NUM_LIT:1> ) : <EOL> self . __gamma = gamma <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' . format ( gamma = self . __gamma ) <EOL> def calc ( self , v1 , v2 = None ) : <EOL> if v2 == None : v2 = v1 <EOL> l2 = np . linalg . norm ( v1 - v2 ) <EOL> return np . exp ( - self . __gamma * l2 ** <NUM_LIT:2> ) </s>
