C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

boosting_model.h
1 /* file: boosting_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the base class defining Boosting algorithm model.
21 //--
22 */
23 
24 #ifndef __BOOSTING_MODEL_H__
25 #define __BOOSTING_MODEL_H__
26 
27 #include "algorithms/weak_learner/weak_learner_model.h"
28 #include "algorithms/weak_learner/weak_learner_training_batch.h"
29 #include "algorithms/weak_learner/weak_learner_predict.h"
30 #include "algorithms/stump/stump_training_batch.h"
31 #include "algorithms/stump/stump_predict.h"
32 #include "algorithms/classifier/classifier_model.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
41 namespace boosting
42 {
43 
47 namespace interface1
48 {
59 /* [Parameter source code] */
60 struct DAAL_EXPORT Parameter : public classifier::interface1::Parameter
61 {
63  Parameter();
64 
70  Parameter(const services::SharedPtr<weak_learner::training::Batch>& wlTrainForParameter,
71  const services::SharedPtr<weak_learner::prediction::Batch>& wlPredictForParameter);
72 
74  Parameter(const Parameter& other) : weakLearnerTraining(other.weakLearnerTraining),
75  weakLearnerPrediction(other.weakLearnerPrediction){}
76 
78  services::SharedPtr<weak_learner::training::Batch> weakLearnerTraining;
79 
81  services::SharedPtr<weak_learner::prediction::Batch> weakLearnerPrediction;
82 
83  services::Status check() const DAAL_C11_OVERRIDE;
84 };
85 /* [Parameter source code] */
97 class DAAL_EXPORT Model : public classifier::Model
98 {
99 public:
105  Model(size_t nFeatures = 0) : _models(new data_management::DataCollection()), _nFeatures(nFeatures) {}
106 
107  virtual ~Model() {}
108 
113  size_t getNumberOfWeakLearners() const;
114 
120  weak_learner::ModelPtr getWeakLearnerModel(size_t idx) const;
121 
126  void addWeakLearnerModel(weak_learner::ModelPtr model);
127 
128  void clearWeakLearnerModels();
129 
134  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
135 
136 protected:
137  size_t _nFeatures;
138  data_management::DataCollectionPtr _models;
139 
140  template<typename Archive, bool onDeserialize>
141  services::Status serialImpl(Archive *arch)
142  {
143  classifier::Model::serialImpl<Archive, onDeserialize>(arch);
144  arch->set(_nFeatures);
145  arch->setSharedPtrObj(_models);
146 
147  return services::Status();
148  }
149 
150  Model(size_t nFeatures, services::Status &st);
151 };
152 typedef services::SharedPtr<Model> ModelPtr;
154 } // namespace interface1
155 using interface1::Parameter;
156 using interface1::Model;
157 using interface1::ModelPtr;
158 
159 } // namespace daal::algorithms::boosting
160 }
161 }
162 #endif // __BOOSTING_MODEL_H__
daal::algorithms::boosting::interface1::Parameter::weakLearnerPrediction
services::SharedPtr< weak_learner::prediction::Batch > weakLearnerPrediction
Definition: boosting_model.h:81
daal::algorithms::boosting::interface1::Model::getNumberOfFeatures
size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE
Definition: boosting_model.h:134
daal::algorithms::boosting::interface1::Model
Base class for boosting algorithm models. Contains a collection of weak learner models constructed du...
Definition: boosting_model.h:97
daal::algorithms::boosting::interface1::Parameter::Parameter
Parameter(const Parameter &other)
Definition: boosting_model.h:74
daal::algorithms::elastic_net::training::model
Definition: elastic_net_training_types.h:109
daal::algorithms::boosting::interface1::Model::Model
Model(size_t nFeatures=0)
Definition: boosting_model.h:105
daal::algorithms::classifier::interface1::Parameter
Base class for the parameters of the classification algorithm.
Definition: classifier_model.h:69
daal::algorithms::boosting::interface1::Parameter::weakLearnerTraining
services::SharedPtr< weak_learner::training::Batch > weakLearnerTraining
Definition: boosting_model.h:78
daal::algorithms::boosting::interface1::Parameter
Base class for parameters of the boosting algorithm
Definition: boosting_model.h:60

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