70 REQUIRE(machine,
"Supplied machine is NULL\n")
90 REQUIRE(f,
"Supplied loss function is NULL\n")
101 SG_ERROR(
"Loss function not set yet!\n")
109 REQUIRE(iter,
"Number of iterations\n")
120 REQUIRE((frac>0)&&(frac<=1),
"subset fraction should lie between 0 and 1. Supplied value is %f\n",frac)
132 REQUIRE((lr>0)&&(lr<=1),
"learning rate should lie between 0 and 1. Supplied value is %f\n",lr)
144 REQUIRE(data,
"test data supplied is NULL\n")
148 retlabs.
fill_vector(retlabs.vector,retlabs.vlen,0);
154 REQUIRE(element,
"%d element of the array of weak learners is NULL. This is not expected\n",i)
160 for (int32_t j=0;j<retlabs.vlen;j++)
172 REQUIRE(data,
"training data not supplied!\n")
235 instance->push_back(f);
236 instance->push_back(hm);
237 instance->push_back(
m_loss);
253 SG_ERROR(
"Machine could not be cloned!\n")
269 for (int32_t i=0;i<residuals.
vlen;i++)
316 REQUIRE(obj,
"object cannot be NULL\n")
325 REQUIRE(element,
"0 index element of objects is NULL\n")
331 REQUIRE(element,
"1 index element of objects is NULL\n")
336 for (int32_t i=0;i<labels.
vlen;i++)
339 ret+=lossf->
loss((*parameters),labels[i]);
349 REQUIRE(element,
"0 index element of objects is NULL\n")
355 REQUIRE(element,
"1 index element of objects is NULL\n")
361 REQUIRE(element,
"2 index element of objects is NULL\n")
367 REQUIRE(element,
"3 index element of objects is NULL\n")
372 for (int32_t i=0;i<labels.
vlen;i++)
375 ret+=lossf->
loss((*parameters)*hm[i]+f[i],labels[i]);
void range_fill(T start=0)
static void permute(SGVector< T > v, CRandom *rand=NULL)
virtual CRegressionLabels * apply_regression(CFeatures *data=NULL)
static void fill_vector(T *vec, int32_t len, T value)
Real Labels are real-valued labels.
Class CLossFunction is the base class of all loss functions.
int32_t lbfgs(int32_t n, float64_t *x, float64_t *ptr_fx, lbfgs_evaluate_t proc_evaluate, lbfgs_progress_t proc_progress, void *instance, lbfgs_parameter_t *_param, lbfgs_adjust_step_t proc_adjust_step)
virtual int32_t get_num_labels() const
The class Labels models labels, i.e. class assignments of objects.
virtual CSGObject * clone()
virtual void set_loss_function(CLossFunction *f)
float64_t get_subset_fraction() const
int32_t get_num_elements() const
float64_t get_label(int32_t idx)
A generic learning machine interface.
CMachine * get_machine() const
bool set_label(int32_t idx, float64_t label)
SGVector< float64_t > get_labels()
CRegressionLabels * compute_pseudo_residuals(CRegressionLabels *inter_f)
float64_t m_learning_rate
Class SGObject is the base class of all shogun objects.
virtual int32_t get_num_vectors() const
virtual ~CStochasticGBMachine()
virtual CRegressionLabels * apply_regression(CFeatures *data=NULL)
static float64_t lbfgs_evaluate(void *obj, const float64_t *parameters, float64_t *gradient, const int dim, const float64_t step)
float64_t compute_multiplier(CRegressionLabels *f, CRegressionLabels *hm)
virtual void remove_subset()
void set_machine(CMachine *machine)
virtual float64_t loss(float64_t prediction, float64_t label)
CMachine * fit_model(CDenseFeatures< float64_t > *feats, CRegressionLabels *labels)
virtual void add_subset(SGVector< index_t > subset)
Dynamic array class for CSGObject pointers that creates an array that can be used like a list or an a...
void set_subset_fraction(float64_t frac)
void set_num_iterations(int32_t iter)
void set_learning_rate(float64_t lr)
void initialize_learners()
all of classes and functions are contained in the shogun namespace
CStochasticGBMachine(CMachine *machine=NULL, CLossFunction *loss=NULL, int32_t num_iterations=100, float64_t learning_rate=1.0, float64_t subset_fraction=0.6)
float64_t get_learning_rate() const
CDynamicArray< float64_t > * m_gamma
virtual void remove_subset()
The class Features is the base class of all feature objects.
virtual bool train(CFeatures *data=NULL)
static CDenseFeatures * obtain_from_generic(CFeatures *const base_features)
float64_t get_gamma(void *instance)
CSGObject * get_element(int32_t index) const
void push_back(CSGObject *e)
int32_t get_num_iterations() const
virtual bool train_machine(CFeatures *data=NULL)
virtual float64_t first_derivative(float64_t prediction, float64_t label)
Dense integer or floating point labels.
virtual void set_labels(CLabels *lab)
void apply_subset(CDenseFeatures< float64_t > *f, CLabels *interf)
virtual CLossFunction * get_loss_function() const
const T & get_element(int32_t idx1, int32_t idx2=0, int32_t idx3=0) const
virtual void add_subset(SGVector< index_t > subset)
CDynamicObjectArray * m_weak_learners
void lbfgs_parameter_init(lbfgs_parameter_t *param)