#include <DistributedCollection.h>
Definition at line 18 of file DistributedCollection.h.
Public Member Functions | |
DistributedCollection (std::shared_ptr< SampleCollection > collection, std::shared_ptr< parcer::Communicator > comm) | |
virtual | ~DistributedCollection ()=default |
virtual void | Add (std::shared_ptr< SamplingState > newSamp) override |
Add a sample that is stored on this processor. More... | |
std::shared_ptr< SamplingState > | LocalAt (unsigned i) |
Get the local state at the \(i^{th}\) index. More... | |
const std::shared_ptr< SamplingState > | LocalAt (unsigned i) const |
Get the local state at the \(i^{th}\) index. More... | |
std::shared_ptr< SamplingState > | GlobalAt (unsigned i) |
Get the global state at the \(i^{th}\) index. More... | |
const std::shared_ptr< SamplingState > | GlobalAt (unsigned i) const |
Get the global state at the \(i^{th}\) index. More... | |
virtual std::shared_ptr< SamplingState > | at (unsigned i) override |
Get the local state at the \(i^{th}\) index. More... | |
virtual const std::shared_ptr< SamplingState > | at (unsigned i) const override |
Get the local state at the \(i^{th}\) index. More... | |
unsigned int | LocalSize () const |
The number of samples stored locally. More... | |
unsigned int | GlobalSize () const |
The total number of samples. More... | |
virtual unsigned int | size () const override |
The total number of samples. More... | |
Eigen::VectorXd | LocalCentralMoment (unsigned order, int blockDim=-1) const |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order. More... | |
Eigen::VectorXd | GlobalCentralMoment (unsigned order, int blockDim=-1) const |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order. More... | |
virtual Eigen::VectorXd | CentralMoment (unsigned order, int blockDim=-1) const override |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order. More... | |
Eigen::VectorXd | LocalMean (int blockDim=-1) const |
Compute the mean using only local samples. More... | |
Eigen::VectorXd | GlobalMean (int blockDim=-1) const |
Compute the mean using all of the samples. More... | |
virtual Eigen::VectorXd | Mean (int blockDim=-1) const override |
Compute the mean using all of the samples. More... | |
Eigen::VectorXd | LocalVariance (int blockDim=-1) const |
Compute the variance using only local samples. More... | |
Eigen::VectorXd | GlobalVariance (int blockDim=-1) const |
Compute the variance using all of the samples. More... | |
virtual Eigen::VectorXd | Variance (int blockDim=-1) const override |
Compute the variance using all of the samples. More... | |
Eigen::MatrixXd | LocalCovariance (int blockDim=-1) const |
Compute the covariance using only local samples. More... | |
Eigen::MatrixXd | GlobalCovariance (int blockDim=-1) const |
Compute the covariance using all of the samples. More... | |
virtual Eigen::MatrixXd | Covariance (int blockDim=-1) const override |
Compute the covariance using all of the samples. More... | |
Eigen::VectorXd | LocalESS (int blockDim=-1) const |
Compute the ESS using only local samples. More... | |
Eigen::VectorXd | GlobalESS (int blockDim=-1) const |
Compute the ESS using all of the samples. More... | |
virtual Eigen::VectorXd | ESS (int blockDim=-1) const override |
Compute the ESS using all of the samples. More... | |
Eigen::MatrixXd | AsLocalMatrix (int blockDim=-1) const |
Return all of the samples on the local processor as a matrix. More... | |
Eigen::MatrixXd | AsGlobalMatrix (int blockDim=-1) const |
Return all of the samples as a matrix. More... | |
virtual Eigen::MatrixXd | AsMatrix (int blockDim=-1) const override |
Return all of the samples as a matrix. More... | |
Eigen::VectorXd | LocalWeights () const |
Return all of the weights on this processor as a vector. More... | |
Eigen::VectorXd | GlobalWeights () const |
Return all of the weights as a vector. More... | |
virtual Eigen::VectorXd | Weights () const override |
Return all of the weights as a vector. More... | |
virtual void | WriteToFile (std::string const &filename, std::string const &dataset="/") const override |
Eigen::VectorXd | GlobalExpectedValue (std::shared_ptr< muq::Modeling::ModPiece > const &f, std::vector< std::string > const &metains=std::vector< std::string >()) const |
Eigen::VectorXd | LocalExpectedValue (std::shared_ptr< muq::Modeling::ModPiece > const &f, std::vector< std::string > const &metains=std::vector< std::string >()) const |
virtual Eigen::VectorXd | ExpectedValue (std::shared_ptr< muq::Modeling::ModPiece > const &f, std::vector< std::string > const &metains=std::vector< std::string >()) const override |
Public Member Functions inherited from muq::SamplingAlgorithms::SampleCollection | |
SampleCollection ()=default | |
virtual | ~SampleCollection ()=default |
virtual std::shared_ptr< SampleCollection > | head (unsigned int N) const |
virtual std::shared_ptr< SampleCollection > | tail (unsigned int N) const |
virtual std::shared_ptr< SampleCollection > | segment (unsigned int startInd, unsigned int length, unsigned int skipBy=1) const |
virtual const std::shared_ptr< SamplingState > | back () const |
virtual Eigen::VectorXd | CentralMoment (unsigned order, Eigen::VectorXd const &mean, int blockNum=-1) const override |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order given that we already know the mean. More... | |
virtual Eigen::VectorXd | CentralMoment (unsigned int order, int blockNum=-1) const override |
virtual Eigen::MatrixXd | Covariance (Eigen::VectorXd const &mean, int blockInd=-1) const override |
virtual std::vector< Eigen::MatrixXd > | RunningCovariance (int blockInd=-1) const |
virtual std::vector< Eigen::MatrixXd > | RunningCovariance (Eigen::VectorXd const &mean, int blockInd=-1) const |
virtual Eigen::VectorXd | ESS (std::string const &method="Batch") const override |
Returns the effective sample size of the samples. More... | |
virtual Eigen::VectorXd | ESS (int blockDim, std::string const &method) const override |
Eigen::VectorXd | BatchESS (int blockInd=-1, int batchSize=-1, int overlap=-1) const |
double | MultiBatchESS (int blockInd=-1, int batchSize=-1, int overlap=-1) const |
virtual Eigen::VectorXd | StandardError (int blockInd, std::string const &method) const override |
virtual Eigen::VectorXd | StandardError (int blockInd) const override |
virtual Eigen::VectorXd | StandardError (std::string const &method="Batch") const override |
virtual Eigen::VectorXd | BatchError (int blockInd=-1, int batchSize=-1, int overlap=-1) const |
virtual Eigen::VectorXd | MultiBatchError (int blockInd=-1, int batchSize=-1, int overlap=-1) const |
virtual Eigen::VectorXd | Rhat (int blockDim, unsigned int numSegments=4, boost::property_tree::ptree options=boost::property_tree::ptree()) const |
virtual Eigen::VectorXd | Rhat (unsigned int numSegments=4, boost::property_tree::ptree options=boost::property_tree::ptree()) const |
Public Member Functions inherited from muq::SamplingAlgorithms::SampleEstimator | |
virtual | ~SampleEstimator ()=default |
virtual unsigned int | BlockSize (int blockInd) const =0 |
virtual unsigned int | NumBlocks () const =0 |
virtual Eigen::VectorXd | CentralMoment (unsigned int order, Eigen::VectorXd const &mean, int blockNum=-1) const |
virtual Eigen::VectorXd | StandardizedMoment (unsigned int order, int blockInd=-1) const |
virtual Eigen::VectorXd | StandardizedMoment (unsigned int order, Eigen::VectorXd const &mean, int blockInd=-1) const |
virtual Eigen::VectorXd | StandardizedMoment (unsigned int order, Eigen::VectorXd const &mean, Eigen::VectorXd const &stdDev, int blockInd=-1) const |
virtual Eigen::VectorXd | Variance (Eigen::VectorXd const &mean, int blockInd=-1) const |
virtual Eigen::VectorXd | Skewness (int blockInd=-1) const |
virtual Eigen::VectorXd | Skewness (Eigen::VectorXd const &mean, int blockInd=-1) const |
virtual Eigen::VectorXd | Skewness (Eigen::VectorXd const &mean, Eigen::VectorXd const &stdDev, int blockInd=-1) const |
virtual Eigen::VectorXd | Kurtosis (int blockInd=-1) const |
virtual Eigen::VectorXd | Kurtosis (Eigen::VectorXd const &mean, int blockInd=-1) const |
virtual Eigen::VectorXd | Kurtosis (Eigen::VectorXd const &mean, Eigen::VectorXd const &stdDev, int blockInd=-1) const |
Additional Inherited Members | |
Static Public Member Functions inherited from muq::SamplingAlgorithms::SampleCollection | |
static std::shared_ptr< SampleCollection > | FromMatrix (Eigen::MatrixXd const &samps) |
DistributedCollection::DistributedCollection | ( | std::shared_ptr< SampleCollection > | collection, |
std::shared_ptr< parcer::Communicator > | comm | ||
) |
Definition at line 12 of file DistributedCollection.cpp.
|
virtualdefault |
|
overridevirtual |
Add a sample that is stored on this processor.
[in] | newSamp | The sample to be added |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 14 of file DistributedCollection.cpp.
References collection.
Eigen::MatrixXd DistributedCollection::AsGlobalMatrix | ( | int | blockDim = -1 | ) | const |
Return all of the samples as a matrix.
[in] | blockDim | Return the samples of this block |
Definition at line 137 of file DistributedCollection.cpp.
References AsLocalMatrix(), comm, GlobalSize(), and LocalSize().
Referenced by AsMatrix().
Eigen::MatrixXd DistributedCollection::AsLocalMatrix | ( | int | blockDim = -1 | ) | const |
Return all of the samples on the local processor as a matrix.
[in] | blockDim | Return the samples of this block |
Definition at line 135 of file DistributedCollection.cpp.
References collection.
Referenced by AsGlobalMatrix().
|
overridevirtual |
Return all of the samples as a matrix.
[in] | blockDim | Return the samples of this block |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 158 of file DistributedCollection.cpp.
References AsGlobalMatrix().
|
overridevirtual |
Get the local state at the \(i^{th}\) index.
[in] | i | The local index |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 20 of file DistributedCollection.cpp.
References GlobalAt().
|
overridevirtual |
Get the local state at the \(i^{th}\) index.
[in] | i | The local index |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 18 of file DistributedCollection.cpp.
References GlobalAt().
|
overridevirtual |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order.
Defaults to using all of the samples.
[in] | order | The order of the central moment |
[in] | blockDim | Compute the central moment of this block |
Definition at line 96 of file DistributedCollection.cpp.
References GlobalCentralMoment().
|
overridevirtual |
Compute the covariance using all of the samples.
Defaults to using the global covariance.
[in] | blockDim | Compute the covariance of this block |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 114 of file DistributedCollection.cpp.
References GlobalCovariance().
|
overridevirtual |
Compute the ESS using all of the samples.
Defaults to using the global ESS.
[in] | blockDim | Compute the ESS of this block |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 133 of file DistributedCollection.cpp.
References GlobalESS().
|
overridevirtual |
Using samples of \(x\) stored in this sample collection, this function approximates the expected value of \(f(x)\) for some function \(f\) defined as a muq::Modeling::ModPiece. The output is a vector containing the expected value of \(f\).
Implements muq::SamplingAlgorithms::SampleEstimator.
Definition at line 211 of file DistributedCollection.cpp.
References GlobalExpectedValue().
std::shared_ptr< SamplingState > DistributedCollection::GlobalAt | ( | unsigned | i | ) |
Get the global state at the \(i^{th}\) index.
[in] | i | The global index |
Definition at line 32 of file DistributedCollection.cpp.
References comm, GlobalSize(), LocalAt(), LocalSize(), and size().
Referenced by at().
const std::shared_ptr< SamplingState > DistributedCollection::GlobalAt | ( | unsigned | i | ) | const |
Get the global state at the \(i^{th}\) index.
[in] | i | The global index |
Definition at line 54 of file DistributedCollection.cpp.
References comm, GlobalSize(), LocalAt(), LocalSize(), and size().
Eigen::VectorXd DistributedCollection::GlobalCentralMoment | ( | unsigned | order, |
int | blockDim = -1 |
||
) | const |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order.
[in] | order | The order of the central moment |
[in] | blockDim | Compute the central moment of this block |
Definition at line 94 of file DistributedCollection.cpp.
References GlobalEigenMean(), and LocalCentralMoment().
Referenced by CentralMoment().
Eigen::MatrixXd DistributedCollection::GlobalCovariance | ( | int | blockDim = -1 | ) | const |
Compute the covariance using all of the samples.
[in] | blockDim | Compute the covariance of this block |
Definition at line 112 of file DistributedCollection.cpp.
References GlobalEigenMean(), and LocalCovariance().
Referenced by Covariance().
|
inlineprivate |
Definition at line 257 of file DistributedCollection.h.
References comm.
Referenced by GlobalCentralMoment(), GlobalCovariance(), GlobalMean(), and GlobalVariance().
Eigen::VectorXd DistributedCollection::GlobalESS | ( | int | blockDim = -1 | ) | const |
Compute the ESS using all of the samples.
[in] | blockDim | Compute the ESS of this block |
Definition at line 118 of file DistributedCollection.cpp.
References comm, and LocalESS().
Referenced by ESS().
Eigen::VectorXd DistributedCollection::GlobalExpectedValue | ( | std::shared_ptr< muq::Modeling::ModPiece > const & | f, |
std::vector< std::string > const & | metains = std::vector<std::string>() |
||
) | const |
Definition at line 191 of file DistributedCollection.cpp.
References comm, and LocalExpectedValue().
Referenced by ExpectedValue().
Eigen::VectorXd DistributedCollection::GlobalMean | ( | int | blockDim = -1 | ) | const |
Compute the mean using all of the samples.
[in] | blockDim | Compute the mean of this block |
Definition at line 100 of file DistributedCollection.cpp.
References GlobalEigenMean(), and LocalMean().
Referenced by LocalCentralMoment(), LocalCovariance(), and Mean().
unsigned int DistributedCollection::GlobalSize | ( | ) | const |
The total number of samples.
Definition at line 78 of file DistributedCollection.cpp.
References comm, LocalSize(), and size().
Referenced by AsGlobalMatrix(), GlobalAt(), GlobalWeights(), and size().
Eigen::VectorXd DistributedCollection::GlobalVariance | ( | int | blockDim = -1 | ) | const |
Compute the variance using all of the samples.
[in] | blockDim | Compute the variance of this block |
Definition at line 106 of file DistributedCollection.cpp.
References GlobalEigenMean(), and LocalVariance().
Referenced by Variance().
Eigen::VectorXd DistributedCollection::GlobalWeights | ( | ) | const |
Return all of the weights as a vector.
[in] | blockDim | Return the weights of this block |
Definition at line 162 of file DistributedCollection.cpp.
References comm, GlobalSize(), LocalSize(), and LocalWeights().
Referenced by Weights().
std::shared_ptr< SamplingState > DistributedCollection::LocalAt | ( | unsigned | i | ) |
Get the local state at the \(i^{th}\) index.
[in] | i | The local index |
Definition at line 22 of file DistributedCollection.cpp.
References collection, and size().
Referenced by GlobalAt().
const std::shared_ptr< SamplingState > DistributedCollection::LocalAt | ( | unsigned | i | ) | const |
Get the local state at the \(i^{th}\) index.
[in] | i | The local index |
Definition at line 27 of file DistributedCollection.cpp.
References collection, and size().
Eigen::VectorXd DistributedCollection::LocalCentralMoment | ( | unsigned | order, |
int | blockDim = -1 |
||
) | const |
Computes the componentwise central moments (e.g., variance, skewness, kurtosis, etc..) of a specific order.
[in] | order | The order of the central moment |
[in] | blockDim | Compute the central moment of this block |
Definition at line 92 of file DistributedCollection.cpp.
References collection, and GlobalMean().
Referenced by GlobalCentralMoment().
Eigen::MatrixXd DistributedCollection::LocalCovariance | ( | int | blockDim = -1 | ) | const |
Compute the covariance using only local samples.
[in] | blockDim | Compute the covariance of this block |
Definition at line 110 of file DistributedCollection.cpp.
References collection, and GlobalMean().
Referenced by GlobalCovariance().
Eigen::VectorXd DistributedCollection::LocalESS | ( | int | blockDim = -1 | ) | const |
Compute the ESS using only local samples.
[in] | blockDim | Compute the ESS of this block |
Definition at line 116 of file DistributedCollection.cpp.
References collection.
Referenced by GlobalESS().
Eigen::VectorXd DistributedCollection::LocalExpectedValue | ( | std::shared_ptr< muq::Modeling::ModPiece > const & | f, |
std::vector< std::string > const & | metains = std::vector<std::string>() |
||
) | const |
Definition at line 207 of file DistributedCollection.cpp.
References collection.
Referenced by GlobalExpectedValue().
Eigen::VectorXd DistributedCollection::LocalMean | ( | int | blockDim = -1 | ) | const |
Compute the mean using only local samples.
[in] | blockDim | Compute the mean of this block |
Definition at line 98 of file DistributedCollection.cpp.
References collection.
Referenced by GlobalMean().
unsigned int DistributedCollection::LocalSize | ( | ) | const |
The number of samples stored locally.
Definition at line 76 of file DistributedCollection.cpp.
References collection.
Referenced by AsGlobalMatrix(), GlobalAt(), GlobalSize(), and GlobalWeights().
Eigen::VectorXd DistributedCollection::LocalVariance | ( | int | blockDim = -1 | ) | const |
Compute the variance using only local samples.
[in] | blockDim | Compute the variance of this block |
Definition at line 104 of file DistributedCollection.cpp.
References collection.
Referenced by GlobalVariance().
Eigen::VectorXd DistributedCollection::LocalWeights | ( | ) | const |
Return all of the weights on this processor as a vector.
[in] | blockDim | Return the weights of this block |
Definition at line 160 of file DistributedCollection.cpp.
References collection.
Referenced by GlobalWeights().
|
overridevirtual |
Compute the mean using all of the samples.
Defaults to the global mean
[in] | blockDim | Compute the mean of this block |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 102 of file DistributedCollection.cpp.
References GlobalMean().
|
overridevirtual |
The total number of samples.
By default the size returns the global size.
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 90 of file DistributedCollection.cpp.
References GlobalSize().
Referenced by GlobalAt(), GlobalSize(), and LocalAt().
|
overridevirtual |
Compute the variance using all of the samples.
Defaults to using the global variance.
[in] | blockDim | Compute the variance of this block |
Reimplemented from muq::SamplingAlgorithms::SampleEstimator.
Definition at line 108 of file DistributedCollection.cpp.
References GlobalVariance().
|
overridevirtual |
Return all of the weights as a vector.
[in] | blockDim | Return the weights of this block |
Reimplemented from muq::SamplingAlgorithms::SampleCollection.
Definition at line 183 of file DistributedCollection.cpp.
References GlobalWeights().
|
overridevirtual |
Writes the local samples to file
[in] | filename | The name of the file |
[in] | dataset | The name of the group within the file |
Definition at line 187 of file DistributedCollection.cpp.
References collection.
|
private |
The local sample collection (stored on this processor)
Definition at line 274 of file DistributedCollection.h.
Referenced by Add(), AsLocalMatrix(), LocalAt(), LocalCentralMoment(), LocalCovariance(), LocalESS(), LocalExpectedValue(), LocalMean(), LocalSize(), LocalVariance(), LocalWeights(), and WriteToFile().
|
private |
The communicator for this collection.
Definition at line 277 of file DistributedCollection.h.
Referenced by AsGlobalMatrix(), GlobalAt(), GlobalEigenMean(), GlobalESS(), GlobalExpectedValue(), GlobalSize(), and GlobalWeights().