Skip to content

Instantly share code, notes, and snippets.

@ivmarkp
Last active March 27, 2017 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivmarkp/86692759637286107d0e5703eb32abf0 to your computer and use it in GitHub Desktop.
Save ivmarkp/86692759637286107d0e5703eb32abf0 to your computer and use it in GitHub Desktop.
Abstract class for Autoencoders
namespace mlpack {
namespace nn {
class Autoencoder {
public:
Autoencoder(const arma::mat& data,
const size_t inputSize,
const size_t hiddenSize,
NoiseLayerType&& noiseLayer = NoisetLayerType());
// Set the size of the input layer.
void InputSize(const size_t visible) { this->inputSize = input; }
// Get the size of the input layer.
size_t InputSize() const { return inputSize; }
// Sets size of the hidden layer.
void HiddenSize(const size_t hidden) { this->hiddenSize = hidden; }
// Gets the size of the hidden layer.
size_t HiddenSize() const { return hiddenSize; }
// Encode function to learn a representation of data in hidden layer.
// similar to GetNewFeatures(...) in sparse_encoder.hpp
void EncodeData(const arma::mat& data,
cont arma::mat& encodedRepresentation)
{
// Do stuff.
}
// Decode the learned representation.
void DecodeData(const arma::mat& data,
const arma::mat& decodedRepresentation)
{
// Do stuff.
}
private:
const arma::mat& data;
size_t visibleSize;
size_t hiddenSize;
NoiseLayerType = noiseLayer;
};
} // nn
} // mlpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment