17 #ifdef HAVE_LINALG_LIB
33 void CExponentialARDKernel::init()
58 REQUIRE(hs,
"Features not set!\n");
64 REQUIRE(dot_hs,
"Kernel only supports DotFeatures\n");
69 #ifdef HAVE_LINALG_LIB
79 set_vector_weights(vec);
82 set_scalar_weights(weights[0]);
85 set_matrix_weights(weights);
88 void CExponentialARDKernel::lazy_update_weights()
124 lazy_update_weights();
128 void CExponentialARDKernel::set_scalar_weights(
float64_t weight)
130 REQUIRE(weight>0,
"Scalar (%f) weight should be positive\n",weight);
142 "Setting vector weights must be before initialize features\n");
143 REQUIRE(weights.
vlen>0,
"Vector weight should be non-empty\n");
147 REQUIRE(weights[i]>0,
"Each entry of vector weight (v[%d]=%f) should be positive\n",
160 "Setting matrix weights must be before initialize features\n");
163 "Number of row (%d) must be not less than number of column (%d)",
176 REQUIRE(begin[i]>0,
"The diagonal entry of matrix weight (w(%d,%d)=%f) should be positive\n",
199 CDotKernel::init(l, r);
200 int32_t dim=((
CDotFeatures*) l)->get_dim_feature_space();
203 REQUIRE(m_weights_rows==dim,
"Dimension mismatch between features (%d) and weights (%d)\n",
204 dim, m_weights_rows);
232 offset+=m_weights_rows-i;
243 res=linalg::elementwise_product(weights, rtmp);
259 right=get_weighted_vector(vec);
267 void CExponentialARDKernel::check_weight_gradient_index(
index_t index)
274 REQUIRE(index>=0,
"Index (%d) must be non-negative\n",index);
279 #endif //HAVE_LINALG_LIB
SGVector< float64_t > m_log_weights
virtual void update_parameter_hash()
ST * get_feature_vector(int32_t num, int32_t &len, bool &dofree)
virtual ~CExponentialARDKernel()
auto elementwise_compute(Operand operand, UnaryOp unary_op) -> typename Operand::template container_type< decltype(unary_op(operand.data()[0]))>
Features that support dot products among other operations.
SGMatrix< float64_t > m_weights_raw
Template class DotKernel is the base class for kernels working on DotFeatures.
virtual SGVector< float64_t > get_feature_vector(int32_t idx, CFeatures *hs)
T * get_column_vector(index_t col) const
virtual bool init_normalizer()
CFeatures * rhs
feature vectors to occur on right hand side
all of classes and functions are contained in the shogun namespace
EARDKernelType m_ARD_type
CFeatures * lhs
feature vectors to occur on left hand side
The class Features is the base class of all feature objects.
static float64_t exp(float64_t x)
static float64_t log(float64_t v)
SGVector< float64_t > get_computed_dot_feature_vector(int32_t num)
void set_const(T const_elem)
virtual bool parameter_hash_changed()
void set_const(T const_elem)