57 matrix_set(data->
Z, data->
m+1, 0, 1, 0.8740239771176158);
58 matrix_set(data->
Z, data->
m+1, 0, 2, 0.3231542341162253);
59 matrix_set(data->
Z, data->
m+1, 0, 3, 0.2533980609669184);
61 matrix_set(data->
Z, data->
m+1, 1, 1, 0.3433368959379667);
62 matrix_set(data->
Z, data->
m+1, 1, 2, 0.2945713387329698);
63 matrix_set(data->
Z, data->
m+1, 1, 3, 0.3042498181639990);
65 matrix_set(data->
Z, data->
m+1, 2, 1, 0.6513609117457242);
66 matrix_set(data->
Z, data->
m+1, 2, 2, 0.7738077314847138);
67 matrix_set(data->
Z, data->
m+1, 2, 3, 0.4426344045213226);
69 matrix_set(data->
Z, data->
m+1, 3, 1, 0.7223733317092962);
70 matrix_set(data->
Z, data->
m+1, 3, 2, 0.9718611208972370);
71 matrix_set(data->
Z, data->
m+1, 3, 3, 0.0796059591969125);
73 matrix_set(data->
Z, data->
m+1, 4, 1, 0.3014806706103061);
74 matrix_set(data->
Z, data->
m+1, 4, 2, 0.1728058294642182);
75 matrix_set(data->
Z, data->
m+1, 4, 3, 0.0851401652628196);
77 matrix_set(data->
Z, data->
m+1, 5, 1, 0.5114600128301799);
78 matrix_set(data->
Z, data->
m+1, 5, 2, 0.3319865781913825);
79 matrix_set(data->
Z, data->
m+1, 5, 3, 0.3330906711041684);
81 matrix_set(data->
Z, data->
m+1, 6, 1, 0.5824718351045201);
82 matrix_set(data->
Z, data->
m+1, 6, 2, 0.7224023004247955);
83 matrix_set(data->
Z, data->
m+1, 6, 3, 0.0937250920308128);
85 matrix_set(data->
Z, data->
m+1, 7, 1, 0.8228264179835741);
86 matrix_set(data->
Z, data->
m+1, 7, 2, 0.4580785175957617);
87 matrix_set(data->
Z, data->
m+1, 7, 3, 0.7585636149680212);
99 model->
kappa = 0.90298;
100 model->
lambda = 0.00219038;
105 matrix_set(seed_model->
V,
K-1, 0, 0, 0.3294151808829250);
106 matrix_set(seed_model->
V,
K-1, 0, 1, 0.8400578887926284);
107 matrix_set(seed_model->
V,
K-1, 0, 2, 0.9336268164013294);
108 matrix_set(seed_model->
V,
K-1, 1, 0, 0.6047157463292797);
109 matrix_set(seed_model->
V,
K-1, 1, 1, 0.1390735925868357);
110 matrix_set(seed_model->
V,
K-1, 1, 2, 0.6579825380479839);
111 matrix_set(seed_model->
V,
K-1, 2, 0, 0.7628723943431572);
112 matrix_set(seed_model->
V,
K-1, 2, 1, 0.3505528063594583);
113 matrix_set(seed_model->
V,
K-1, 2, 2, 0.1221488022463632);
114 matrix_set(seed_model->
V,
K-1, 3, 0, 0.4561071643209315);
115 matrix_set(seed_model->
V,
K-1, 3, 1, 0.0840834388268874);
116 matrix_set(seed_model->
V,
K-1, 3, 2, 0.5312457860071739);
121 model->
rho[0] = 0.3607870295944514;
122 model->
rho[1] = 0.2049421299461539;
123 model->
rho[2] = 0.0601488725348535;
124 model->
rho[3] = 0.4504181439770731;
125 model->
rho[4] = 0.0925063643277065;
126 model->
rho[5] = 0.2634120202183680;
127 model->
rho[6] = 0.8675978657103286;
128 model->
rho[7] = 0.1633697022472280;
135 -0.3268931274065331) < eps,
136 "Incorrect model->V at 0, 0");
138 0.1117992620472728) < eps,
139 "Incorrect model->V at 0, 1");
141 0.1988823609241294) < eps,
142 "Incorrect model->V at 0, 2");
144 1.2997452108481067) < eps,
145 "Incorrect model->V at 1, 0");
147 -0.7171806413563449) < eps,
148 "Incorrect model->V at 1, 1");
150 -0.4657948105281003) < eps,
151 "Incorrect model->V at 1, 2");
153 0.4408949033586493) < eps,
154 "Incorrect model->V at 2, 0");
156 0.0257888242538633) < eps,
157 "Incorrect model->V at 2, 1");
159 1.1285833836998647) < eps,
160 "Incorrect model->V at 2, 2");
162 -1.1983357619969028) < eps,
163 "Incorrect model->V at 3, 0");
165 -0.4872684816635944) < eps,
166 "Incorrect model->V at 3, 1");
168 -1.3711836483504121) < eps,
169 "Incorrect model->V at 3, 2");
209 data->
Z =
Calloc(
double, (data->
n)*(data->
m+1));
210 matrix_set(data->
Z, data->
m+1, 0, 0, 1.0000000000000000);
211 matrix_set(data->
Z, data->
m+1, 0, 1, 0.6112542725178001);
212 matrix_set(data->
Z, data->
m+1, 0, 2, -0.7672096202890778);
213 matrix_set(data->
Z, data->
m+1, 0, 3, -0.2600867145849611);
214 matrix_set(data->
Z, data->
m+1, 1, 0, 1.0000000000000000);
215 matrix_set(data->
Z, data->
m+1, 1, 1, 0.5881180210361963);
216 matrix_set(data->
Z, data->
m+1, 1, 2, -0.5419496202623567);
217 matrix_set(data->
Z, data->
m+1, 1, 3, 0.7079932865564023);
218 matrix_set(data->
Z, data->
m+1, 2, 0, 1.0000000000000000);
219 matrix_set(data->
Z, data->
m+1, 2, 1, -0.9411484777876639);
220 matrix_set(data->
Z, data->
m+1, 2, 2, -0.0251648291772256);
221 matrix_set(data->
Z, data->
m+1, 2, 3, 0.5335722872738475);
222 matrix_set(data->
Z, data->
m+1, 3, 0, 1.0000000000000000);
223 matrix_set(data->
Z, data->
m+1, 3, 1, -0.6506872332924795);
224 matrix_set(data->
Z, data->
m+1, 3, 2, -0.6277901989029552);
225 matrix_set(data->
Z, data->
m+1, 3, 3, -0.1196037902922388);
226 matrix_set(data->
Z, data->
m+1, 4, 0, 1.0000000000000000);
227 matrix_set(data->
Z, data->
m+1, 4, 1, -0.9955402476800429);
228 matrix_set(data->
Z, data->
m+1, 4, 2, -0.9514564047869466);
229 matrix_set(data->
Z, data->
m+1, 4, 3, -0.1093968234456487);
230 matrix_set(data->
Z, data->
m+1, 5, 0, 1.0000000000000000);
231 matrix_set(data->
Z, data->
m+1, 5, 1, 0.3277661334163890);
232 matrix_set(data->
Z, data->
m+1, 5, 2, 0.8271472175263959);
233 matrix_set(data->
Z, data->
m+1, 5, 3, 0.6938788574898458);
234 matrix_set(data->
Z, data->
m+1, 6, 0, 1.0000000000000000);
235 matrix_set(data->
Z, data->
m+1, 6, 1, -0.8459013990907077);
236 matrix_set(data->
Z, data->
m+1, 6, 2, -0.2453035880572786);
237 matrix_set(data->
Z, data->
m+1, 6, 3, 0.0078257345629504);
238 matrix_set(data->
Z, data->
m+1, 7, 0, 1.0000000000000000);
239 matrix_set(data->
Z, data->
m+1, 7, 1, -0.4629532094536982);
240 matrix_set(data->
Z, data->
m+1, 7, 2, 0.2935215202707828);
241 matrix_set(data->
Z, data->
m+1, 7, 3, 0.0540516162042732);
254 matrix_set(model->
V, model->
K-1, 0, 0, 0.6019309459245683);
255 matrix_set(model->
V, model->
K-1, 0, 1, 0.0063825200426701);
256 matrix_set(model->
V, model->
K-1, 1, 0, -0.9130102529085783);
257 matrix_set(model->
V, model->
K-1, 1, 1, -0.8230766493212237);
258 matrix_set(model->
V, model->
K-1, 2, 0, 0.5727079522160434);
259 matrix_set(model->
V, model->
K-1, 2, 1, 0.6466468145039965);
260 matrix_set(model->
V, model->
K-1, 3, 0, -0.8065680884346328);
261 matrix_set(model->
V, model->
K-1, 3, 1, 0.5912336906588613);
266 mu_assert(fabs(loss - 0.903071383013108) < 1e-14,
267 "Incorrect value of the loss");
307 data->
Z =
Calloc(
double, (data->
n)*(data->
m+1));
308 matrix_set(data->
Z, data->
m+1, 0, 0, 1.0000000000000000);
309 matrix_set(data->
Z, data->
m+1, 0, 1, 0.6112542725178001);
310 matrix_set(data->
Z, data->
m+1, 0, 2, -0.7672096202890778);
311 matrix_set(data->
Z, data->
m+1, 0, 3, -0.2600867145849611);
312 matrix_set(data->
Z, data->
m+1, 1, 0, 1.0000000000000000);
313 matrix_set(data->
Z, data->
m+1, 1, 1, 0.5881180210361963);
314 matrix_set(data->
Z, data->
m+1, 1, 2, -0.5419496202623567);
315 matrix_set(data->
Z, data->
m+1, 1, 3, 0.7079932865564023);
316 matrix_set(data->
Z, data->
m+1, 2, 0, 1.0000000000000000);
317 matrix_set(data->
Z, data->
m+1, 2, 1, -0.9411484777876639);
318 matrix_set(data->
Z, data->
m+1, 2, 2, -0.0251648291772256);
319 matrix_set(data->
Z, data->
m+1, 2, 3, 0.5335722872738475);
320 matrix_set(data->
Z, data->
m+1, 3, 0, 1.0000000000000000);
321 matrix_set(data->
Z, data->
m+1, 3, 1, -0.6506872332924795);
322 matrix_set(data->
Z, data->
m+1, 3, 2, -0.6277901989029552);
323 matrix_set(data->
Z, data->
m+1, 3, 3, -0.1196037902922388);
324 matrix_set(data->
Z, data->
m+1, 4, 0, 1.0000000000000000);
325 matrix_set(data->
Z, data->
m+1, 4, 1, -0.9955402476800429);
326 matrix_set(data->
Z, data->
m+1, 4, 2, -0.9514564047869466);
327 matrix_set(data->
Z, data->
m+1, 4, 3, -0.1093968234456487);
328 matrix_set(data->
Z, data->
m+1, 5, 0, 1.0000000000000000);
329 matrix_set(data->
Z, data->
m+1, 5, 1, 0.3277661334163890);
330 matrix_set(data->
Z, data->
m+1, 5, 2, 0.8271472175263959);
331 matrix_set(data->
Z, data->
m+1, 5, 3, 0.6938788574898458);
332 matrix_set(data->
Z, data->
m+1, 6, 0, 1.0000000000000000);
333 matrix_set(data->
Z, data->
m+1, 6, 1, -0.8459013990907077);
334 matrix_set(data->
Z, data->
m+1, 6, 2, -0.2453035880572786);
335 matrix_set(data->
Z, data->
m+1, 6, 3, 0.0078257345629504);
336 matrix_set(data->
Z, data->
m+1, 7, 0, 1.0000000000000000);
337 matrix_set(data->
Z, data->
m+1, 7, 1, -0.4629532094536982);
338 matrix_set(data->
Z, data->
m+1, 7, 2, 0.2935215202707828);
339 matrix_set(data->
Z, data->
m+1, 7, 3, 0.0540516162042732);
352 matrix_set(model->
V, model->
K-1, 0, 0, 0.6019309459245683);
353 matrix_set(model->
V, model->
K-1, 0, 1, 0.0063825200426701);
354 matrix_set(model->
V, model->
K-1, 1, 0, -0.9130102529085783);
355 matrix_set(model->
V, model->
K-1, 1, 1, -0.8230766493212237);
356 matrix_set(model->
V, model->
K-1, 2, 0, 0.5727079522160434);
357 matrix_set(model->
V, model->
K-1, 2, 1, 0.6466468145039965);
358 matrix_set(model->
V, model->
K-1, 3, 0, -0.8065680884346328);
359 matrix_set(model->
V, model->
K-1, 3, 1, 0.5912336906588613);
364 mu_assert(fabs(loss - 0.972847045993281) < 1e-14,
365 "Incorrect value of the loss");
399 data->
Z =
Calloc(
double, (data->
n)*(data->
m+1));
400 matrix_set(data->
Z, data->
m+1, 0, 0, 1.0000000000000000);
401 matrix_set(data->
Z, data->
m+1, 0, 1, 0.6112542725178001);
402 matrix_set(data->
Z, data->
m+1, 0, 2, -0.7672096202890778);
403 matrix_set(data->
Z, data->
m+1, 0, 3, -0.2600867145849611);
404 matrix_set(data->
Z, data->
m+1, 1, 0, 1.0000000000000000);
405 matrix_set(data->
Z, data->
m+1, 1, 1, 0.5881180210361963);
406 matrix_set(data->
Z, data->
m+1, 1, 2, -0.5419496202623567);
407 matrix_set(data->
Z, data->
m+1, 1, 3, 0.7079932865564023);
408 matrix_set(data->
Z, data->
m+1, 2, 0, 1.0000000000000000);
409 matrix_set(data->
Z, data->
m+1, 2, 1, -0.9411484777876639);
410 matrix_set(data->
Z, data->
m+1, 2, 2, -0.0251648291772256);
411 matrix_set(data->
Z, data->
m+1, 2, 3, 0.5335722872738475);
412 matrix_set(data->
Z, data->
m+1, 3, 0, 1.0000000000000000);
413 matrix_set(data->
Z, data->
m+1, 3, 1, -0.6506872332924795);
414 matrix_set(data->
Z, data->
m+1, 3, 2, -0.6277901989029552);
415 matrix_set(data->
Z, data->
m+1, 3, 3, -0.1196037902922388);
416 matrix_set(data->
Z, data->
m+1, 4, 0, 1.0000000000000000);
417 matrix_set(data->
Z, data->
m+1, 4, 1, -0.9955402476800429);
418 matrix_set(data->
Z, data->
m+1, 4, 2, -0.9514564047869466);
419 matrix_set(data->
Z, data->
m+1, 4, 3, -0.1093968234456487);
420 matrix_set(data->
Z, data->
m+1, 5, 0, 1.0000000000000000);
421 matrix_set(data->
Z, data->
m+1, 5, 1, 0.3277661334163890);
422 matrix_set(data->
Z, data->
m+1, 5, 2, 0.8271472175263959);
423 matrix_set(data->
Z, data->
m+1, 5, 3, 0.6938788574898458);
424 matrix_set(data->
Z, data->
m+1, 6, 0, 1.0000000000000000);
425 matrix_set(data->
Z, data->
m+1, 6, 1, -0.8459013990907077);
426 matrix_set(data->
Z, data->
m+1, 6, 2, -0.2453035880572786);
427 matrix_set(data->
Z, data->
m+1, 6, 3, 0.0078257345629504);
428 matrix_set(data->
Z, data->
m+1, 7, 0, 1.0000000000000000);
429 matrix_set(data->
Z, data->
m+1, 7, 1, -0.4629532094536982);
430 matrix_set(data->
Z, data->
m+1, 7, 2, 0.2935215202707828);
431 matrix_set(data->
Z, data->
m+1, 7, 3, 0.0540516162042732);
441 matrix_set(model->
V, model->
K-1, 0, 0, 0.6019309459245683);
442 matrix_set(model->
V, model->
K-1, 0, 1, 0.0063825200426701);
443 matrix_set(model->
V, model->
K-1, 1, 0, -0.9130102529085783);
444 matrix_set(model->
V, model->
K-1, 1, 1, -0.8230766493212237);
445 matrix_set(model->
V, model->
K-1, 2, 0, 0.5727079522160434);
446 matrix_set(model->
V, model->
K-1, 2, 1, 0.6466468145039965);
447 matrix_set(model->
V, model->
K-1, 3, 0, -0.8065680884346328);
448 matrix_set(model->
V, model->
K-1, 3, 1, 0.5912336906588613);
451 double *ZV =
Calloc(
double, (data->
n)*(data->
K-1));
456 -0.1857598783645273) < 1e-14,
457 "Incorrect value of ZV at 0, 0");
459 -1.1466122836367203) < 1e-14,
460 "Incorrect value of ZV at 0, 1");
462 -0.8164504861888491) < 1e-14,
463 "Incorrect value of ZV at 1, 0");
465 -0.4095442019090963) < 1e-14,
466 "Incorrect value of ZV at 1, 1");
468 1.0164346780798894) < 1e-14,
469 "Incorrect value of ZV at 2, 0");
471 1.0802130116671276) < 1e-14,
472 "Incorrect value of ZV at 2, 1");
474 0.9329432226278516) < 1e-14,
475 "Incorrect value of ZV at 3, 0");
477 0.0652756651284464) < 1e-14,
478 "Incorrect value of ZV at 3, 1");
480 1.0541987367985999) < 1e-14,
481 "Incorrect value of ZV at 4, 0");
483 0.1458531104005502) < 1e-14,
484 "Incorrect value of ZV at 4, 1");
486 0.2167303509991526) < 1e-14,
487 "Incorrect value of ZV at 5, 0");
489 0.6817225403124993) < 1e-14,
490 "Incorrect value of ZV at 5, 1");
492 1.2274482928895278) < 1e-14,
493 "Incorrect value of ZV at 6, 0");
495 0.5486262633865150) < 1e-14,
496 "Incorrect value of ZV at 6, 1");
498 1.1491177728196642) < 1e-14,
499 "Incorrect value of ZV at 7, 0");
501 0.6091903890783275) < 1e-14,
502 "Incorrect value of ZV at 7, 1");
506 -0.1857598783645273) < 1e-14,
507 "Incorrect value of Q at 0, 0");
509 0.0000000000000000) < 1e-14,
510 "Incorrect value of Q at 0, 1");
512 0.9001154267384245) < 1e-14,
513 "Incorrect value of Q at 0, 2");
515 0.0000000000000000) < 1e-14,
516 "Incorrect value of Q at 1, 0");
518 0.8164504861888491) < 1e-14,
519 "Incorrect value of Q at 1, 1");
521 0.7629009259203254) < 1e-14,
522 "Incorrect value of Q at 1, 2");
524 1.4437092486421736) < 1e-14,
525 "Incorrect value of Q at 2, 0");
527 0.4272745705622841) < 1e-14,
528 "Incorrect value of Q at 2, 1");
530 0.0000000000000000) < 1e-14,
531 "Incorrect value of Q at 2, 2");
533 0.9329432226278516) < 1e-14,
534 "Incorrect value of Q at 3, 0");
536 0.0000000000000000) < 1e-14,
537 "Incorrect value of Q at 3, 1");
539 0.4099412270637651) < 1e-14,
540 "Incorrect value of Q at 3, 2");
542 0.6534118672271528) < 1e-14,
543 "Incorrect value of Q at 4, 0");
545 -0.4007868695714470) < 1e-14,
546 "Incorrect value of Q at 4, 1");
548 0.0000000000000000) < 1e-14,
549 "Incorrect value of Q at 4, 2");
551 0.6987542137426619) < 1e-14,
552 "Incorrect value of Q at 5, 0");
554 0.4820238627435093) < 1e-14,
555 "Incorrect value of Q at 5, 1");
557 0.0000000000000000) < 1e-14,
558 "Incorrect value of Q at 5, 2");
560 0.0000000000000000) < 1e-14,
561 "Incorrect value of Q at 6, 0");
563 -1.2274482928895278) < 1e-14,
564 "Incorrect value of Q at 6, 1");
566 -1.0888484277208184) < 1e-14,
567 "Incorrect value of Q at 6, 2");
569 1.1491177728196642) < 1e-14,
570 "Incorrect value of Q at 7, 0");
572 0.0000000000000000) < 1e-14,
573 "Incorrect value of Q at 7, 1");
575 0.0469845337266742) < 1e-14,
576 "Incorrect value of Q at 7, 2");
597 matrix_set(model->
Q, model->
K, 0, 0, -0.3386242674244120);
598 matrix_set(model->
Q, model->
K, 0, 1, 1.0828252163937386);
599 matrix_set(model->
Q, model->
K, 0, 2, 0.9734009993634181);
600 matrix_set(model->
Q, model->
K, 1, 0, 1.3744927461858576);
601 matrix_set(model->
Q, model->
K, 1, 1, 1.8086820272988162);
602 matrix_set(model->
Q, model->
K, 1, 2, 0.9587412628706828);
603 matrix_set(model->
Q, model->
K, 2, 0, -0.0530412768492290);
604 matrix_set(model->
Q, model->
K, 2, 1, 0.4026826962708268);
605 matrix_set(model->
Q, model->
K, 2, 2, -1.9705914880746673);
606 matrix_set(model->
Q, model->
K, 3, 0, -0.8749982403551375);
607 matrix_set(model->
Q, model->
K, 3, 1, 1.3981525936474806);
608 matrix_set(model->
Q, model->
K, 3, 2, 0.5845478158465323);
609 matrix_set(model->
Q, model->
K, 4, 0, 0.9594104113136890);
610 matrix_set(model->
Q, model->
K, 4, 1, -0.7058945833639207);
611 matrix_set(model->
Q, model->
K, 4, 2, -1.8413342248272893);
617 0.5973049764458478) < 1e-14,
618 "Incorrect H at 0, 0");
620 0.0000000000000000) < 1e-14,
621 "Incorrect H at 0, 1");
623 0.0002358356116216) < 1e-14,
624 "Incorrect H at 0, 2");
626 0.0000000000000000) < 1e-14,
627 "Incorrect H at 1, 0");
629 0.0000000000000000) < 1e-14,
630 "Incorrect H at 1, 1");
632 0.0005674277965020) < 1e-14,
633 "Incorrect H at 1, 2");
635 0.3696319769160848) < 1e-14,
636 "Incorrect H at 2, 0");
638 0.1189293204447631) < 1e-14,
639 "Incorrect H at 2, 1");
641 2.2205914880746676) < 1e-14,
642 "Incorrect H at 2, 2");
644 1.1249982403551375) < 1e-14,
645 "Incorrect H at 3, 0");
647 0.0000000000000000) < 1e-14,
648 "Incorrect H at 3, 1");
650 0.0575335057726290) < 1e-14,
651 "Incorrect H at 3, 2");
653 0.0005491715699080) < 1e-14,
654 "Incorrect H at 4, 0");
656 0.9558945833639207) < 1e-14,
657 "Incorrect H at 4, 1");
659 2.0913342248272890) < 1e-14,
660 "Incorrect H at 4, 2");
680 matrix_set(model->
V, model->
K-1, 0, 0, 0.4534886648299394);
681 matrix_set(model->
V, model->
K-1, 0, 1, 0.0744278734246461);
682 matrix_set(model->
V, model->
K-1, 1, 0, 0.3119251404109698);
683 matrix_set(model->
V, model->
K-1, 1, 1, 0.4656439597720683);
684 matrix_set(model->
V, model->
K-1, 2, 0, 0.2011718791962903);
685 matrix_set(model->
V, model->
K-1, 2, 1, 0.6500799120482493);
686 matrix_set(model->
V, model->
K-1, 3, 0, 0.4203721613186416);
687 matrix_set(model->
V, model->
K-1, 3, 1, 0.3322561487796912);
701 0.4353487992236394) < 1e-14,
702 "Incorrect V at 0, 0");
704 -0.8092406502814364) < 1e-14,
705 "Incorrect V at 0, 1");
707 0.1573010021759272) < 1e-14,
708 "Incorrect V at 1, 0");
710 0.1728750426147708) < 1e-14,
711 "Incorrect V at 1, 1");
713 0.3329127383548583) < 1e-14,
714 "Incorrect V at 2, 0");
716 0.3182105920051096) < 1e-14,
717 "Incorrect V at 2, 1");
719 -0.0900582841983750) < 1e-14,
720 "Incorrect V at 3, 0");
722 0.5321836562222582) < 1e-14,
723 "Incorrect V at 3, 1");
Minimal unit testing framework for C.
#define Calloc(type, size)
long K
number of classes for the workspace
double * H
Huber weighted error matrix.
double epsilon
stopping criterion for the IM algorithm.
void gensvm_simplex(struct GenModel *model)
Generate matrix of simplex vertex coordinates.
long m
number of features for the workspace
char * test_gensvm_optimize()
double p
parameter for the L-p norm in the loss function
#define mu_assert(test, message)
void gensvm_step_doubling(struct GenModel *model)
Use step doubling.
#define matrix_get(M, cols, i, j)
void gensvm_optimize(struct GenModel *model, struct GenData *data)
The main training loop for GenSVM.
char * test_gensvm_get_loss_1()
void gensvm_free_work(struct GenWork *work)
Free an allocated GenWork instance.
A structure to hold the GenSVM workspace.
void gensvm_free_model(struct GenModel *model)
Free allocated GenModel struct.
int weight_idx
which weights to use (1 = unit, 2 = group)
struct GenWork * gensvm_init_work(struct GenModel *model)
Initialize the workspace structure.
#define Malloc(type, size)
double * V
augmented weight matrix
#define mu_run_test(test)
double gensvm_get_loss(struct GenModel *model, struct GenData *data, struct GenWork *work)
Calculate the current value of the loss function.
long * y
array of class labels, 1..K
struct GenModel * gensvm_init_model(void)
Initialize a GenModel structure.
void gensvm_simplex_diff(struct GenModel *model)
Generate the simplex difference matrix.
A structure to represent the data.
void gensvm_initialize_weights(struct GenData *data, struct GenModel *model)
Initialize instance weights.
A structure to represent a single GenSVM model.
char * test_gensvm_calculate_huber()
long n
number of instances in the dataset
char * test_gensvm_step_doubling()
void gensvm_free_data(struct GenData *data)
Free allocated GenData struct.
double * rho
vector of instance weights
void gensvm_calculate_errors(struct GenModel *model, struct GenData *data, double *ZV)
Calculate the scalar errors.
void gensvm_allocate_model(struct GenModel *model)
Allocate memory for a GenModel.
long r
number of eigenvalues (width of Z)
Header file for gensvm_optimize.c.
void gensvm_init_V(struct GenModel *from_model, struct GenModel *to_model, struct GenData *data)
Seed the matrix V from an existing model or using rand.
double kappa
parameter for the Huber hinge function
long K
number of classes in the dataset
long m
number of predictors (width of RAW)
#define matrix_set(M, cols, i, j, val)
Header file for gensvm_init.c.
long n
number of instances
void gensvm_calculate_huber(struct GenModel *model)
Calculate the Huber hinge errors.
struct GenData * gensvm_init_data(void)
Initialize a GenData structure.
char * test_gensvm_get_loss_2()
long n
number of instances for the workspace
long m
number of predictor variables in the dataset
char * test_gensvm_calculate_errors()
double lambda
regularization parameter in the loss function