<s> """<STR_LIT>""" <EOL> from numpy import array <EOL> from kameleon_mcmc . kernel . Kernel import Kernel <EOL> class PolynomialKernel ( Kernel ) : <EOL> def __init__ ( self , degree , theta = <NUM_LIT> ) : <EOL> Kernel . __init__ ( self ) <EOL> self . degree = degree <EOL> self . theta = theta <EOL> def __str__ ( self ) : <EOL> s = self . __class__ . __name__ + "<STR_LIT>" <EOL> s += "<STR_LIT>" + str ( self . degree ) <EOL> s += "<STR_LIT:U+002CU+0020>" + Kernel . __str__ ( self ) <EOL> s += "<STR_LIT:]>" <EOL> return s <EOL> def kernel ( self , X , Y = None ) : <EOL> """<STR_LIT>""" <EOL> if Y is None : <EOL> Y = X <EOL> return pow ( self . theta + X . dot ( Y . T ) , self . degree ) <EOL> def gradient ( self , x , Y ) : <EOL> """<STR_LIT>""" <EOL> assert ( len ( x . shape ) == <NUM_LIT:1> ) <EOL> assert ( len ( Y . shape ) == <NUM_LIT:2> ) <EOL> assert ( len ( x ) == Y . shape [ <NUM_LIT:1> ] ) <EOL> return self . degree * pow ( <NUM_LIT:1> + x . dot ( Y . T ) , self . degree ) * Y </s>
