42 namespace statistics {
65 inline std::vector<std::string>
ParameterTypeNames () {
return {
"Base",
"Derived",
"Correlated"}; }
89 inline std::vector<ParameterType>
ParameterTypeCast (
const std::vector<int> parameterTypeIndeces) {
return castFromValues<ParameterType>(parameterTypeIndeces); }
97 inline std::vector<ParameterType>
ParameterTypeCast (
const std::vector<std::string> parameterTypeNames) {
return castFromNames<ParameterType>(parameterTypeNames,
ParameterTypeNames()); }
163 ModelParameters (
const size_t nparameters, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames);
275 virtual std::string
status (
const int p)
const
283 virtual std::vector<std::string>
status ()
const
284 {
ErrorCBL(
"",
"status",
"ModelParameters.h"); std::vector<std::string> vv;
return vv;}
293 virtual std::vector<double>
full_parameter (
const std::vector<double> parameter_value)
const;
304 virtual void set_parameters (
const size_t nparameters, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames);
326 virtual void set_parameters (
const size_t nparameters,
const std::vector<std::shared_ptr<PriorDistribution>> priorDistributions, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames)
327 { (void)
nparameters; (void)priorDistributions; (void)parameterTypes, (
void)parameterNames;
ErrorCBL(
"",
"set_parameters",
"ModelParameters.h"); }
343 {
ErrorCBL(
"",
"nparameters_free",
"ModelParameters.h");
return 1; }
351 {
ErrorCBL(
"",
"free_parameter",
"ModelParameters.h"); std::vector<unsigned int> vv;
return vv; }
359 {
ErrorCBL(
"",
"nparameters_fixed",
"ModelParameters.h");
return 1; }
367 {
ErrorCBL(
"",
"fixed_parameters",
"ModelParameters.h"); std::vector<unsigned int> vv;
return vv; }
382 virtual void free (
const int p)
383 { (void)p;
ErrorCBL(
"",
"free",
"ModelParameters.h"); }
392 virtual void fix (
const int p,
const double value)
393 { (void)p; (void)value;
ErrorCBL(
"",
"fix",
"ModelParameters.h"); }
402 { (void)p;
ErrorCBL(
"",
"fix_at_bestfit",
"ModelParameters.h"); }
416 { (void)p;
ErrorCBL(
"",
"bestfit_value",
"ModelParameters.h");
return 0.; }
424 {
ErrorCBL(
"",
"bestfit_value",
"ModelParameters.h"); std::vector<double> vv;
return vv; }
446 { (void)start; (void)thin; (void)nbins; (void)seed;
ErrorCBL(
"",
"set_bestfit_values",
"ModelParameters.h"); }
452 {
ErrorCBL(
"",
"write_bestfit_info",
"ModelParameters.h"); }
471 { (void)p; (void)priorDistribution;
ErrorCBL(
"",
"set_prior_distribution",
"ModelParameters.h"); }
480 { (void)priorDistributions;
ErrorCBL(
"",
"set_prior_distribution",
"ModelParameters.h"); }
489 { (void)ran_generator;
ErrorCBL(
"",
"set_prior_distribution_seed",
"ModelParameters.h"); }
501 { (void)p;
ErrorCBL(
"",
"prior_distribution",
"ModelParameters.h");
return NULL; }
510 {
ErrorCBL(
"",
"prior_distribution",
"ModelParameters.h"); std::vector<std::shared_ptr<PriorDistribution>> vv;
return vv; }
517 virtual std::shared_ptr<Prior>
prior ()
const
518 {
ErrorCBL(
"",
"prior",
"ModelParameters.h");
return NULL; }
530 { (void)start; (void)thin;
ErrorCBL(
"",
"set_parameter_covariance",
"ModelParameters.h"); }
542 { (void)i; (void)j;
ErrorCBL(
"",
"parameter_covariance",
"ModelParameters.h");
return 0.; }
551 {
ErrorCBL(
"",
"parameter_covariance",
"ModelParameters.h"); std::vector<std::vector<double>> vv;
return vv; }
573 virtual void set_posterior_distribution (
const int start,
const int thin,
const int nbins,
const int seed=34121,
const std::vector<double> weight={})
574 { (void)start; (void)thin; (void)nbins; (void)seed; (void)weight;
ErrorCBL(
"",
"set_posterior_distribution",
"ModelParameters.h"); }
585 { (void)par;
ErrorCBL(
"",
"posterior_distribution",
"ModelParameters.h");
return NULL; }
613 virtual void show_results (
const int start,
const int thin,
const int nbins,
const int seed=34121,
const bool show_mode=
false,
const int ns=-1,
const int nb=-1,
const std::vector<double> weight={})
614 { (void)start; (void)thin; (void)nbins; (void)seed; (void)show_mode; (void)ns; (void)nb; (void)weight;
ErrorCBL(
"",
"show_results",
"ModelParameters.h"); }
643 virtual void write_results (
const std::string dir,
const std::string file,
const int start,
const int thin,
const int nbins,
const int seed=34121,
const bool compute_mode=
false,
const int ns=-1,
const int nb=-1,
const std::vector<double> weight={})
644 { (void)dir; (void)file; (void)start; (void)thin; (void)nbins; (void)seed; (void)compute_mode; (void)ns; (void)nb; (void)weight;
ErrorCBL(
"",
"write_results",
"ModelParameters.h"); }
652 {
ErrorCBL(
"",
"chain_size",
"ModelParameters.h");
return 0; }
660 {
ErrorCBL(
"",
"chain_nwalkers",
"ModelParameters.h");
return 0; }
669 virtual void set_chain (
const size_t size,
const size_t nwalkers)
670 { (void)size; (void)nwalkers;
ErrorCBL(
"",
"set_chain",
"ModelParameters.h"); }
676 {
ErrorCBL(
"",
"reset_chain",
"ModelParameters.h"); }
684 { (void)append;
ErrorCBL(
"",
"expand_chain",
"ModelParameters.h"); }
698 virtual double chain_value (
const int param,
const int pos,
const int ww)
const
699 { (void)param; (void)pos; (void)ww;
ErrorCBL(
"",
"chain_value",
"ModelParameters.h");
return 0.; }
712 { (void)pos; (void)ww;
ErrorCBL(
"",
"chain_value_parameters",
"ModelParameters.h"); std::vector<double> vv;
return vv; }
726 { (void)par; (void)start; (void)thin;
ErrorCBL(
"",
"parameter_chain_values",
"ModelParameters.h"); std::vector<double> vv;
return vv; }
740 virtual void set_chain_value (
const int param,
const int pos,
const int ww,
const double value)
741 { (void)param; (void)pos; (void)ww; (void)value;
ErrorCBL(
"",
"set_chain_value",
"ModelParameters.h"); }
750 virtual void set_chain_values (
const std::vector<std::vector<double>> values,
const int nwalkers)
751 { (void)values; (void)nwalkers;
ErrorCBL(
"",
"set_chain_values",
"ModelParameters.h"); }
759 { (void)values;
ErrorCBL(
"",
"set_chain_values",
"ModelParameters.h"); }
767 { (void)values;
ErrorCBL(
"",
"initialize_chain",
"ModelParameters.h"); }
774 {
ErrorCBL(
"",
"initialize_chain_from_prior",
"ModelParameters.h"); }
786 { (void)center; (void)radius; (void)seed;
ErrorCBL(
"",
"initialize_chain_ball",
"ModelParameters.h"); }
797 { (void)radius; (void)seed;
ErrorCBL(
"",
"initialize_chain_ball_bestfit",
"ModelParameters.h"); }
The class PosteriorDistribution.
The class PriorDistribution.
The class ModelParameters.
ParameterType type(const int p) const
return the model parameter type
virtual void expand_chain(const int append)
expand the already existing chain
size_t m_nparameters_base
number of base parameters
virtual std::shared_ptr< Prior > prior() const
get the prior function
size_t m_nparameters_correlated
number of correlated parameters
virtual std::vector< double > parameter_chain_values(const int par, const int start=0, const int thin=1) const
return all the chain values for a parameter
virtual std::vector< double > bestfit_value() const
get the protected member m_value
virtual void set_chain_values(const std::vector< std::vector< double >> values, const int nwalkers)
set the chain values
virtual double parameter_covariance(const int i, const int j) const
return the protected member m_parameter_covariance
virtual std::shared_ptr< PriorDistribution > prior_distribution(const int p) const
get the prior distribution for the p-th parameter
virtual void fix_at_bestfit(const int p)
fix the parameter at the bestfit value, contained in m_bestfit_value
virtual std::shared_ptr< PosteriorDistribution > posterior_distribution(const int par) const
get the posterior distribution for the chosen parameter
size_t nparameters_correlated() const
return the number of correlated parameters
virtual double bestfit_value(const int p) const
get the protected member m_value
virtual void reset()
reset the parameter vectors
virtual void write_bestfit_info()
write the bestfit info
size_t m_nparameters_derived
number of derived parameters
std::vector< unsigned int > m_derived_parameter
indexes of the derived parameters
std::vector< unsigned int > m_base_parameter
indexes of base parameters
virtual void set_bestfit_values(const std::vector< double > bestfit_value)
set the protected member m_bestfit_value
virtual std::vector< unsigned int > free_parameter() const
return the private member m_free_parameter
std::vector< ParameterType > type() const
return all the model parameter names
virtual std::vector< double > chain_value_parameters(const int pos, const int ww) const
return the private member m_values at the pp-th step for the ww-th step for all the parameters
virtual std::vector< unsigned int > fixed_parameter() const
return the private member m_fixed_parameters
virtual void set_chain(const size_t size, const size_t nwalkers)
set the chain
virtual void set_chain_values(const std::vector< std::vector< std::vector< double >>> values)
set the chain values
size_t m_nparameters
number of parameters
virtual void set_bestfit_values(const int start, const int thin, const int nbins, const int seed)
set the protected member m_bestfit_value
virtual void write_results(const std::string dir, const std::string file, const int start, const int thin, const int nbins, const int seed=34121, const bool compute_mode=false, const int ns=-1, const int nb=-1, const std::vector< double > weight={})
store the results to file
std::vector< unsigned int > derived_parameter() const
return the private member m_derived_parameter
virtual std::vector< std::string > status() const
return all the model parameter status
size_t nparameters() const
return the total number of parameters
virtual void set_chain_value(const int param, const int pos, const int ww, const double value)
set the private member m_chain_values at the pp-th step for the ww-th step
virtual void initialize_chain(const std::vector< std::vector< double >> values)
initialize the chain values
virtual double chain_value(const int param, const int pos, const int ww) const
return the private member m_chain_values at the pos step for the ww-th walker, for the chosen paramet...
size_t nparameters_base() const
return the number of base parameters
virtual void initialize_chain_from_prior()
initialize the chain values random sampling the parameter priors
virtual std::string status(const int p) const
return the model parameter status
virtual void set_prior_distribution_seed(const std::shared_ptr< random::UniformRandomNumbers_Int > ran_generator)
set the prior distributions for the parameters
virtual void set_prior_distribution(const int p, const std::shared_ptr< PriorDistribution > priorDistribution)
set the prior distribution for the p-th parameter
virtual std::vector< std::shared_ptr< PriorDistribution > > prior_distribution() const
get the prior distribution for the p-th parameter
virtual void set_prior_distribution(const std::vector< std::shared_ptr< PriorDistribution >> priorDistributions)
set the prior distributions for the parameters
virtual void set_posterior_distribution(const int start, const int thin, const int nbins, const int seed=34121, const std::vector< double > weight={})
set the prior distribution for the p-th parameter
std::vector< unsigned int > base_parameter() const
return the private member m_base_parameters
~ModelParameters()=default
default destructor
virtual void set_parameters(const size_t nparameters, std::vector< ParameterType > parameterTypes, std::vector< std::string > parameterNames)
set the parameter
virtual void initialize_chain_ball(const std::vector< double > center, const double radius, const double seed)
initialize the chain values
virtual size_t nparameters_free() const
return the number of free parameters
virtual void initialize_chain_ball_bestfit(const double radius, const double seed)
initialize the chain values around bestfit values
size_t nparameters_derived() const
return the number of derived parameters
virtual void set_parameters(const size_t nparameters, const std::vector< std::shared_ptr< PriorDistribution >> priorDistributions, std::vector< ParameterType > parameterTypes, std::vector< std::string > parameterNames)
set the parameter
std::string name(const int p) const
return the model parameter name
virtual void show_results(const int start, const int thin, const int nbins, const int seed=34121, const bool show_mode=false, const int ns=-1, const int nb=-1, const std::vector< double > weight={})
show the results on the standard output
std::vector< std::string > m_parameter_name
model parameter types
virtual std::vector< double > full_parameter(const std::vector< double > parameter_value) const
return all the model parameters, for internal usage
virtual void fix(const int p, const double value)
fix the parameter at the input value
virtual void set_parameter_covariance(const int start=0, const int thin=1)
set the internal method m_parameter_covariance
virtual std::vector< std::vector< double > > parameter_covariance() const
return the protected member m_parameter_covariance
virtual void reset_chain()
reset the chain using m_size and m_nwalkers
virtual void m_set_parameter_type()
private member to set the parameter types
virtual void free(const int p)
set m_fixed to false
virtual size_t nparameters_fixed() const
return the number of fixed parameters
virtual size_t chain_size() const
return the private member m_chain_size
ModelParameters()=default
default constructor
std::vector< ParameterType > m_parameter_type
model parameters
virtual size_t chain_nwalkers() const
return the private member m_chain_nwalkers
std::vector< std::string > name() const
return all the model parameter names
static const std::string defaultString
default std::string value
ParameterType
the parameter type
@ _Derived_
derived parameter
@ _Correlated_
correlated parameters
std::vector< std::string > ParameterTypeNames()
return a vector containing the ParameterType names
ParameterType ParameterTypeCast(const int parameterTypeIndex)
cast an enum of type ParameterType from its index
The global namespace of the CosmoBolognaLib
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib