129 std::vector<double>
sigmoid(
const std::vector<double> &x);
139 std::vector<double>
forward(
const std::vector<double> &input);
150 virtual void train(
const std::vector<std::vector<double>> &training_data,
180 virtual void save(
const std::string &filename)
const;
187 virtual void load(
const std::string &filename);
230 void train(
const std::vector<std::vector<double>> &training_data,
231 int epochs)
override;
269 void train(
const std::vector<std::vector<double>> &training_data,
270 int epochs)
override;
306 virtual void train(
const std::vector<std::vector<double>> &training_data,
307 int epochs)
override;
344 virtual void train(
const std::vector<std::vector<double>> &training_data,
345 int epochs)
override;
383 virtual void train(
const std::vector<std::vector<double>> &training_data,
384 int epochs)
override;
424 std::vector<double>
encoder(
const std::vector<double> &input);
433 std::vector<double>
decoder(
const std::vector<double> &hidden_sampled);
443 const std::vector<double> &output,
444 const std::vector<double> &hidden_sampled);
468 virtual void train(
const std::vector<std::vector<double>> &training_data,
469 int epochs)
override;
505 virtual void train(
const std::vector<std::vector<double>> &training_data,
506 int epochs)
override;
515 std::vector<double>
recurr_fwd(
const std::vector<double> &input,
516 const std::vector<double> &previous_hidden);
546 virtual void train(
const std::vector<std::vector<double>> &training_data,
547 int epochs)
override;
A simple implementation of a vanilla autoencoder.
std::vector< std::vector< double > > weights_input_hidden
Weights from the input layer to the hidden layer.
std::vector< std::vector< double > > weights_hidden_output
Weights from the hidden layer to the output layer.
int hidden_size
Size of the hidden layer.
virtual void lrate_update(int epoch)
Update the learning rate based on a schedule.
void lrate_set(double initial_rate)
Set the initial learning rate.
AutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate)
Constructor for the AutoEncoder class.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs)
Train the autoencoder on a dataset.
int output_size
Size of the output layer.
std::vector< double > forward(const std::vector< double > &input)
Forward pass through the autoencoder.
double learning_rate
Learning rate for training the autoencoder.
virtual void load(const std::string &filename)
Load model weights from a file.
void display()
Print the weights of the autoencoder.
virtual void save(const std::string &filename) const
Save the model weights to a file.
std::vector< double > sigmoid(const std::vector< double > &x)
Sigmoid activation function.
int input_size
Size of the input layer.
ConcreteAutoEncoder class, a derived class from AutoEncoder.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the Concrete autoencoder on the given training data.
double temperature
Temperature parameter for the Concrete distribution.
ConcreteAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate, double temperature)
Constructor for the ConcreteAutoEncoder class.
ContractiveAutoEncoder class, a derived class from AutoEncoder.
double contractive_weight
Weight for the contractive penalty term.
ContractiveAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate, double contractive_weight)
Constructor for the ContractiveAutoEncoder class.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the contractive autoencoder on the given training data.
DenoisingAutoEncoder class, a derived class from AutoEncoder.
DenoisingAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate, double corruption_level)
Constructor for the DenoisingAutoEncoder class.
void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Adds noise to the input data and trains the denoising autoencoder.
double corruption_level
Probability of setting an input value to zero during training (dropout rate)
FullAutoEncoder class, a derived class from AutoEncoder.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the fully connected autoencoder on the given training data.
FullAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate)
Constructor for the FullAutoEncoder class.
MDLAutoEncoder Minimal Description Length class, a derived class from AutoEncoder.
double mdl_weight
Weight for the MDL penalty term.
MDLAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate, double mdl_weight)
Constructor for the MDLAutoEncoder class.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the MDL autoencoder on the given training data.
RecurrentAutoEncoder class, a derived class from AutoEncoder.
std::vector< double > recurr_fwd(const std::vector< double > &input, const std::vector< double > &previous_hidden)
Performs a forward pass through the recurrent layer.
RecurrentAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate)
Constructor for the RecurrentAutoEncoder class.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the recurrent autoencoder on the given sequential data.
std::vector< std::vector< double > > weights_recurrent
Weight matrix for the recurrent connections.
SparseAutoEncoder class, a derived class from AutoEncoder.
double sparsity_target
Target sparsity level.
double sparsity_weight
Weight for the sparsity penalty term.
void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the sparse autoencoder on the given training data.
SparseAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate, double sparsity_weight, double sparsity_target)
Constructor for the SparseAutoEncoder class.
VariationalAutoEncoder class, a derived class from AutoEncoder.
std::vector< double > encoder(const std::vector< double > &input)
Performs the forward pass for the encoder and returns hidden activations.
void gradient_descent(const std::vector< double > &input, const std::vector< double > &output, const std::vector< double > &hidden_sampled)
Performs the backward pass (gradient descent) updating weights.
std::vector< double > hidden_log_variance
keeps track of hidden log variance
double sample_dist()
Samples from a standard normal distribution.
double reparameterize(double mean, double log_variance)
Reparameterization trick for variational autoencoders.
std::vector< double > hidden_mean
keeps track of hidden means
VariationalAutoEncoder(int input_size, int hidden_size, int output_size, double learning_rate)
Constructor for the VariationalAutoEncoder class.
virtual void train(const std::vector< std::vector< double >> &training_data, int epochs) override
Trains the Variational autoencoder on the given training data.
std::vector< double > decoder(const std::vector< double > &hidden_sampled)
Performs the forward pass for the decoder and returns output activations.
The source C++ openGPMP namespace.