15 using namespace shogun;
17 #ifndef DOXYGEN_SHOULD_SKIP_THIS
26 #endif // DOXYGEN_SHOULD_SKIP_THIS
29 :
CMachine(), kernel(NULL), use_batch_computation(true), use_linadd(true), use_bias(true)
58 int32_t * sv_idx =
SG_MALLOC(int32_t, num_sv);
61 for(int32_t i=0; i<num_sv; i++)
73 SG_ERROR(
"initialization of kernel optimization failed\n");
78 SG_ERROR(
"initialization of kernel optimization failed\n");
88 SG_ERROR(
"Kernelmachine can not proceed without kernel!\n");
95 SG_DEBUG(
"computing output on %d test examples\n", num_vectors);
108 memset(output, 0,
sizeof(
float64_t)*num_vectors);
114 int32_t* idx=
SG_MALLOC(int32_t, num_vectors);
117 for (int32_t i=0; i<num_vectors; i++)
133 for (int32_t i=0; i<num_vectors; i++)
145 S_THREAD_PARAM params;
146 params.kernel_machine=
this;
149 params.end=num_vectors;
156 pthread_t* threads =
SG_MALLOC(pthread_t, num_threads-1);
157 S_THREAD_PARAM* params =
SG_MALLOC(S_THREAD_PARAM, num_threads);
158 int32_t step= num_vectors/num_threads;
162 for (t=0; t<num_threads-1; t++)
164 params[t].kernel_machine =
this;
165 params[t].result = lab;
166 params[t].start = t*step;
167 params[t].end = (t+1)*step;
168 params[t].verbose =
false;
169 pthread_create(&threads[t], NULL,
173 params[t].kernel_machine =
this;
174 params[t].result = lab;
175 params[t].start = t*step;
176 params[t].end = num_vectors;
177 params[t].verbose =
true;
180 for (t=0; t<num_threads-1; t++)
181 pthread_join(threads[t], NULL);
191 SG_INFO(
"prematurely stopped. \n");
231 SG_ERROR(
"No vectors on left hand side\n");
241 S_THREAD_PARAM* params= (S_THREAD_PARAM*) p;
242 CLabels* result=params->result;
246 for (int32_t vec=params->start; vec<params->end; vec++)
248 for (int32_t vec=params->start; vec<params->end &&
254 int32_t num_vectors=params->end - params->start;
255 int32_t v=vec-params->start;
256 if ( (v% (num_vectors/100+1))== 0)
269 SG_ERROR(
"kernel is needed to store SV features.\n");
275 SG_ERROR(
"kernel lhs is needed to store SV features.\n");