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

boosting_model.h
1 /* file: boosting_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the base class defining Boosting algorithm model.
45 //--
46 */
47 
48 #ifndef __BOOSTING_MODEL_H__
49 #define __BOOSTING_MODEL_H__
50 
51 #include "algorithms/weak_learner/weak_learner_model.h"
52 #include "algorithms/weak_learner/weak_learner_training_batch.h"
53 #include "algorithms/weak_learner/weak_learner_predict.h"
54 #include "algorithms/stump/stump_training_batch.h"
55 #include "algorithms/stump/stump_predict.h"
56 #include "algorithms/classifier/classifier_model.h"
57 
58 namespace daal
59 {
60 namespace algorithms
61 {
65 namespace boosting
66 {
67 
71 namespace interface1
72 {
83 /* [Parameter source code] */
84 struct DAAL_EXPORT Parameter : public classifier::Parameter
85 {
87  Parameter();
88 
94  Parameter(const services::SharedPtr<weak_learner::training::Batch>& wlTrainForParameter,
95  const services::SharedPtr<weak_learner::prediction::Batch>& wlPredictForParameter);
96 
98  Parameter(const Parameter& other) :weakLearnerTraining(other.weakLearnerTraining),
99  weakLearnerPrediction(other.weakLearnerPrediction){}
100 
102  services::SharedPtr<weak_learner::training::Batch> weakLearnerTraining;
103 
105  services::SharedPtr<weak_learner::prediction::Batch> weakLearnerPrediction;
106 
107  services::Status check() const DAAL_C11_OVERRIDE;
108 };
109 /* [Parameter source code] */
121 class DAAL_EXPORT Model : public classifier::Model
122 {
123 public:
129  Model(size_t nFeatures = 0) : _models(new data_management::DataCollection()), _nFeatures(nFeatures) {}
130 
131  virtual ~Model() {}
132 
137  size_t getNumberOfWeakLearners() const;
138 
144  weak_learner::ModelPtr getWeakLearnerModel(size_t idx) const;
145 
150  void addWeakLearnerModel(weak_learner::ModelPtr model);
151 
152  void clearWeakLearnerModels();
153 
158  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
159 
160 protected:
161  size_t _nFeatures;
162  data_management::DataCollectionPtr _models;
163 
164  template<typename Archive, bool onDeserialize>
165  services::Status serialImpl(Archive *arch)
166  {
167  classifier::Model::serialImpl<Archive, onDeserialize>(arch);
168  arch->set(_nFeatures);
169  arch->setSharedPtrObj(_models);
170 
171  return services::Status();
172  }
173 
174  Model(size_t nFeatures, services::Status &st);
175 };
176 typedef services::SharedPtr<Model> ModelPtr;
178 } // namespace interface1
179 using interface1::Parameter;
180 using interface1::Model;
181 using interface1::ModelPtr;
182 
183 } // namespace daal::algorithms::boosting
184 }
185 }
186 #endif // __BOOSTING_MODEL_H__
daal
Definition: algorithm_base_common.h:57
daal::algorithms::boosting::interface1::Parameter::weakLearnerPrediction
services::SharedPtr< weak_learner::prediction::Batch > weakLearnerPrediction
Definition: boosting_model.h:105
daal::algorithms::classifier::prediction::model
Definition: classifier_predict_types.h:92
daal::algorithms::boosting::interface1::Model::getNumberOfFeatures
size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE
Definition: boosting_model.h:158
daal::algorithms::boosting::interface1::Parameter::Parameter
Parameter(const Parameter &other)
Definition: boosting_model.h:98
daal::algorithms::boosting::interface1::Model
Base class for boosting algorithm models. Contains a collection of weak learner models constructed du...
Definition: boosting_model.h:121
daal::algorithms::boosting::interface1::Parameter::weakLearnerTraining
services::SharedPtr< weak_learner::training::Batch > weakLearnerTraining
Definition: boosting_model.h:102
daal::algorithms::boosting::interface1::Parameter
Base class for parameters of the boosting algorithm
Definition: boosting_model.h:84
daal::algorithms::boosting::interface1::Model::Model
Model(size_t nFeatures=0)
Definition: boosting_model.h:129

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