FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Core::FMTyieldmodelnn Class Referenceabstract

#include <FMTyieldmodelnn.hpp>

Inheritance diagram for Core::FMTyieldmodelnn:
[legend]
Collaboration diagram for Core::FMTyieldmodelnn:
[legend]

Public Member Functions

virtual ~FMTyieldmodelnn ()
 
 FMTyieldmodelnn ()=default
 
 FMTyieldmodelnn (const FMTyieldmodelnn &rhs)
 
const std::vector< double > Predict (const Core::FMTyieldrequest &request) const
 
virtual operator std::string () const
 
- Public Member Functions inherited from Core::FMTyieldmodel
virtual ~FMTyieldmodel ()
 
 FMTyieldmodel ()
 
 FMTyieldmodel (const FMTyieldmodel &rhs)=default
 
FMTyieldmodeloperator= (const FMTyieldmodel &rhs)=default
 
const std::string & GetModelName () const
 
const std::vector< std::string > & GetModelYields () const
 
virtual std::unique_ptr< FMTyieldmodelClone () const =0
 
virtual const std::vector< double > Predict (const Core::FMTyieldrequest &request) const =0
 
virtual std::unique_ptr< FMTyieldmodelpresolve (const FMTmaskfilter &filter, const std::vector< FMTtheme > &newthemes) const
 
virtual std::unique_ptr< FMTyieldmodelpostsolve (const FMTmaskfilter &filter, const std::vector< FMTtheme > &basethemes) const
 
virtual operator std::string () const =0
 
virtual std::vector< std::vector< double > > getperiodicvalues () const
 
- Public Member Functions inherited from Core::FMTobject
 FMTobject ()
 
virtual ~FMTobject ()
 
 FMTobject (const std::shared_ptr< Exception::FMTexceptionhandler > exhandler)
 
 FMTobject (const FMTobject &rhs)
 
FMTobjectoperator= (const FMTobject &rhs)
 
virtual void passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger)
 
void passinexceptionhandler (const std::shared_ptr< Exception::FMTexceptionhandler > &exhandler)
 
void redirectlogtofile (const std::string &location)
 
virtual void setdefaultlogger ()
 
virtual void setquietlogger ()
 
virtual void settasklogger ()
 
virtual void setdebuglogger ()
 
void setdefaultexceptionhandler ()
 
void setquietexceptionhandler ()
 
void setdebugexceptionhandler ()
 
void setfreeexceptionhandler ()
 
void disablenestedexceptions ()
 
void enablenestedexceptions ()
 
void seterrorstowarnings (const std::vector< Exception::FMTexc > &errors)
 
void setmaxwarningsbeforesilenced (const size_t &maxwarningcount)
 

Protected Member Functions

void ValidateInputYields (std::vector< std::string > &expectedYields, std::vector< std::string > &inputYields) const
 
const std::string & GetModelType () const
 
const std::vector< float > & GetStandardParamMeans () const
 
const std::vector< float > & GetStandardParamVars () const
 
const std::vector< std::string > & GetModelOutputNames () const
 
virtual const std::vector< double > GetInputValues (const Graph::FMTpredictor &predictor) const =0
 
const void RemoveNans (std::vector< float > &input) const
 
 FMTyieldmodelnn (const boost::property_tree::ptree &jsonProps, std::vector< std::string > &inputYields)
 
- Protected Member Functions inherited from Core::FMTobject
template<class Archive >
void forcesave (Archive &ar, const unsigned int version) const
 
template<class Archive >
void forceload (Archive &ar, const unsigned int version)
 
void checksignals () const
 
void setCPLhandler ()
 

Static Protected Member Functions

static const std::vector< std::string > GetNextLineAndSplitIntoTokens (std::istream &str)
 
static const std::vector< float > Standardize (std::vector< float > &input, const std::vector< float > &means, const std::vector< float > &vars)
 
- Static Protected Member Functions inherited from Core::FMTobject
static std::chrono::time_point< std::chrono::high_resolution_clock > getclock ()
 
template<class chrono >
static double getduration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 
static std::string getdurationinseconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 

Protected Attributes

std::unique_ptr< Ort::Session > sessionPtr
 
const std::string JSON_PROP_MODEL_TYPE = "modelType"
 
const std::string JSON_PROP_MODEL_YIELDS = "modelYields"
 
const std::string JSON_PROP_MODEL_OUTPUTS = "outputNames"
 
const std::string JSON_PROP_STAND_FILE_PATH = "csvStandardisationFile"
 
std::string modelType
 
std::vector< float > standardParamMeans = {}
 
std::vector< float > standardParamVars = {}
 
std::vector< std::string > modelOutputs = {}
 
- Protected Attributes inherited from Core::FMTyieldmodel
std::string modelName
 
std::vector< std::string > modelYields = {}
 
const std::string JSON_PROP_MODEL_NAME = "modelFileName"
 

Static Protected Attributes

static std::unique_ptr< Ort::Env > envPtr
 
static const float UNKNOWN_DISTURBANCE_CODE
 
- Static Protected Attributes inherited from Core::FMTobject
static std::shared_ptr< Exception::FMTexceptionhandler_exhandler
 A shared pointer to the exception handler.
 
static std::shared_ptr< Logging::FMTlogger_logger
 A shared pointer to the logger.
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::FMTobject
static std::string getruntimelocation ()
 
static unsigned long long getavailablememory ()
 

Detailed Description

FMTyieldmodelnn is an abstract class to be implemented as a machine learning model.

Constructor & Destructor Documentation

◆ FMTyieldmodelnn() [1/3]

Core::FMTyieldmodelnn::FMTyieldmodelnn ( const boost::property_tree::ptree jsonProps,
std::vector< std::string > &  inputYields 
)
protected

Construct a FMTyieldmodelnn based on a JSON file and an input yield name list.

◆ ~FMTyieldmodelnn()

virtual Core::FMTyieldmodelnn::~FMTyieldmodelnn ( )
virtual

Destructor for FMTyieldmodelnn.

◆ FMTyieldmodelnn() [2/3]

Core::FMTyieldmodelnn::FMTyieldmodelnn ( )
default

Constructor for FMTyieldmodelnn.

◆ FMTyieldmodelnn() [3/3]

Core::FMTyieldmodelnn::FMTyieldmodelnn ( const FMTyieldmodelnn rhs)

Copy constructor for FMTyieldmodelnn.

Member Function Documentation

◆ GetInputValues()

virtual const std::vector< double > Core::FMTyieldmodelnn::GetInputValues ( const Graph::FMTpredictor predictor) const
protectedpure virtual

Returns inputs values based on a predictor passed as parameter.

Implemented in Core::FMTyieldmodelnep, and Core::FMTyieldmodelpools.

◆ GetModelOutputNames()

const std::vector< std::string > & Core::FMTyieldmodelnn::GetModelOutputNames ( ) const
protected

Return model outputs' names.

◆ GetModelType()

const std::string & Core::FMTyieldmodelnn::GetModelType ( ) const
protected

Returns the model type.

◆ GetNextLineAndSplitIntoTokens()

static const std::vector< std::string > Core::FMTyieldmodelnn::GetNextLineAndSplitIntoTokens ( std::istream &  str)
staticprotected

Utility function used to read a csv file line by line.

◆ GetStandardParamMeans()

const std::vector< float > & Core::FMTyieldmodelnn::GetStandardParamMeans ( ) const
protected

Returns input variables' means used in the standartization process when predicting.

◆ GetStandardParamVars()

const std::vector< float > & Core::FMTyieldmodelnn::GetStandardParamVars ( ) const
protected

Returns input variables' variances used in the standartization process when predicting.

◆ operator std::string()

virtual Core::FMTyieldmodelnn::operator std::string ( ) const
virtual

When it comes to write down in a string the yield model.

Implements Core::FMTyieldmodel.

◆ Predict()

const std::vector< double > Core::FMTyieldmodelnn::Predict ( const Core::FMTyieldrequest request) const
virtual

Runs the machine learning model to predict its outputs.

Implements Core::FMTyieldmodel.

◆ RemoveNans()

const void Core::FMTyieldmodelnn::RemoveNans ( std::vector< float > &  input) const
protected

Replaces nan values with default values.

◆ Standardize()

static const std::vector< float > Core::FMTyieldmodelnn::Standardize ( std::vector< float > &  input,
const std::vector< float > &  means,
const std::vector< float > &  vars 
)
staticprotected

Utility function that applies the standardization formula, a feature scaling technique, on the inputs of a machine learning model.

◆ ValidateInputYields()

void Core::FMTyieldmodelnn::ValidateInputYields ( std::vector< std::string > &  expectedYields,
std::vector< std::string > &  inputYields 
) const
protected

Validates that there is the expected number of inputs in the model.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ envPtr

std::unique_ptr<Ort::Env> Core::FMTyieldmodelnn::envPtr
staticprotected

◆ JSON_PROP_MODEL_OUTPUTS

const std::string Core::FMTyieldmodelnn::JSON_PROP_MODEL_OUTPUTS = "outputNames"
protected

◆ JSON_PROP_MODEL_TYPE

const std::string Core::FMTyieldmodelnn::JSON_PROP_MODEL_TYPE = "modelType"
protected

◆ JSON_PROP_MODEL_YIELDS

const std::string Core::FMTyieldmodelnn::JSON_PROP_MODEL_YIELDS = "modelYields"
protected

◆ JSON_PROP_STAND_FILE_PATH

const std::string Core::FMTyieldmodelnn::JSON_PROP_STAND_FILE_PATH = "csvStandardisationFile"
protected

◆ modelOutputs

std::vector<std::string> Core::FMTyieldmodelnn::modelOutputs = {}
protected

◆ modelType

std::string Core::FMTyieldmodelnn::modelType
protected

◆ sessionPtr

std::unique_ptr<Ort::Session> Core::FMTyieldmodelnn::sessionPtr
protected

◆ standardParamMeans

std::vector<float> Core::FMTyieldmodelnn::standardParamMeans = {}
protected

◆ standardParamVars

std::vector<float> Core::FMTyieldmodelnn::standardParamVars = {}
protected

◆ UNKNOWN_DISTURBANCE_CODE

const float Core::FMTyieldmodelnn::UNKNOWN_DISTURBANCE_CODE
staticprotected

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