MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / SVR_Q

Class SVR_Q

ml/src/svm.cpp:1552–1635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1550};
1551
1552class SVR_Q : public Kernel {
1553
1554public:
1555 SVR_Q(const svm_problem& prob, const svm_parameter& param)
1556 : Kernel(prob.l, prob.x, param)
1557 {
1558 l = prob.l;
1559 cache = new Cache(l, static_cast<long int>(param.cache_size * (1 << 20)));
1560 QD = new double[2 * l];
1561 sign = new schar[2 * l];
1562 index = new int[2 * l];
1563
1564 for (int k = 0; k < l; k++) {
1565 sign[k] = 1;
1566 sign[k + l] = -1;
1567 index[k] = k;
1568 index[k + l] = k;
1569 QD[k] = (this->*kernel_function)(k, k);
1570 QD[k + l] = QD[k];
1571 }
1572
1573 buffer[0] = new Qfloat[2 * l];
1574
1575 buffer[1] = new Qfloat[2 * l];
1576 next_buffer = 0;
1577 }
1578
1579 void
1580 swap_index(int i, int j) const override
1581 {
1582 swap(sign[i], sign[j]);
1583 swap(index[i], index[j]);
1584 swap(QD[i], QD[j]);
1585 }
1586
1587 Qfloat*
1588 get_Q(int i, int len) const override
1589 {
1590 Qfloat* data;
1591 int j, real_i = index[i];
1592
1593 if (cache->get_data(real_i, &data, l) < l) {
1594 for (j = 0; j < l; j++)
1595 data[j] = static_cast<Qfloat>((this->*kernel_function)(real_i, j));
1596 }
1597
1598 // reorder and copy
1599 Qfloat* buf = buffer[next_buffer];
1600
1601 next_buffer = 1 - next_buffer;
1602
1603 schar si = sign[i];
1604
1605 for (j = 0; j < len; j++)
1606 buf[j] = static_cast<Qfloat>(si) * static_cast<Qfloat>(sign[j]) * data[index[j]];
1607
1608 return buf;
1609 }

Callers 2

solve_epsilon_svrFunction · 0.85
solve_nu_svrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected