17 using namespace shogun;
18 using namespace Eigen;
25 void CGaussianLikelihood::init()
48 result[i] += (m_sigma*m_sigma);
56 Map<VectorXd>
function(m_function.
vector, m_function.
vlen);
58 VectorXd result(
function.rows());
60 for (
index_t i = 0; i <
function.rows(); i++)
61 result[i] = labels->
get_labels()[i] -
function[i];
63 result = result.cwiseProduct(result);
65 result /= -2*m_sigma*m_sigma;
67 for (
index_t i = 0; i <
function.rows(); i++)
68 result[i] -= log(2*
CMath::PI*m_sigma*m_sigma)/2.0;
76 Map<VectorXd>
function(m_function.
vector, m_function.
vlen);
77 VectorXd result(
function.rows());
79 for (
index_t i = 0; i <
function.rows(); i++)
80 result[i] = labels->
get_labels()[i] -
function[i];
83 result = result/(m_sigma*m_sigma);
86 result = -VectorXd::Ones(result.rows())/(m_sigma*m_sigma);
89 result = VectorXd::Zero(result.rows());
92 SG_ERROR(
"Invalid Index for Likelihood Derivative\n");
96 for (
index_t i = 0; i < result.rows(); i++)
97 sgresult[i] = result[i];
105 Map<VectorXd>
function(m_function.
vector, m_function.
vlen);
107 VectorXd result(
function.rows());
111 if (strcmp(param->
m_name,
"sigma") || obj !=
this)
117 for (
index_t i = 0; i <
function.rows(); i++)
118 result[i] = labels->
get_labels()[i] -
function[i];
120 result = result.cwiseProduct(result);
122 result /= m_sigma*m_sigma;
124 for (
index_t i = 0; i <
function.rows(); i++)
127 for (
index_t i = 0; i < result.rows(); i++)
128 sgresult[i] = result[i];
136 Map<VectorXd>
function(m_function.
vector, m_function.
vlen);
137 VectorXd result(
function.rows());
141 if (strcmp(param->
m_name,
"sigma") || obj !=
this)
147 result = 2*VectorXd::Ones(
function.rows())/(m_sigma*m_sigma);
149 for (
index_t i = 0; i < result.rows(); i++)
150 sgresult[i] = result[i];