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

multinomial_naive_bayes_training_types.h
1 /* file: multinomial_naive_bayes_training_types.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 // Naive Bayes classifier parameter structure used in the training stage
45 //--
46 */
47 
48 #ifndef __NAIVE_BAYES_TRAINING_TYPES_H__
49 #define __NAIVE_BAYES_TRAINING_TYPES_H__
50 
51 #include "algorithms/naive_bayes/multinomial_naive_bayes_model.h"
52 #include "data_management/data/data_collection.h"
53 #include "algorithms/classifier/classifier_training_types.h"
54 
55 namespace daal
56 {
57 namespace algorithms
58 {
59 namespace multinomial_naive_bayes
60 {
70 namespace training
71 {
76 enum Method
77 {
78  defaultDense = 0,
79  fastCSR = 1
80 };
81 
86 enum Step2MasterInputId
87 {
88  partialModels,
89  lastStep2MasterInputId = partialModels
90 };
91 
95 namespace interface1
96 {
97 
104 class DAAL_EXPORT PartialResult : public classifier::training::PartialResult
105 {
106 public:
107  DECLARE_SERIALIZABLE_CAST(PartialResult);
108 
109  PartialResult();
110  virtual ~PartialResult() {}
111 
117  multinomial_naive_bayes::PartialModelPtr get(classifier::training::PartialResultId id) const;
118 
127  template <typename algorithmFPType>
128  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
129 
138  template <typename algorithmFPType>
139  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
140 
145  size_t getNumberOfFeatures() const;
146 
155  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
156 
164  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
165 
166 protected:
168  template<typename Archive, bool onDeserialize>
169  services::Status serialImpl(Archive *arch)
170  {
171  return classifier::training::PartialResult::serialImpl<Archive, onDeserialize>(arch);
172  }
174  services::Status checkImpl(size_t nFeatures,const daal::algorithms::Parameter* parameter) const;
175 };
176 typedef services::SharedPtr<PartialResult> PartialResultPtr;
177 
185 class DAAL_EXPORT Result : public classifier::training::Result
186 {
187 public:
188  DECLARE_SERIALIZABLE_CAST(Result);
189  Result();
190  virtual ~Result() {}
191 
197  multinomial_naive_bayes::ModelPtr get(classifier::training::ResultId id) const;
198 
207  template <typename algorithmFPType>
208  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
209 
218  template <typename algorithmFPType>
219  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *parameter, const int method);
220 
229  services::Status check(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
230 
239  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
240 
241 protected:
243  template<typename Archive, bool onDeserialize>
244  services::Status serialImpl(Archive *arch)
245  {
246  return classifier::training::Result::serialImpl<Archive, onDeserialize>(arch);
247  }
249  services::Status checkImpl(size_t nFeatures,const daal::algorithms::Parameter* parameter) const;
250 };
251 typedef services::SharedPtr<Result> ResultPtr;
252 
257 class DAAL_EXPORT DistributedInput : public classifier::training::InputIface
258 {
259 public:
260  DistributedInput();
261  DistributedInput(const DistributedInput& other) : classifier::training::InputIface(other){}
262 
263  virtual ~DistributedInput() {}
264 
265  virtual size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
266 
272  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
273 
279  void add(const Step2MasterInputId &id, const PartialResultPtr &partialResult);
280 
286  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &value);
287 
293  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
294 };
295 
296 } // namespace interface1
297 using interface1::DistributedInput;
298 using interface1::PartialResult;
299 using interface1::PartialResultPtr;
300 using interface1::Result;
301 using interface1::ResultPtr;
302 
303 } // namespace training
305 } // namespace multinomial_naive_bayes
306 } // namespace algorithms
307 } // namespace daal
308 #endif
daal
Definition: algorithm_base_common.h:57
daal::algorithms::multinomial_naive_bayes::training::defaultDense
Definition: multinomial_naive_bayes_training_types.h:78
daal::algorithms::multinomial_naive_bayes::training::Step2MasterInputId
Step2MasterInputId
Definition: multinomial_naive_bayes_training_types.h:86
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:257
daal::algorithms::multinomial_naive_bayes::training::fastCSR
Definition: multinomial_naive_bayes_training_types.h:79
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:104
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:185
daal::algorithms::classifier::training::ResultId
ResultId
Definition: classifier_training_types.h:106
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::multinomial_naive_bayes::training::partialModels
Definition: multinomial_naive_bayes_training_types.h:88
daal::algorithms::classifier::training::PartialResultId
PartialResultId
Definition: classifier_training_types.h:96
daal::algorithms::multinomial_naive_bayes::training::Method
Method
Definition: multinomial_naive_bayes_training_types.h:76

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