Loading [MathJax]/extensions/tex2jax.js
1.7.2
Geostatistics & Machine Learning toolbox | https://gstlearn.org
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Model Class Reference

Class containing the Model Information describing the formal Spatial (or Temporal) Characteristics of the (set of) random variable(s) under study. More...

#include <Model.hpp>

Inheritance diagram for Model:
AStringable ASerializable ModelCovList ModelGeneric ICloneable

Detailed Description

Class containing the Model Information describing the formal Spatial (or Temporal) Characteristics of the (set of) random variable(s) under study.

The Model is essentially a container with two main contents:

  • the covariance part: see ACov.hpp for more information
  • the drift part: see DriftList.hpp for more information

The additional member CovContext only serves in carrying the following information:

  • the number of variables: if more than 1, the Model becomes multivariate
  • the field extension: this information is needed to get a stationary version to any covariance
  • the experimental mean vector and the variance-covariance matrix (used to calibrate the Model)

Public Member Functions

 Model (const CovContext &ctxt=CovContext())
 
 Model (int nvar, int ndim=2)
 
 Model (const Model &m)
 
Modeloperator= (const Model &m)
 
virtual ~Model ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 ICloneable interface.
 
const CovAnisoListcastInCovAnisoListConst (int icov=-1) const
 
const CovLMCTaperingcastInCovLMCTaperingConst () const
 
const CovLMGradientcastInCovLMGradientConst () const
 
const CovLMCAnamorphosiscastInCovLMCAnamorphosisConst () const
 
CovAnisoList_castInCovAnisoList (int icov=-1)
 
CovLMCTapering_castInCovLMCTapering ()
 
CovLMGradient_castInCovLMGradient ()
 
CovLMCAnamorphosis_castInCovLMCAnamorphosis ()
 
int resetFromDb (const Db *db)
 
void setCovAnisoList (const CovAnisoList *covalist)
 
void addCovAniso (const CovAniso *cov)
 
void addCovFromParam (const ECov &type, double range=EPSILON6, double sill=1., double param=1., const VectorDouble &ranges=VectorDouble(), const MatrixSymmetric &sills=MatrixSymmetric(), const VectorDouble &angles=VectorDouble(), bool flagRange=true)
 
void addCovFromParamOldStyle (const ECov &type, double range=EPSILON6, double sill=1., double param=1., const VectorDouble &ranges=VectorDouble(), const VectorDouble &sills=VectorDouble(), const VectorDouble &angles=VectorDouble(), bool flagRange=true)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeRangeNoStatDb)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeScaleNoStatDb)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeAngleNoStatDb)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeTensorNoStatDb)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeParamNoStatDb)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeRangeNoStatFunctional)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeScaleNoStatFunctional)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeAngleNoStatFunctional)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeTensorNoStatFunctional)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeParamNoStatFunctional)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeRangeStationary)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeScaleStationary)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeAngleStationary)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeTensorStationary)
 
 FORWARD_METHOD_NON_CONST (_castInCovAnisoList, makeParamStationary)
 
int setAnam (const AAnam *anam, const VectorInt &strcnt=VectorInt())
 
int unsetAnam ()
 
bool isFlagGradient () const
 
bool isFlagGradientNumerical () const
 
bool isFlagGradientFunctional () const
 
void switchToGradient ()
 
const CovAnisoListgetCovAnisoList () const
 TODO : to be removed (encapsulation of CovAnisoList)
 
CovAnisoListgetCovAnisoListModify ()
 
double evalCovFromIncr (const VectorDouble &incr, int icov=0, const ECalcMember &member=ECalcMember::fromKey("LHS")) const
 
Modelduplicate () const
 
ModelcreateReduce (const VectorInt &validVars) const
 
int getNVar () const
 
int fitFromCovIndices (Vario *vario, const VectorECov &types=ECov::fromKeys({"EXPONENTIAL"}), const Constraints &constraints=Constraints(), const Option_VarioFit &optvar=Option_VarioFit(), const Option_AutoFit &mauto=Option_AutoFit(), bool verbose=false)
 
int fit (Vario *vario, const VectorECov &types=ECov::fromKeys({"SPHERICAL"}), const Constraints &constraints=Constraints(), const Option_VarioFit &optvar=Option_VarioFit(), const Option_AutoFit &mauto=Option_AutoFit(), bool verbose=false)
 
int fitFromVMap (DbGrid *dbmap, const VectorECov &types=ECov::fromKeys({"SPHERICAL"}), const Constraints &constraints=Constraints(), const Option_VarioFit &optvar=Option_VarioFit(), const Option_AutoFit &mauto=Option_AutoFit(), bool verbose=false)
 
int stabilize (double percent, bool verbose=false)
 
int standardize (bool verbose=false)
 
bool isValid () const
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 
- Public Member Functions inherited from ModelCovList
 ModelCovList (const CovContext &ctxt=CovContext())
 
 ModelCovList (const ModelCovList &m)
 
ModelCovListoperator= (const ModelCovList &m)
 
virtual ~ModelCovList ()
 
const CovListgetCovList () const
 
CovListgetCovListModify () const
 
 FORWARD_METHOD_NON_CONST (getCovListModify, setCovFiltered)
 
void setCovList (CovList *covs)
 
virtual void addCov (const CovBase *cov)
 
- Public Member Functions inherited from ModelGeneric
 ModelGeneric (const CovContext &ctxt=CovContext())
 
 ModelGeneric (const ModelGeneric &r)
 
ModelGenericoperator= (const ModelGeneric &r)
 
virtual ~ModelGeneric ()
 
const ACovgetCov () const
 
const CovContextgetContext () const
 
const DriftListgetDriftList () const
 
ACov_getCovModify ()
 ICloneable interface.
 
CovContext_getContextModify ()
 
DriftList_getDriftListModify ()
 
void setField (double field)
 
bool isValid () const
 
void setCov (ACov *cova)
 
void setDriftList (const DriftList *driftlist)
 
void setDriftIRF (int order=0, int nfex=0)
 
void addDrift (const ADrift *drift)
 
void setDrifts (const VectorString &driftSymbols)
 
double computeLogLikelihood (const Db *db, bool verbose=false)
 
- Public Member Functions inherited from ICloneable
 ICloneable ()
 
virtual ~ICloneable ()
 
virtual ICloneableclone () const =0
 

Static Public Member Functions

static Modelcreate (const CovContext &ctxt=CovContext())
 
static ModelcreateFromEnvironment (int nvar, int ndim=2)
 
static ModelcreateNugget (int nvar, int ndim=2, double sill=1.)
 
static ModelcreateFromParam (const ECov &type=ECov::fromKey("NUGGET"), double range=1., double sill=1., double param=1., const VectorDouble &ranges=VectorDouble(), const MatrixSymmetric &sills=MatrixSymmetric(), const VectorDouble &angles=VectorDouble(), const ASpaceSharedPtr &space=ASpaceSharedPtr(), bool flagRange=true)
 
static ModelcreateFromParamOldStyle (const ECov &type=ECov::fromKey("NUGGET"), double range=1., double sill=1., double param=1., const VectorDouble &ranges=VectorDouble(), const VectorDouble &sills=VectorDouble(), const VectorDouble &angles=VectorDouble(), const ASpaceSharedPtr &space=ASpaceSharedPtr(), bool flagRange=true)
 
static ModelcreateFromDb (const Db *db)
 
static ModelcreateFromNF (const String &neutralFilename, bool verbose=true)
 
static ModelcreateFromVario (Vario *vario, const VectorECov &types=ECov::fromKeys({"SPHERICAL"}), const Constraints &constraints=Constraints(), const Option_VarioFit &optvar=Option_VarioFit(), const Option_AutoFit &mauto=Option_AutoFit(), bool verbose=false)
 
static ModelcreateFillRandom (int ndim, int nvar, const std::vector< ECov > &types=ECov::fromKeys({"SPHERICAL"}), double hmax=1, int order=-1, int nfex=0, int seed=13242)
 
static void gofDisplay (double gof, bool byValue=true, const VectorDouble &thresholds={2., 5., 10., 100})
 
static VectorECov initCovList (const VectorInt &covranks)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Constructor & Destructor Documentation

◆ Model() [1/3]

Model::Model ( const CovContext ctxt = CovContext())

◆ Model() [2/3]

Model::Model ( int  nvar,
int  ndim = 2 
)

◆ Model() [3/3]

Model::Model ( const Model m)

◆ ~Model()

Model::~Model ( )
virtual

Member Function Documentation

◆ _castInCovAnisoList()

CovAnisoList * Model::_castInCovAnisoList ( int  icov = -1)

◆ _castInCovLMCAnamorphosis()

CovLMCAnamorphosis * Model::_castInCovLMCAnamorphosis ( )

◆ _castInCovLMCTapering()

CovLMCTapering * Model::_castInCovLMCTapering ( )

◆ _castInCovLMGradient()

CovLMGradient * Model::_castInCovLMGradient ( )

◆ addCovAniso()

void Model::addCovAniso ( const CovAniso cov)

◆ addCovFromParam()

void Model::addCovFromParam ( const ECov &  type,
double  range = EPSILON6,
double  sill = 1.,
double  param = 1.,
const VectorDouble ranges = VectorDouble(),
const MatrixSymmetric sills = MatrixSymmetric(),
const VectorDouble angles = VectorDouble(),
bool  flagRange = true 
)

◆ addCovFromParamOldStyle()

void Model::addCovFromParamOldStyle ( const ECov &  type,
double  range = EPSILON6,
double  sill = 1.,
double  param = 1.,
const VectorDouble ranges = VectorDouble(),
const VectorDouble sills = VectorDouble(),
const VectorDouble angles = VectorDouble(),
bool  flagRange = true 
)

◆ castInCovAnisoListConst()

const CovAnisoList * Model::castInCovAnisoListConst ( int  icov = -1) const

This internal function tries to cast the member '_cova' into a pointer to CovAnisoList and checks the validity of the argument 'icov' which gives the rank within this list

Parameters
icovRank of the CovAniso (to be checked if >= 0)
Returns
'nullptr' if not valid cast (the error message is printed internally)

◆ castInCovLMCAnamorphosisConst()

const CovLMCAnamorphosis * Model::castInCovLMCAnamorphosisConst ( ) const

◆ castInCovLMCTaperingConst()

const CovLMCTapering * Model::castInCovLMCTaperingConst ( ) const

◆ castInCovLMGradientConst()

const CovLMGradient * Model::castInCovLMGradientConst ( ) const

◆ create()

Model * Model::create ( const CovContext ctxt = CovContext())
static

◆ createFillRandom()

Model * Model::createFillRandom ( int  ndim,
int  nvar,
const std::vector< ECov > &  types = ECov::fromKeys({"SPHERICAL"}),
double  hmax = 1,
int  order = -1,
int  nfex = 0,
int  seed = 13242 
)
static

◆ createFromDb()

Model * Model::createFromDb ( const Db db)
static

◆ createFromEnvironment()

Model * Model::createFromEnvironment ( int  nvar,
int  ndim = 2 
)
static

◆ createFromNF()

Model * Model::createFromNF ( const String neutralFilename,
bool  verbose = true 
)
static

◆ createFromParam()

Model * Model::createFromParam ( const ECov &  type = ECov::fromKey("NUGGET"),
double  range = 1.,
double  sill = 1.,
double  param = 1.,
const VectorDouble ranges = VectorDouble(),
const MatrixSymmetric sills = MatrixSymmetric(),
const VectorDouble angles = VectorDouble(),
const ASpaceSharedPtr space = ASpaceSharedPtr(),
bool  flagRange = true 
)
static

◆ createFromParamOldStyle()

Model * Model::createFromParamOldStyle ( const ECov &  type = ECov::fromKey("NUGGET"),
double  range = 1.,
double  sill = 1.,
double  param = 1.,
const VectorDouble ranges = VectorDouble(),
const VectorDouble sills = VectorDouble(),
const VectorDouble angles = VectorDouble(),
const ASpaceSharedPtr space = ASpaceSharedPtr(),
bool  flagRange = true 
)
static

◆ createFromVario()

Model * Model::createFromVario ( Vario vario,
const VectorECov types = ECov::fromKeys({"SPHERICAL"}),
const Constraints constraints = Constraints(),
const Option_VarioFit optvar = Option_VarioFit(),
const Option_AutoFit mauto = Option_AutoFit(),
bool  verbose = false 
)
static

◆ createNugget()

Model * Model::createNugget ( int  nvar,
int  ndim = 2,
double  sill = 1. 
)
static

◆ createReduce()

Model * Model::createReduce ( const VectorInt validVars) const

◆ duplicate()

Model * Model::duplicate ( ) const

◆ evalCovFromIncr()

double Model::evalCovFromIncr ( const VectorDouble incr,
int  icov = 0,
const ECalcMember &  member = ECalcMember::fromKey("LHS") 
) const

◆ fit()

int Model::fit ( Vario vario,
const VectorECov types = ECov::fromKeys({"SPHERICAL"}),
const Constraints constraints = Constraints(),
const Option_VarioFit optvar = Option_VarioFit(),
const Option_AutoFit mauto = Option_AutoFit(),
bool  verbose = false 
)

Automatic Fitting procedure from an experimental Variogram

Parameters
varioExperimental variogram to be fitted
typesVector of ECov (see remarks)
constraintsSet of Constraints
optvarSet of options
mautoSpecial parameters for Automatic fitting procedure (instance of Option_AutoFit), for exemple wmode (type of weighting function)
verboseVerbose option
Remarks
If no list of specific basic structure is specified, the automatic fitting is performed using a single spherical structure by default.
Returns
0 if no error, 1 otherwise

TODO : What to do with that ?

◆ fitFromCovIndices()

int Model::fitFromCovIndices ( Vario vario,
const VectorECov types = ECov::fromKeys({"EXPONENTIAL"}),
const Constraints constraints = Constraints(),
const Option_VarioFit optvar = Option_VarioFit(),
const Option_AutoFit mauto = Option_AutoFit(),
bool  verbose = false 
)

Automatic Fitting procedure

Parameters
varioExperimental variogram to be fitted
typesVector of ECov integer values
constraintsSet of Constraints
optvarSet of options
mautoSpecial parameters for Automatic fitting procedure
verboseVerbose option
Returns
0 if no error, 1 otherwise

TODO : What to do with that ?

◆ fitFromVMap()

int Model::fitFromVMap ( DbGrid dbmap,
const VectorECov types = ECov::fromKeys({"SPHERICAL"}),
const Constraints constraints = Constraints(),
const Option_VarioFit optvar = Option_VarioFit(),
const Option_AutoFit mauto = Option_AutoFit(),
bool  verbose = false 
)

Automatic Fitting procedure from A Variogram Map stored on a DbGrid

Parameters
dbmapDbGrid containing the Variogram Map
typesVector of ECov
constraintsSet of Constraints
optvarSet of options
mautoSpecial parameters for Automatic fitting procedure (instance of Option_AutoFit), for exemple wmode (type of weighting function)
verboseVerbose option
Returns
0 if no error, 1 otherwise

◆ FORWARD_METHOD_NON_CONST() [1/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeAngleNoStatDb   
)

◆ FORWARD_METHOD_NON_CONST() [2/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeAngleNoStatFunctional   
)

◆ FORWARD_METHOD_NON_CONST() [3/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeAngleStationary   
)

◆ FORWARD_METHOD_NON_CONST() [4/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeParamNoStatDb   
)

◆ FORWARD_METHOD_NON_CONST() [5/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeParamNoStatFunctional   
)

◆ FORWARD_METHOD_NON_CONST() [6/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeParamStationary   
)

◆ FORWARD_METHOD_NON_CONST() [7/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeRangeNoStatDb   
)

◆ FORWARD_METHOD_NON_CONST() [8/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeRangeNoStatFunctional   
)

◆ FORWARD_METHOD_NON_CONST() [9/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeRangeStationary   
)

◆ FORWARD_METHOD_NON_CONST() [10/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeScaleNoStatDb   
)

◆ FORWARD_METHOD_NON_CONST() [11/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeScaleNoStatFunctional   
)

◆ FORWARD_METHOD_NON_CONST() [12/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeScaleStationary   
)

◆ FORWARD_METHOD_NON_CONST() [13/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeTensorNoStatDb   
)

◆ FORWARD_METHOD_NON_CONST() [14/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeTensorNoStatFunctional   
)

◆ FORWARD_METHOD_NON_CONST() [15/15]

Model::FORWARD_METHOD_NON_CONST ( _castInCovAnisoList  ,
makeTensorStationary   
)

◆ getCovAnisoList()

const CovAnisoList * Model::getCovAnisoList ( ) const

TODO : to be removed (encapsulation of CovAnisoList)

◆ getCovAnisoListModify()

CovAnisoList * Model::getCovAnisoListModify ( )

◆ getNVar()

int Model::getNVar ( ) const

◆ gofDisplay()

void Model::gofDisplay ( double  gof,
bool  byValue = true,
const VectorDouble thresholds = {2., 5., 10., 100} 
)
static

◆ initCovList()

VectorECov Model::initCovList ( const VectorInt covranks)
static

◆ isFlagGradient()

bool Model::isFlagGradient ( ) const

◆ isFlagGradientFunctional()

bool Model::isFlagGradientFunctional ( ) const

◆ isFlagGradientNumerical()

bool Model::isFlagGradientNumerical ( ) const

◆ isValid()

bool Model::isValid ( ) const

◆ operator=()

Model & Model::operator= ( const Model m)

◆ resetFromDb()

int Model::resetFromDb ( const Db db)

◆ setAnam()

int Model::setAnam ( const AAnam anam,
const VectorInt strcnt = VectorInt() 
)

Defining an Anamorphosis information for the Model (in fact, this is added to CovAnisoList part and transforms it from CovAnisoList to CovLMCAnamorphosis

Parameters
anamPointer to the anamorphosis
strcntArray of covariance description used for IR case
Returns

◆ setCovAnisoList()

void Model::setCovAnisoList ( const CovAnisoList covalist)

Add a list of Covariances. This operation cleans any previously stored covariance

Parameters
covalistList of Covariances to be added

◆ stabilize()

int Model::stabilize ( double  percent,
bool  verbose = false 
)

Stabilize the model (in the monovariate case)

Returns
Error returned code
Parameters
[in]percentPercentage of nugget effect added
[in]verbosetrue for a verbose output
Remarks
If the model only contains GAUSSIAN structures, add
a NUGGET EFFECT structure with a sill equal to a percentage
of the total sill of the GAUSSIAN component(s)
This function does not do anything in the multivariate case

◆ standardize()

int Model::standardize ( bool  verbose = false)

Normalize the model

Parameters
[in]verbosetrue for a verbose output

◆ switchToGradient()

void Model::switchToGradient ( )

Switch to a Model dedicated to Gradients (transforms it from CovAnisoList to CovLMGradient)

◆ toString()

String Model::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

ICloneable interface.

AStringable Interface

Reimplemented from AStringable.

◆ unsetAnam()

int Model::unsetAnam ( )

The documentation for this class was generated from the following files: