18 using namespace shogun;
19 using namespace Eigen;
39 eigen_r=2.0*eigen_lp.array().exp()-1.0;
54 eigen_r=1-(2.0*eigen_lp.array().exp()-1.0).square();
63 REQUIRE(lab,
"Labels are required (lab should not be NULL)\n")
65 "Labels must be type of CBinaryLabels\n")
67 "length of the function vector\n")
70 Map<VectorXd> eigen_y(y.vector, y.vlen);
78 eigen_r=eigen_y.cwiseProduct(eigen_f);
80 for (
index_t i=0; i<eigen_r.size(); i++)
90 REQUIRE(lab,
"Labels are required (lab should not be NULL)\n")
92 "Labels must be type of CBinaryLabels\n")
94 "length of the function vector\n")
95 REQUIRE(i>=1 && i<=3,
"Index for derivative should be 1, 2 or 3\n")
100 Map<VectorXd> eigen_f(func.
vector, func.
vlen);
103 Map<VectorXd> eigen_dlp(dlp.
vector, dlp.
vlen);
105 VectorXd eigen_yf=eigen_y.cwiseProduct(eigen_f);
107 for (
index_t j=0; j<eigen_yf.size(); j++)
133 eigen_r=(-eigen_dlp.array()*((eigen_yf.array()+eigen_dlp.array()).abs().array())).matrix();
137 eigen_r=(-eigen_r.array()*((eigen_yf.array()+2.0*eigen_dlp.array()).abs().array())
138 -eigen_dlp.array()).matrix();
144 eigen_r=(eigen_r.array()*eigen_y.array()).matrix();
158 "Length of the vector of means (%d), length of the vector of "
159 "variances (%d) and number of labels (%d) should be the same\n",
162 "Labels must be type of CBinaryLabels\n")
169 "length of the vector of variances (%d) should be the same\n",
184 eigen_r=eigen_mu.array()*eigen_y.array()/((1.0+eigen_s2.array()).sqrt());
186 for (
index_t i=0; i<eigen_r.size(); i++)
196 REQUIRE(lab,
"Labels are required (lab should not be NULL)\n")
198 "Length of the vector of means (%d), length of the vector of "
199 "variances (%d) and number of labels (%d) should be the same\n",
201 REQUIRE(i>=0 && i<=mu.
vlen,
"Index (%d) out of bounds!\n", i)
203 "Labels must be type of CBinaryLabels\n")
225 REQUIRE(lab,
"Labels are required (lab should not be NULL)\n")
227 "Length of the vector of means (%d), length of the vector of "
228 "variances (%d) and number of labels (%d) should be the same\n",
230 REQUIRE(i>=0 && i<=mu.
vlen,
"Index (%d) out of bounds!\n", i)
232 "Labels must be type of CBinaryLabels\n")
virtual ELabelType get_label_type() const =0
The class Labels models labels, i.e. class assignments of objects.
virtual int32_t get_num_labels() const =0
static const float64_t ERFC_CASE2
virtual SGVector< float64_t > get_predictive_variances(SGVector< float64_t > mu, SGVector< float64_t > s2, const CLabels *lab=NULL) const
static float64_t lnormal_cdf(float64_t x)
virtual SGVector< float64_t > get_log_probability_f(const CLabels *lab, SGVector< float64_t > func) const
virtual SGVector< float64_t > get_log_zeroth_moments(SGVector< float64_t > mu, SGVector< float64_t > s2, const CLabels *lab) const
virtual SGVector< float64_t > get_predictive_means(SGVector< float64_t > mu, SGVector< float64_t > s2, const CLabels *lab=NULL) const
void set_const(T const_elem)
virtual ~CProbitLikelihood()
static float64_t erfc8_weighted_sum(float64_t x)
static float64_t exp(float64_t x)
virtual float64_t get_first_moment(SGVector< float64_t > mu, SGVector< float64_t > s2, const CLabels *lab, index_t i) const
static float64_t normal_cdf(float64_t x, float64_t std_dev=1)
Binary Labels for binary classification.
static float32_t sqrt(float32_t x)
x^0.5
virtual SGVector< float64_t > get_log_probability_derivative_f(const CLabels *lab, SGVector< float64_t > func, index_t i) const
virtual float64_t get_second_moment(SGVector< float64_t > mu, SGVector< float64_t > s2, const CLabels *lab, index_t i) const
static T abs(T a)
return the absolute value of a number
static const float64_t PI