Skip to content

Commit

Permalink
Merge pull request #2368 from khalednasr/autoencoders
Browse files Browse the repository at this point in the history
fixed python modular warnings for neuralnets
  • Loading branch information
lisitsyn committed Jul 5, 2014
2 parents 80287f4 + 208d42a commit 70a2a37
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Add Random Forests algorithm for ensemble learning using CART [Parijat Mazumdar]
- Add Restricted Botlzmann Machines [Khaled Nasr]
- Add Stochastic Gradient Boosting algorithm for ensemble learning [Parijat Mazumdar]
- Add Deep contractive and denoising autoencoders [Khaled Nasr]
* Bugfixes:
- Fix reference counting bugs in CList when reference counting is on [Heiko Strathmann, Thoralf Klein, lambday]
- Fix memory problem in PCA::apply_to_feature_matrix [Parijat Mazumdar]
Expand Down
14 changes: 10 additions & 4 deletions src/shogun/neuralnets/Autoencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ namespace shogun
{
template <class T> class CDenseFeatures;

/** @brief Determines the noise type for denoising autoencoders */
enum EAENoiseType
{
/** No noise is applied */
AENT_NONE=0,

/** Each neuron in the input layer is randomly set to zero with some probability */
AENT_DROPOUT=1,

/** Gaussian noise is added to neurons in the input layer */
AENT_GAUSSIAN=2
};

Expand Down Expand Up @@ -125,12 +131,12 @@ class CAutoencoder : public CNeuralNetwork
* with respect to its inputs, \f$ N \f$ is the batch size, and
* \f$ \lambda \f$ is the contraction coefficient.
*
* @param lambda Contraction coefficient
* @param coeff Contraction coefficient
*/
virtual void set_contraction_coefficient(float64_t lambda)
virtual void set_contraction_coefficient(float64_t coeff)
{
m_contraction_coefficient = lambda;
get_layer(1)->contraction_coefficient = lambda;
m_contraction_coefficient = coeff;
get_layer(1)->contraction_coefficient = coeff;
}

virtual ~CAutoencoder() {}
Expand Down
12 changes: 9 additions & 3 deletions src/shogun/neuralnets/ConvolutionalFeatureMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@
namespace shogun
{

/** @brief Determines the activation function for neurons in a convolutional
* feature map
*/
enum EConvMapActivationFunction
{
/** Identity activation function: \f$ f(x) = x \f$ */
CMAF_IDENTITY = 0,

/** Logistic activation function: \f$ f(x) = \frac{1}{1+exp(-x)} \f$ */
CMAF_LOGISTIC = 1,

/** Rectified linear activation function: \f$ f(x) = max(x,0) \f$ */
CMAF_RECTIFIED_LINEAR = 2
};

Expand Down Expand Up @@ -121,9 +129,7 @@ class CConvolutionalFeatureMap
* @param input_indices Indices of the layers that are connected to the map
* as input
*
* @param activations Matrix to store the activations in
*
* @param parameters Vector in which the parameters gradients are to be
* @param parameter_gradients Vector in which the parameters gradients are to be
* stored
*/
void compute_gradients(SGVector<float64_t> parameters,
Expand Down
2 changes: 0 additions & 2 deletions src/shogun/neuralnets/DeepAutoencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ class CDeepAutoencoder : public CAutoencoder
* SGVector::set_const() method.
*
* @param data Training examples
* @param sigma Standard deviation of the gaussian used to initialize the
* parameters of each autoencoder
*/
virtual void pre_train(CFeatures* data);

Expand Down
4 changes: 4 additions & 0 deletions src/shogun/neuralnets/NeuralNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class CNeuralNetwork : public CMachine
/** returns the number of neurons in the output layer */
int32_t get_num_outputs();

/** Returns an array holding the network's layers */
CDynamicObjectArray* get_layers();

virtual const char* get_name() const { return "NeuralNetwork";}
Expand Down Expand Up @@ -446,6 +447,9 @@ class CNeuralNetwork : public CMachine
/** network's layers */
CDynamicObjectArray* m_layers;

/** Describes the connections in the network: if there's a connection from
* layer i to layer j then m_adj_matrix(i,j) = 1.
*/
SGMatrix<bool> m_adj_matrix;

/** total number of parameters in the network */
Expand Down

0 comments on commit 70a2a37

Please sign in to comment.