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

logitboost_model.h
1 /* file: logitboost_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 class defining LogitBoost model.
21 //--
22 */
23 
24 #ifndef __LOGIT_BOOST_MODEL_H__
25 #define __LOGIT_BOOST_MODEL_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/homogen_numeric_table.h"
29 #include "algorithms/boosting/boosting_model.h"
30 #include "algorithms/classifier/classifier_model.h"
31 #include "algorithms/regression/regression_model.h"
32 #include "algorithms/regression/regression_training_batch.h"
33 #include "algorithms/regression/regression_predict.h"
34 
35 namespace daal
36 {
37 namespace algorithms
38 {
42 namespace logitboost
43 {
44 
48 namespace interface1
49 {
60 /* [interface1::Parameter source code] */
61 struct DAAL_EXPORT Parameter : public boosting::Parameter
62 {
64  DAAL_DEPRECATED Parameter();
65 
76  DAAL_DEPRECATED Parameter(const services::SharedPtr<weak_learner::training::Batch>& wlTrainForParameter,
77  const services::SharedPtr<weak_learner::prediction::Batch>& wlPredictForParameter,
78  double acc = 0.0, size_t maxIter = 10, size_t nC = 0, double wThr = 1e-10, double zThr = 1e-10);
79 
80  double accuracyThreshold;
81  size_t maxIterations;
82  size_t nClasses;
83  double weightsDegenerateCasesThreshold;
84  double responsesDegenerateCasesThreshold;
86  DAAL_DEPRECATED services::Status check() const DAAL_C11_OVERRIDE;
87 };
88 /* [interface1::Parameter source code] */
89 
98 class DAAL_EXPORT Model : public boosting::Model
99 {
100 public:
101  DECLARE_MODEL(Model, classifier::Model)
102 
103 
111  template <typename modelFPType>
112  DAAL_EXPORT DAAL_DEPRECATED Model(size_t nFeatures, const Parameter *par, modelFPType dummy);
113 
118  DAAL_DEPRECATED Model() : boosting::Model(), _nIterations(0) { }
119 
126  DAAL_DEPRECATED static services::SharedPtr<Model> create(size_t nFeatures, const Parameter *par,
127  services::Status *stat = NULL);
128 
129  DAAL_DEPRECATED_VIRTUAL virtual ~Model() { }
130 
135  DAAL_DEPRECATED void setIterations(size_t nIterations);
136 
141  DAAL_DEPRECATED size_t getIterations() const;
142 
143 protected:
144  size_t _nIterations;
145 
146  template<typename Archive, bool onDeserialize>
147  services::Status serialImpl(Archive *arch)
148  {
149  services::Status st = boosting::Model::serialImpl<Archive, onDeserialize>(arch);
150  if (!st)
151  return st;
152  arch->set(_nIterations);
153 
154  return st;
155  }
156 
157  Model(size_t nFeatures, const Parameter *par, services::Status &st);
158 };
159 typedef services::SharedPtr<Model> ModelPtr;
161 } // namespace interface1
162 
166 namespace interface2
167 {
178 /* [Parameter source code] */
179 struct DAAL_EXPORT Parameter : public classifier::Parameter
180 {
182  Parameter();
183 
194  Parameter(const services::SharedPtr<regression::training::Batch>& wlTrainForParameter,
195  const services::SharedPtr<regression::prediction::Batch>& wlPredictForParameter,
196  double acc = 0.0, size_t maxIter = 10, size_t nC = 0, double wThr = 1e-10, double zThr = 1e-10);
197 
198  services::SharedPtr<regression::training::Batch> weakLearnerTraining;
199  services::SharedPtr<regression::prediction::Batch> weakLearnerPrediction;
200  double accuracyThreshold;
201  size_t maxIterations;
202  double weightsDegenerateCasesThreshold;
203  double responsesDegenerateCasesThreshold;
204  services::Status check() const DAAL_C11_OVERRIDE;
205 };
206 /* [Parameter source code] */
207 
216 class DAAL_EXPORT Model : public classifier::Model
217 {
218 public:
219  DECLARE_MODEL(Model, classifier::Model)
220 
221 
229  template <typename modelFPType>
230  DAAL_EXPORT Model(size_t nFeatures, const Parameter *par, modelFPType dummy);
231 
236  Model(size_t nFeatures = 0) : _models(new data_management::DataCollection()), _nFeatures(nFeatures), _nIterations(0) { }
237 
244  static services::SharedPtr<Model> create(size_t nFeatures, const Parameter *par,
245  services::Status *stat = NULL);
246 
247  virtual ~Model() { }
248 
253  size_t getNumberOfWeakLearners() const;
254 
260  regression::ModelPtr getWeakLearnerModel(size_t idx) const;
261 
266  void addWeakLearnerModel(regression::ModelPtr model);
267 
271  void clearWeakLearnerModels();
272 
277  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
278 
283  void setIterations(size_t nIterations);
284 
289  size_t getIterations() const;
290 
291 protected:
292  size_t _nFeatures;
293  data_management::DataCollectionPtr _models;
294  size_t _nIterations;
295 
296  template<typename Archive, bool onDeserialize>
297  services::Status serialImpl(Archive *arch)
298  {
299  services::Status st;
300  DAAL_CHECK_STATUS(st, (classifier::Model::serialImpl<Archive, onDeserialize>(arch)));
301  arch->set(_nFeatures);
302  arch->setSharedPtrObj(_models);
303  arch->set(_nIterations);
304 
305  return st;
306  }
307 
308  Model(size_t nFeatures, const Parameter *par, services::Status &st);
309 };
310 typedef services::SharedPtr<Model> ModelPtr;
312 } // namespace interface2
313 using interface2::Parameter;
314 using interface2::Model;
315 using interface2::ModelPtr;
316 
317 
318 } // namespace daal::algorithms::logitboost
319 }
320 } // namespace daal
321 #endif
daal::algorithms::logitboost::interface1::Model::Model
DAAL_DEPRECATED Model()
Definition: logitboost_model.h:118
daal::algorithms::logitboost::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: logitboost_model.h:80
daal::algorithms::logitboost::interface2::Parameter::weightsDegenerateCasesThreshold
double weightsDegenerateCasesThreshold
Definition: logitboost_model.h:202
daal::algorithms::logitboost::interface2::Parameter::responsesDegenerateCasesThreshold
double responsesDegenerateCasesThreshold
Definition: logitboost_model.h:203
daal::algorithms::logitboost::interface2::Model::Model
Model(size_t nFeatures=0)
Definition: logitboost_model.h:236
daal::algorithms::elastic_net::training::model
Definition: elastic_net_training_types.h:109
daal::algorithms::logitboost::interface2::Model::getNumberOfFeatures
size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE
Definition: logitboost_model.h:277
daal::algorithms::logitboost::interface1::Parameter::responsesDegenerateCasesThreshold
double responsesDegenerateCasesThreshold
Definition: logitboost_model.h:84
daal::algorithms::logitboost::interface2::Parameter::weakLearnerTraining
services::SharedPtr< regression::training::Batch > weakLearnerTraining
Definition: logitboost_model.h:198
daal::algorithms::logitboost::interface2::Parameter::maxIterations
size_t maxIterations
Definition: logitboost_model.h:201
daal::algorithms::logitboost::interface1::Parameter::nClasses
size_t nClasses
Definition: logitboost_model.h:82
daal::algorithms::logitboost::interface2::Parameter::weakLearnerPrediction
services::SharedPtr< regression::prediction::Batch > weakLearnerPrediction
Definition: logitboost_model.h:199
daal::algorithms::logitboost::interface1::Model
Model of the classifier trained by the logitboost::training::Batch algorithm.
Definition: logitboost_model.h:98
daal::algorithms::logitboost::interface1::Parameter
LogitBoost algorithm parameters.
Definition: logitboost_model.h:61
daal::algorithms::logitboost::interface2::Parameter::accuracyThreshold
double accuracyThreshold
Definition: logitboost_model.h:200
daal::algorithms::logitboost::interface1::Parameter::weightsDegenerateCasesThreshold
double weightsDegenerateCasesThreshold
Definition: logitboost_model.h:83
daal::algorithms::em_gmm::nIterations
Definition: em_gmm_types.h:99
daal::algorithms::logitboost::interface1::Parameter::maxIterations
size_t maxIterations
Definition: logitboost_model.h:81

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