C++ API Reference for Intel® Data Analytics Acceleration Library 2019

boosting_model.h
1 /* file: boosting_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the base class defining Boosting algorithm model.
19 //--
20 */
21 
22 #ifndef __BOOSTING_MODEL_H__
23 #define __BOOSTING_MODEL_H__
24 
25 #include "algorithms/weak_learner/weak_learner_model.h"
26 #include "algorithms/weak_learner/weak_learner_training_batch.h"
27 #include "algorithms/weak_learner/weak_learner_predict.h"
28 #include "algorithms/stump/stump_training_batch.h"
29 #include "algorithms/stump/stump_predict.h"
30 #include "algorithms/classifier/classifier_model.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
39 namespace boosting
40 {
41 
45 namespace interface1
46 {
57 /* [Parameter source code] */
58 struct DAAL_EXPORT Parameter : public classifier::Parameter
59 {
61  Parameter();
62 
68  Parameter(const services::SharedPtr<weak_learner::training::Batch>& wlTrainForParameter,
69  const services::SharedPtr<weak_learner::prediction::Batch>& wlPredictForParameter);
70 
72  Parameter(const Parameter& other) :weakLearnerTraining(other.weakLearnerTraining),
73  weakLearnerPrediction(other.weakLearnerPrediction){}
74 
76  services::SharedPtr<weak_learner::training::Batch> weakLearnerTraining;
77 
79  services::SharedPtr<weak_learner::prediction::Batch> weakLearnerPrediction;
80 
81  services::Status check() const DAAL_C11_OVERRIDE;
82 };
83 /* [Parameter source code] */
95 class DAAL_EXPORT Model : public classifier::Model
96 {
97 public:
103  Model(size_t nFeatures = 0) : _models(new data_management::DataCollection()), _nFeatures(nFeatures) {}
104 
105  virtual ~Model() {}
106 
111  size_t getNumberOfWeakLearners() const;
112 
118  weak_learner::ModelPtr getWeakLearnerModel(size_t idx) const;
119 
124  void addWeakLearnerModel(weak_learner::ModelPtr model);
125 
126  void clearWeakLearnerModels();
127 
132  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
133 
134 protected:
135  size_t _nFeatures;
136  data_management::DataCollectionPtr _models;
137 
138  template<typename Archive, bool onDeserialize>
139  services::Status serialImpl(Archive *arch)
140  {
141  classifier::Model::serialImpl<Archive, onDeserialize>(arch);
142  arch->set(_nFeatures);
143  arch->setSharedPtrObj(_models);
144 
145  return services::Status();
146  }
147 
148  Model(size_t nFeatures, services::Status &st);
149 };
150 typedef services::SharedPtr<Model> ModelPtr;
152 } // namespace interface1
153 using interface1::Parameter;
154 using interface1::Model;
155 using interface1::ModelPtr;
156 
157 } // namespace daal::algorithms::boosting
158 }
159 }
160 #endif // __BOOSTING_MODEL_H__
daal
Definition: algorithm_base_common.h:31
daal::algorithms::boosting::interface1::Parameter::weakLearnerPrediction
services::SharedPtr< weak_learner::prediction::Batch > weakLearnerPrediction
Definition: boosting_model.h:79
daal::algorithms::classifier::prediction::model
Definition: classifier_predict_types.h:66
daal::algorithms::boosting::interface1::Model::getNumberOfFeatures
size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE
Definition: boosting_model.h:132
daal::algorithms::boosting::interface1::Parameter::Parameter
Parameter(const Parameter &other)
Definition: boosting_model.h:72
daal::algorithms::boosting::interface1::Model
Base class for boosting algorithm models. Contains a collection of weak learner models constructed du...
Definition: boosting_model.h:95
daal::algorithms::boosting::interface1::Parameter::weakLearnerTraining
services::SharedPtr< weak_learner::training::Batch > weakLearnerTraining
Definition: boosting_model.h:76
daal::algorithms::boosting::interface1::Parameter
Base class for parameters of the boosting algorithm
Definition: boosting_model.h:58
daal::algorithms::boosting::interface1::Model::Model
Model(size_t nFeatures=0)
Definition: boosting_model.h:103

For more complete information about compiler optimizations, see our Optimization Notice.