Class Dimlp
Defined in File dimlp.h
Inheritance Relationships
Base Type
public BpNN
(Class BpNN)
Derived Type
public BagDimlp
(Class BagDimlp)
Class Documentation
-
class Dimlp : public BpNN
The Dimlp class represents a Discretized Interpretable Multi-Layer Perceptron.
This class provides functionality for training and evaluating a Dimlp neural network, which is a type of neural network that includes discretized levels for interpretability.
Subclassed by BagDimlp
Public Functions
-
inline float Error(DataSet &data, DataSet &target, float *accuracy)
Computes the error and accuracy of the Dimlp network on a given dataset.
- Parameters:
data – The dataset to evaluate.
target – The target values corresponding to the dataset.
accuracy – Pointer to store the computed accuracy.
- Returns:
The computed error.
-
inline void Train(DataSet &train, DataSet &trainTar, DataSet &test, DataSet &testTar, DataSet &valid, DataSet &validTar, const std::string &accuracyFile, bool fromBT = false)
Trains the Dimlp network using the provided datasets.
- Parameters:
train – The training dataset.
trainTar – The target values for the training dataset.
test – The testing dataset.
testTar – The target values for the testing dataset.
valid – The validation dataset.
validTar – The target values for the validation dataset.
accuracyFile – The file to save accuracy metrics.
fromBT – Flag indicating if training is done with bagging.
-
Dimlp(float eta, float mu, float flat, float errParam, float accuracyParam, float deltaErrParam, int discrLevels, int showErrParam, int nbEpochsParam, int nbLayers, const std::vector<int> &nbNeurons, const std::string &weightFile, int seed = 0)
Constructs a Dimlp network with specified parameters.
- Parameters:
eta – Learning rate.
mu – Momentum.
flat – Flatness factor.
errParam – Error threshold.
accuracyParam – Accuracy threshold.
deltaErrParam – Delta error threshold.
discrLevels – Number of discretized levels.
showErrParam – Show error parameter.
nbEpochsParam – Number of epochs.
nbLayers – Number of layers in the network.
nbNeurons – Number of neurons in each layer.
weightFile – File to save weights.
seed – Seed for random number generation (default: 0).
-
Dimlp(const std::string &readFile, int nbLayers, const std::vector<int> &nbNeurons, int discrLevels, int netId = 1)
Constructs a Dimlp network by reading weights from a file.
- Parameters:
readFile – File to read weights from.
nbLayers – Number of layers in the network.
nbNeurons – Number of neurons in each layer.
discrLevels – Number of discretized levels.
netId – Network ID (default: 1).
-
Dimlp(const std::string &readFile, float eta, float mu, float flat, float errParam, float accuracyParam, float deltaErrParam, int discrLevels, int showErrParam, int nbEpochsParam, int nbLayers, const std::vector<int> &nbNeurons, const std::string &weightFile, int seed = 0)
Constructs a Dimlp network by reading weights from a file and sets training parameters.
- Parameters:
readFile – File to read weights from.
eta – Learning rate.
mu – Momentum.
flat – Flatness factor.
errParam – Error threshold.
accuracyParam – Accuracy threshold.
deltaErrParam – Delta error threshold.
discrLevels – Number of discretized levels.
showErrParam – Show error parameter.
nbEpochsParam – Number of epochs.
nbLayers – Number of layers in the network.
nbNeurons – Number of neurons in each layer.
weightFile – File to save weights.
seed – Seed for random number generation (default: 0).
-
inline float Error(DataSet &data, DataSet &target, float *accuracy)