25 using namespace shogun;
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 struct GRADIENT_THREAD_PARAM
63 void CInferenceMethod::init()
82 int32_t num_importance_samples,
float64_t ridge_size)
115 scaled_kernel(i,i)+=ridge_size;
128 ASSERT(log_likelihood.
vlen==num_importance_samples);
129 ASSERT(log_likelihood.
vlen==log_pdf_prior.vlen);
133 sum[i]=log_likelihood[i]+log_pdf_prior[i]-log_pdf_post_approx[i];
161 for (
index_t i=0; i<num_deriv; i++)
165 GRADIENT_THREAD_PARAM thread_params;
167 thread_params.inf=
this;
168 thread_params.obj=node->data;
169 thread_params.param=node->key;
170 thread_params.grad=result;
178 pthread_t* threads=SG_MALLOC(pthread_t, num_deriv);
179 GRADIENT_THREAD_PARAM* thread_params=SG_MALLOC(GRADIENT_THREAD_PARAM,
182 for (
index_t t=0; t<num_deriv; t++)
186 thread_params[t].inf=
this;
187 thread_params[t].obj=node->data;
188 thread_params[t].param=node->key;
189 thread_params[t].grad=result;
192 (
void*)&thread_params[t]);
195 for (
index_t t=0; t<num_deriv; t++)
196 pthread_join(threads[t], NULL);
198 SG_FREE(thread_params);
208 GRADIENT_THREAD_PARAM* thread_param=(GRADIENT_THREAD_PARAM*)p;
215 REQUIRE(param,
"Parameter should not be NULL\n");
216 REQUIRE(obj,
"Object of the parameter should not be NULL\n");
233 else if (obj==inf->
m_mean)
240 SG_SERROR(
"Can't compute derivative of negative log marginal "
257 "Number of training features must be greater than zero\n")
260 "Number of labels must be greater than zero\n")
262 "Number of training vectors must match number of labels, which is "
263 "%d, but number of training vectors is %d\n",