Go to the documentation of this file.
11 #ifndef DARegression_H
12 #define DARegression_H
14 #include "fvOptions.H"
15 #include "surfaceFields.H"
19 #include "globalIndex.H"
109 #if defined(CODI_ADF)
110 double* featuresFlattenArrayDouble_;
114 double* outputFieldArrayDouble_;
143 #if defined(CODI_ADF)
144 delete[] featuresFlattenArrayDouble_;
145 delete[] outputFieldArrayDouble_;
177 label
checkOutput(word modelName, volScalarField& outputField);
182 if (!
active_ || !printToScreen)
191 Info <<
"RegModel input info for " << modelName << endl;
195 Info << name <<
" Min: " << gMin(
features_[modelName][idxI]) <<
" Max: " << gMax(
features_[modelName][idxI])
196 <<
" Avg: " << gAverage(
features_[modelName][idxI]) <<
" Std: " << sqrt(gSumSqr(
features_[modelName][idxI]) /
features_[modelName][idxI].size()) << endl;
const fvMesh & mesh_
Foam::fvMesh object.
HashTable< wordList > inputNames_
a list of words for the inputs
HashTable< word > activationFunction_
neural network activation function
virtual ~DARegression()
Destructor.
HashTable< word > outputName_
a list of words for the outputs
HashTable< word > modelType_
the type of regression model
const DAOption & daOption_
Foam::DAOption object.
scalar * featuresFlattenArray_
a flatten feature array for externalTensorFlow model
HashTable< scalar > leakyCoeff_
if the ReLU activation function is used we can prescribe a potentially leaky coefficient
HashTable< label > nRBFs_
number of radial basis function
label useExternalModel_
whether to use external model
void printInputInfo(const label printToScreen)
print the input
wordList modelNames_
name of the regression models
HashTable< scalarList > parameters_
the parameters for the regression model
scalar * outputFieldArray_
output field array for externalTensorFlow model
HashTable< scalar > outputScale_
we can scale the output. we always shift before scaling it.
label featuresFlattenArraySize_
the array size is chosen based on the regModel that has the largest number of inputs (this is importa...
label checkOutput(word modelName, volScalarField &outputField)
check if the output values are valid otherwise bound or fix them
void setParameter(word modelName, label idxI, scalar val)
set a value to a parameter give an index and a value
HashTable< scalarList > inputShift_
we can shift each input. we always shift before scaling it.
HashTable< scalarList > inputScale_
we can scale each input. we always shift before scaling it.
void writeFeatures()
write the features to the disk
const DAModel & daModel_
DAModel object.
void calcInputFeatures(word modelName)
calculate the input flow features
bool writeData(Ostream &os) const
this is a virtual function for regIOobject
label active_
whether the regression model is active
HashTable< scalar > outputLowerBound_
the lower bound for the output
HashTable< label > printInputInfo_
whether to print the input range info this is used to scale the input
HashTable< scalar > outputShift_
we can shift the output. we always shift before scaling it.
scalar getParameter(word modelName, label idxI)
get a specific parameter value
HashTable< label > writeFeatures_
whether to write the feature fields to the disk
HashTable< scalar > outputUpperBound_
the upper bound for the output
HashTable< labelList > hiddenLayerNeurons_
number of neurons hidden layers of the neural network
HashTable< PtrList< volScalarField > > features_
a list of scalarField to save the input features
label nParameters(word modelName)
get the number of parameters for this regression model
HashTable< scalar > defaultOutputValue_
default output values
label compute()
compute the output based on the latest parameters and inputs