48 #ifndef __PCA_TYPES_H__ 49 #define __PCA_TYPES_H__ 51 #include "algorithms/algorithm.h" 52 #include "data_management/data/numeric_table.h" 53 #include "data_management/data/homogen_numeric_table.h" 54 #include "services/daal_defines.h" 55 #include "algorithms/covariance/covariance_batch.h" 56 #include "algorithms/covariance/covariance_online.h" 57 #include "algorithms/covariance/covariance_distributed.h" 58 #include "algorithms/normalization/zscore.h" 93 lastInputDatasetId = data
100 enum InputCorrelationId
103 lastInputCorrelationId = correlation
110 enum Step2MasterInputId
113 lastStep2MasterInputId = partialResults
120 enum PartialCorrelationResultId
122 nObservationsCorrelation,
123 crossProductCorrelation,
125 lastPartialCorrelationResultId = sumCorrelation
132 enum PartialSVDTableResultId
137 lastPartialSVDTableResultId = sumSquaresSVD
144 enum PartialSVDCollectionResultId
146 auxiliaryData = lastPartialSVDTableResultId + 1,
148 lastPartialSVDCollectionResultId = distributedInputs
161 lastResultId = variances
168 enum ResultCollectionId
178 enum ResultToComputeId
181 mean = 0x00000001ULL,
182 variance = 0x00000002ULL,
183 eigenvalue = 0x00000004ULL
194 class DAAL_EXPORT InputIface :
public daal::algorithms::Input
197 InputIface(
size_t nElements);
198 InputIface(
const InputIface& other);
204 virtual size_t getNFeatures()
const = 0;
210 virtual bool isCorrelation()
const {
return _isCorrelation; };
212 virtual ~InputIface() {};
222 class DAAL_EXPORT Input :
public InputIface
226 Input(
const Input& other);
235 data_management::NumericTablePtr
get(InputDatasetId id)
const;
242 void set(InputDatasetId id,
const data_management::NumericTablePtr &value);
249 void set(InputCorrelationId id,
const data_management::NumericTablePtr &value);
255 size_t getNFeatures()
const DAAL_C11_OVERRIDE;
263 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
271 class PartialResultBase :
public daal::algorithms::PartialResult
274 PartialResultBase(
const size_t nElements) : daal::algorithms::PartialResult(nElements) {};
276 virtual size_t getNFeatures()
const = 0;
278 virtual ~PartialResultBase() {};
286 template<Method method>
287 class PartialResult :
public PartialResultBase {};
294 template<>
class DAAL_EXPORT PartialResult<daal::algorithms::pca::correlationDense> :
public PartialResultBase
297 DECLARE_SERIALIZABLE_CAST(PartialResult<daal::algorithms::pca::correlationDense>);
305 data_management::NumericTablePtr
get(PartialCorrelationResultId id)
const;
307 virtual size_t getNFeatures()
const DAAL_C11_OVERRIDE;
314 void set(
const PartialCorrelationResultId id,
const data_management::NumericTablePtr &value);
316 virtual ~PartialResult() {};
325 services::Status check(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
int method)
const DAAL_C11_OVERRIDE;
334 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
343 template <
typename algorithmFPType>
344 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
353 template <
typename algorithmFPType>
354 DAAL_EXPORT services::Status initialize(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
357 services::Status checkImpl(
size_t nFeatures)
const;
360 template<
typename Archive,
bool onDeserialize>
361 services::Status serialImpl(Archive *arch)
363 return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
372 template<>
class DAAL_EXPORT PartialResult<daal::algorithms::pca::svdDense> :
public PartialResultBase
375 DECLARE_SERIALIZABLE_CAST(PartialResult<daal::algorithms::pca::svdDense>);
383 data_management::NumericTablePtr
get(PartialSVDTableResultId id)
const;
385 virtual size_t getNFeatures()
const DAAL_C11_OVERRIDE;
392 data_management::DataCollectionPtr
get(PartialSVDCollectionResultId id)
const;
400 data_management::NumericTablePtr
get(PartialSVDCollectionResultId id,
const size_t &elementId)
const;
407 void set(PartialSVDTableResultId id,
const data_management::NumericTablePtr &value);
414 void set(PartialSVDCollectionResultId id,
const data_management::DataCollectionPtr &value);
421 void add(
const PartialSVDCollectionResultId &
id,
const data_management::DataCollectionPtr &value);
430 services::Status check(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
int method)
const DAAL_C11_OVERRIDE;
438 services::Status check(
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
440 virtual ~PartialResult() {};
449 template <
typename algorithmFPType>
450 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
459 template <
typename algorithmFPType>
460 DAAL_EXPORT services::Status initialize(
const daal::algorithms::Input *input,
const daal::algorithms::Parameter *parameter,
const int method);
464 services::Status checkImpl(
size_t nFeatures)
const;
467 template<
typename Archive,
bool onDeserialize>
468 services::Status serialImpl(Archive *arch)
470 return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
478 template<
typename algorithmFPType, Method method = correlationDense>
479 class DAAL_EXPORT BaseParameter :
public daal::algorithms::Parameter
490 template<
typename algorithmFPType, Method method>
491 class OnlineParameter :
public BaseParameter<algorithmFPType, method> {};
497 template<
typename algorithmFPType>
498 class DAAL_EXPORT OnlineParameter<algorithmFPType, correlationDense> :
public BaseParameter<algorithmFPType, correlationDense>
502 OnlineParameter(
const services::SharedPtr<covariance::OnlineImpl> &covarianceForOnlineParameter =
503 services::SharedPtr<covariance::Online<algorithmFPType, covariance::defaultDense> >
504 (
new covariance::Online<algorithmFPType, covariance::defaultDense>()));
506 services::SharedPtr<covariance::OnlineImpl> covariance;
512 services::Status check() const DAAL_C11_OVERRIDE;
520 template<typename algorithmFPType>
521 class DAAL_EXPORT OnlineParameter<algorithmFPType, svdDense> : public BaseParameter<algorithmFPType, svdDense>
531 services::Status check()
const DAAL_C11_OVERRIDE;
538 template<ComputeStep step,
typename algorithmFPType, Method method>
539 class DistributedParameter :
public BaseParameter<algorithmFPType, method> {};
545 template<
typename algorithmFPType>
546 class DAAL_EXPORT DistributedParameter<step2Master, algorithmFPType, correlationDense> :
public BaseParameter<algorithmFPType, correlationDense>
550 DistributedParameter(
const services::SharedPtr<covariance::DistributedIface<step2Master> > &covarianceForDistributedParameter =
551 services::SharedPtr<covariance::Distributed<step2Master, algorithmFPType, covariance::defaultDense> >
552 (
new covariance::Distributed<step2Master, algorithmFPType, covariance::defaultDense>()));
554 services::SharedPtr<covariance::DistributedIface<step2Master> > covariance;
560 services::Status check() const DAAL_C11_OVERRIDE;
567 template<Method method>
568 class DistributedInput {};
574 template<>
class DAAL_EXPORT DistributedInput<correlationDense> :
public InputIface
578 DistributedInput(
const DistributedInput& other);
585 void set(Step2MasterInputId id,
const data_management::DataCollectionPtr &ptr);
592 data_management::DataCollectionPtr
get(Step2MasterInputId id)
const;
598 services::SharedPtr<PartialResult<correlationDense> > getPartialResult(
size_t id)
const;
605 void add(Step2MasterInputId
id,
const services::SharedPtr<PartialResult<correlationDense> > &value);
611 size_t getNFeatures()
const DAAL_C11_OVERRIDE;
619 services::Status check(
const daal::algorithms::Parameter *parameter,
int method)
const DAAL_C11_OVERRIDE;
626 template<>
class DAAL_EXPORT DistributedInput<svdDense> :
public InputIface
630 DistributedInput(
const DistributedInput& other);
637 void set(Step2MasterInputId id,
const data_management::DataCollectionPtr &ptr);
644 data_management::DataCollectionPtr
get(Step2MasterInputId id)
const;
651 void add(Step2MasterInputId
id,
const services::SharedPtr<PartialResult<svdDense> > &value);
657 services::SharedPtr<PartialResult<svdDense> > getPartialResult(
size_t id)
const;
665 services::Status check(
const daal::algorithms::Parameter *parameter,
int method)
const DAAL_C11_OVERRIDE;
671 size_t getNFeatures()
const DAAL_C11_OVERRIDE;
682 class DAAL_EXPORT BaseBatchParameter :
public daal::algorithms::Parameter
686 BaseBatchParameter();
688 DAAL_UINT64 resultsToCompute;
690 bool isDeterministic;
698 template<
typename algorithmFPType, Method method>
699 class BatchParameter {};
706 template<
typename algorithmFPType>
707 class DAAL_EXPORT BatchParameter<algorithmFPType, correlationDense> :
public BaseBatchParameter
711 BatchParameter(
const services::SharedPtr<covariance::BatchImpl> &covarianceForBatchParameter =
712 services::SharedPtr<covariance::Batch<algorithmFPType, covariance::defaultDense> >
713 (
new covariance::Batch<algorithmFPType, covariance::defaultDense>()));
715 services::SharedPtr<covariance::BatchImpl> covariance;
722 services::Status check() const DAAL_C11_OVERRIDE;
729 template<typename algorithmFPType>
730 class DAAL_EXPORT BatchParameter<algorithmFPType, svdDense> : public BaseBatchParameter
734 BatchParameter(
const services::SharedPtr<normalization::zscore::BatchImpl> &normalizationForBatchParameter =
735 services::SharedPtr<normalization::zscore::Batch<algorithmFPType, normalization::zscore::defaultDense> >
736 (
new normalization::zscore::Batch<algorithmFPType, normalization::zscore::defaultDense>()));
738 services::SharedPtr<normalization::zscore::BatchImpl> normalization;
745 services::Status check() const DAAL_C11_OVERRIDE;
753 class DAAL_EXPORT Result : public daal::algorithms::Result
756 DECLARE_SERIALIZABLE_CAST(Result);
757 Result(
const Result& o);
760 virtual ~Result() {};
767 data_management::NumericTablePtr
get(ResultId id)
const;
774 data_management::KeyValueDataCollectionPtr
get(ResultCollectionId id)
const;
782 void set(ResultCollectionId id, data_management::KeyValueDataCollectionPtr& collection);
790 void set(ResultId id,
const data_management::NumericTablePtr &value);
798 template<
typename algorithmFPType>
799 DAAL_EXPORT services::Status allocate(
const daal::algorithms::Input *input, daal::algorithms::Parameter *parameter,
const Method method);
806 template<
typename algorithmFPType>
807 DAAL_EXPORT services::Status allocate(
const daal::algorithms::PartialResult *partialResult, daal::algorithms::Parameter *parameter,
const Method method);
816 services::Status check(
const daal::algorithms::Input *_input,
const daal::algorithms::Parameter *par,
int method)
const DAAL_C11_OVERRIDE;
825 services::Status check(
const daal::algorithms::PartialResult *pr,
const daal::algorithms::Parameter *parameter,
int method)
const DAAL_C11_OVERRIDE;
837 services::Status checkImpl(
size_t nFeatures,
size_t nComponents, DAAL_UINT64 resultsToCompute)
const;
840 template<
typename Archive,
bool onDeserialize>
841 services::Status serialImpl(Archive *arch)
843 return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
846 typedef services::SharedPtr<Result> ResultPtr;
850 using interface1::InputIface;
851 using interface1::Input;
852 using interface1::PartialResultBase;
853 using interface1::PartialResult;
854 using interface2::BatchParameter;
855 using interface2::BaseBatchParameter;
856 using interface1::OnlineParameter;
857 using interface1::DistributedParameter;
858 using interface1::DistributedInput;
859 using interface2::Result;
860 using interface2::ResultPtr;
daal::algorithms::pca::defaultDense
Definition: pca_types.h:82
daal::algorithms::pca::interface1::DistributedParameter
Class that specifies the parameters of the PCA algorithm in the distributed computing mode...
Definition: pca_types.h:539
daal::algorithms::pca::data
Definition: pca_types.h:92
daal::algorithms::pca::PartialCorrelationResultId
PartialCorrelationResultId
Definition: pca_types.h:120
daal::algorithms::pca::dataForTransform
Definition: pca_types.h:170
daal::algorithms::pca::auxiliaryData
Definition: pca_types.h:146
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::pca::interface1::BaseParameter
Class that specifies the common parameters of the PCA algorithm.
Definition: pca_types.h:479
daal::algorithms::pca::interface1::PartialResultBase
Provides interface to access partial results obtained with the compute() method of the PCA algorithm ...
Definition: pca_types.h:271
daal::algorithms::pca::ResultCollectionId
ResultCollectionId
Definition: pca_types.h:168
daal::algorithms::pca::eigenvalue
Definition: pca_types.h:183
daal::algorithms::pca::interface2::BatchParameter< algorithmFPType, correlationDense >::covariance
services::SharedPtr< covariance::BatchImpl > covariance
Definition: pca_types.h:715
daal::algorithms::pca::interface2::BaseBatchParameter
Class that specifies the common parameters of the PCA Batch algorithms.
Definition: pca_types.h:682
daal::algorithms::pca::eigenvalues
Definition: pca_types.h:157
daal::algorithms::interface1::PartialResult
Base class to represent partial results of the computation. Algorithm-specific partial results are re...
Definition: algorithm_types.h:253
daal::algorithms::pca::correlation
Definition: pca_types.h:102
daal::algorithms::covariance::interface1::Online
Computes correlation or variance-covariance matrix in the online processing mode. ...
Definition: covariance_online.h:436
daal::algorithms::covariance::interface1::DistributedIface
Interface for the correlation or variance-covariance matrix algorithm in the distributed processing m...
Definition: covariance_distributed.h:176
daal::algorithms::pca::interface1::DistributedParameter< step2Master, algorithmFPType, correlationDense >::covariance
services::SharedPtr< covariance::DistributedIface< step2Master > > covariance
Definition: pca_types.h:554
daal::algorithms::pca::interface2::BaseBatchParameter::isDeterministic
bool isDeterministic
Definition: pca_types.h:690
daal::algorithms::pca::means
Definition: pca_types.h:159
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
daal::algorithms::pca::variance
Definition: pca_types.h:182
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::pca::interface2::Result
Provides methods to access results obtained with the PCA algorithm.
Definition: pca_types.h:753
daal::algorithms::pca::interface1::OnlineParameter
Class that specifies the parameters of the PCA algorithm in the online computing mode.
Definition: pca_types.h:491
daal::algorithms::pca::InputCorrelationId
InputCorrelationId
Definition: pca_types.h:100
daal::algorithms::pca::eigenvectors
Definition: pca_types.h:158
daal::algorithms::pca::interface1::PartialResult< daal::algorithms::pca::svdDense >
Provides methods to access partial results obtained with the compute() method of PCA SVD algorithm in...
Definition: pca_types.h:372
daal::algorithms::pca::Step2MasterInputId
Step2MasterInputId
Definition: pca_types.h:110
daal::algorithms::pca::interface1::PartialResult
Provides methods to access partial results obtained with the compute() method of the PCA algorithm in...
Definition: pca_types.h:287
daal::algorithms::pca::interface2::BaseBatchParameter::nComponents
size_t nComponents
Definition: pca_types.h:689
daal::algorithms::pca::InputDatasetId
InputDatasetId
Definition: pca_types.h:90
daal::algorithms::pca::variances
Definition: pca_types.h:160
daal::algorithms::pca::svdDense
Definition: pca_types.h:83
daal::algorithms::pca::PartialSVDTableResultId
PartialSVDTableResultId
Definition: pca_types.h:132
daal::algorithms::pca::Method
Method
Definition: pca_types.h:79
daal::algorithms::pca::ResultToComputeId
ResultToComputeId
Definition: pca_types.h:178
daal::algorithms::pca::interface1::OnlineParameter< algorithmFPType, correlationDense >::covariance
services::SharedPtr< covariance::OnlineImpl > covariance
Definition: pca_types.h:506
daal::algorithms::pca::interface1::InputIface::isCorrelation
virtual bool isCorrelation() const
Definition: pca_types.h:210
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::pca::interface1::PartialResult< daal::algorithms::pca::correlationDense >
Provides methods to access partial results obtained with the compute() method of the PCA Correlation ...
Definition: pca_types.h:294
daal::step2Master
Definition: daal_defines.h:144
daal::algorithms::covariance::interface1::Distributed
Computes correlation or variance-covariance matrix in the distributed processing mode.
Definition: covariance_distributed.h:424
daal::algorithms::covariance::interface1::Batch
Computes correlation or variance-covariance matrix in the batch processing mode.
Definition: covariance_batch.h:369
daal::algorithms::pca::PartialSVDCollectionResultId
PartialSVDCollectionResultId
Definition: pca_types.h:144
daal::algorithms::pca::mean
Definition: pca_types.h:181
daal::algorithms::pca::distributedInputs
Definition: pca_types.h:147
daal::algorithms::pca::partialResults
Definition: pca_types.h:112
daal::algorithms::pca::interface2::BatchParameter< algorithmFPType, svdDense >::normalization
services::SharedPtr< normalization::zscore::BatchImpl > normalization
Definition: pca_types.h:738
daal::algorithms::pca::interface2::BatchParameter
Class that specifies the parameters of the PCA algorithm in the batch computing mode.
Definition: pca_types.h:699
daal::algorithms::pca::correlationDense
Definition: pca_types.h:81
daal::algorithms::pca::ResultId
ResultId
Definition: pca_types.h:155
daal::algorithms::normalization::zscore::interface2::Batch
Normalizes datasets in the batch processing mode.
Definition: zscore.h:198