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

multinomial_naive_bayes_training_types.h
1 /* file: multinomial_naive_bayes_training_types.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 // Naive Bayes classifier parameter structure used in the training stage
21 //--
22 */
23 
24 #ifndef __NAIVE_BAYES_TRAINING_TYPES_H__
25 #define __NAIVE_BAYES_TRAINING_TYPES_H__
26 
27 #include "algorithms/naive_bayes/multinomial_naive_bayes_model.h"
28 #include "data_management/data/data_collection.h"
29 #include "algorithms/classifier/classifier_training_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace multinomial_naive_bayes
36 {
46 namespace training
47 {
52 enum Method
53 {
54  defaultDense = 0,
55  fastCSR = 1
56 };
57 
62 enum Step2MasterInputId
63 {
64  partialModels,
65  lastStep2MasterInputId = partialModels
66 };
67 
71 namespace interface1
72 {
73 
80 class DAAL_EXPORT PartialResult : public classifier::training::PartialResult
81 {
82 public:
83  DECLARE_SERIALIZABLE_CAST(PartialResult);
84 
85  PartialResult();
86  virtual ~PartialResult() {}
87 
93  multinomial_naive_bayes::PartialModelPtr get(classifier::training::PartialResultId id) const;
94 
103  template <typename algorithmFPType>
104  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
105 
114  template <typename algorithmFPType>
115  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
116 
121  size_t getNumberOfFeatures() const;
122 
131  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
132 
140  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
141 
142 protected:
144  template<typename Archive, bool onDeserialize>
145  services::Status serialImpl(Archive *arch)
146  {
147  return classifier::training::PartialResult::serialImpl<Archive, onDeserialize>(arch);
148  }
150  services::Status checkImpl(size_t nFeatures,const daal::algorithms::Parameter* parameter) const;
151 };
152 typedef services::SharedPtr<PartialResult> PartialResultPtr;
153 
161 class DAAL_EXPORT Result : public classifier::training::Result
162 {
163 public:
164  DECLARE_SERIALIZABLE_CAST(Result);
165  Result();
166  virtual ~Result() {}
167 
173  multinomial_naive_bayes::ModelPtr get(classifier::training::ResultId id) const;
174 
183  template <typename algorithmFPType>
184  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
185 
194  template <typename algorithmFPType>
195  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *parameter, const int method);
196 
205  services::Status check(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
206 
215  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
216 
217 protected:
219  template<typename Archive, bool onDeserialize>
220  services::Status serialImpl(Archive *arch)
221  {
222  return classifier::training::Result::serialImpl<Archive, onDeserialize>(arch);
223  }
225  services::Status checkImpl(size_t nFeatures,const daal::algorithms::Parameter* parameter) const;
226 };
227 typedef services::SharedPtr<Result> ResultPtr;
228 
233 class DAAL_EXPORT DistributedInput : public classifier::training::InputIface
234 {
235 public:
236  DistributedInput();
237  DistributedInput(const DistributedInput& other) : classifier::training::InputIface(other){}
238 
239  virtual ~DistributedInput() {}
240 
241  virtual size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
242 
248  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
249 
255  void add(const Step2MasterInputId &id, const PartialResultPtr &partialResult);
256 
262  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &value);
263 
269  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
270 };
271 
276 class DAAL_EXPORT Input : public classifier::training::Input
277 {
278 public:
279  Input(size_t nElements = classifier::training::lastInputId + 1): classifier::training::Input(nElements)
280  {}
281  Input(const Input& other) : classifier::training::Input(other)
282  {}
283 
284  virtual ~Input() {}
285 
291  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
292 };
293 
294 } // namespace interface1
295 using interface1::DistributedInput;
296 using interface1::Input;
297 using interface1::PartialResult;
298 using interface1::PartialResultPtr;
299 using interface1::Result;
300 using interface1::ResultPtr;
301 
302 } // namespace training
304 } // namespace multinomial_naive_bayes
305 } // namespace algorithms
306 } // namespace daal
307 #endif
daal::algorithms::multinomial_naive_bayes::training::Method
Method
Definition: multinomial_naive_bayes_training_types.h:52
daal::algorithms::multinomial_naive_bayes::training::partialModels
Definition: multinomial_naive_bayes_training_types.h:64
daal::algorithms::multinomial_naive_bayes::training::interface1::Input
Input objects of the naive Bayes training algorithm in the batch and online processing mode...
Definition: multinomial_naive_bayes_training_types.h:276
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:80
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:161
daal::algorithms::multinomial_naive_bayes::training::Step2MasterInputId
Step2MasterInputId
Definition: multinomial_naive_bayes_training_types.h:62
daal::algorithms::multinomial_naive_bayes::training::defaultDense
Definition: multinomial_naive_bayes_training_types.h:54
daal::algorithms::multinomial_naive_bayes::training::fastCSR
Definition: multinomial_naive_bayes_training_types.h:55
daal::algorithms::classifier::training::PartialResultId
PartialResultId
Definition: classifier_training_types.h:72
daal::algorithms::math::abs::value
Definition: abs_types.h:88
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:233
daal::algorithms::classifier::training::ResultId
ResultId
Definition: classifier_training_types.h:82

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