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

multinomial_naive_bayes_training_types.h
1 /* file: multinomial_naive_bayes_training_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 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 // Naive Bayes classifier parameter structure used in the training stage
19 //--
20 */
21 
22 #ifndef __NAIVE_BAYES_TRAINING_TYPES_H__
23 #define __NAIVE_BAYES_TRAINING_TYPES_H__
24 
25 #include "algorithms/naive_bayes/multinomial_naive_bayes_model.h"
26 #include "data_management/data/data_collection.h"
27 #include "algorithms/classifier/classifier_training_types.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
33 namespace multinomial_naive_bayes
34 {
44 namespace training
45 {
50 enum Method
51 {
52  defaultDense = 0,
53  fastCSR = 1
54 };
55 
60 enum Step2MasterInputId
61 {
62  partialModels,
63  lastStep2MasterInputId = partialModels
64 };
65 
69 namespace interface1
70 {
71 
78 class DAAL_EXPORT PartialResult : public classifier::training::PartialResult
79 {
80 public:
81  DECLARE_SERIALIZABLE_CAST(PartialResult);
82 
83  PartialResult();
84  virtual ~PartialResult() {}
85 
91  multinomial_naive_bayes::PartialModelPtr get(classifier::training::PartialResultId id) const;
92 
101  template <typename algorithmFPType>
102  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
103 
112  template <typename algorithmFPType>
113  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
114 
119  size_t getNumberOfFeatures() const;
120 
129  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
130 
138  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
139 
140 protected:
142  template<typename Archive, bool onDeserialize>
143  services::Status serialImpl(Archive *arch)
144  {
145  return classifier::training::PartialResult::serialImpl<Archive, onDeserialize>(arch);
146  }
148  services::Status checkImpl(size_t nFeatures,const daal::algorithms::Parameter* parameter) const;
149 };
150 typedef services::SharedPtr<PartialResult> PartialResultPtr;
151 
159 class DAAL_EXPORT Result : public classifier::training::Result
160 {
161 public:
162  DECLARE_SERIALIZABLE_CAST(Result);
163  Result();
164  virtual ~Result() {}
165 
171  multinomial_naive_bayes::ModelPtr get(classifier::training::ResultId id) const;
172 
181  template <typename algorithmFPType>
182  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
183 
192  template <typename algorithmFPType>
193  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *parameter, const int method);
194 
203  services::Status check(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
204 
213  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
214 
215 protected:
217  template<typename Archive, bool onDeserialize>
218  services::Status serialImpl(Archive *arch)
219  {
220  return classifier::training::Result::serialImpl<Archive, onDeserialize>(arch);
221  }
223  services::Status checkImpl(size_t nFeatures,const daal::algorithms::Parameter* parameter) const;
224 };
225 typedef services::SharedPtr<Result> ResultPtr;
226 
231 class DAAL_EXPORT DistributedInput : public classifier::training::InputIface
232 {
233 public:
234  DistributedInput();
235  DistributedInput(const DistributedInput& other) : classifier::training::InputIface(other){}
236 
237  virtual ~DistributedInput() {}
238 
239  virtual size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
240 
246  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
247 
253  void add(const Step2MasterInputId &id, const PartialResultPtr &partialResult);
254 
260  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &value);
261 
267  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
268 };
269 
270 } // namespace interface1
271 using interface1::DistributedInput;
272 using interface1::PartialResult;
273 using interface1::PartialResultPtr;
274 using interface1::Result;
275 using interface1::ResultPtr;
276 
277 } // namespace training
279 } // namespace multinomial_naive_bayes
280 } // namespace algorithms
281 } // namespace daal
282 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::multinomial_naive_bayes::training::defaultDense
Definition: multinomial_naive_bayes_training_types.h:52
daal::algorithms::multinomial_naive_bayes::training::Step2MasterInputId
Step2MasterInputId
Definition: multinomial_naive_bayes_training_types.h:60
daal::algorithms::multinomial_naive_bayes::training::interface1::DistributedInput
Input objects of the naive Bayes training algorithm in the distributed processing mode...
Definition: multinomial_naive_bayes_training_types.h:231
daal::algorithms::multinomial_naive_bayes::training::fastCSR
Definition: multinomial_naive_bayes_training_types.h:53
daal::algorithms::multinomial_naive_bayes::training::interface1::PartialResult
Provides methods to access partial results obtained with the compute() method of the naive Bayes trai...
Definition: multinomial_naive_bayes_training_types.h:78
daal::algorithms::multinomial_naive_bayes::training::interface1::Result
Provides methods to access final results obtained with the compute() method of the naive Bayes traini...
Definition: multinomial_naive_bayes_training_types.h:159
daal::algorithms::classifier::training::ResultId
ResultId
Definition: classifier_training_types.h:80
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::algorithms::multinomial_naive_bayes::training::partialModels
Definition: multinomial_naive_bayes_training_types.h:62
daal::algorithms::classifier::training::PartialResultId
PartialResultId
Definition: classifier_training_types.h:70
daal::algorithms::multinomial_naive_bayes::training::Method
Method
Definition: multinomial_naive_bayes_training_types.h:50

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