#NEWLINE# def joint_feature( self , x , y ) : #NEWLINE# #INDENT# 'Compute joint feature vector of x and y.\n\n        Feature representation joint_feature, such that the energy of the configuration\n        (x, y) and a weight vector w is given by np.dot(w, joint_feature(x, y)).\n\n        Parameters\n        ----------\n        x : nd-array, shape=(n_features,)\n            Input sample features.\n\n        y : int\n            Class label, either +1 or -1.\n\n        Returns\n        -------\n        p : ndarray, shape (size_joint_feature,)\n            Feature vector associated with state (x, y).\n        ' #NEWLINE# if ( y not in [ ( - 1 ) , 1 ] ) : #NEWLINE# #INDENT# raise ValueError ( ( 'y has to be either -1 or +1, got %s' % repr ( y ) ) ) #NEWLINE# #UNINDENT# return ( ( y * x ) / 2.0 )