Skip to content

Commit

Permalink
Adding chart for hidden activations (#1)
Browse files Browse the repository at this point in the history
According to the original dropout paper, the use of dropout should
induce a sparse-er distribution of activations.
  • Loading branch information
eric-tramel committed Sep 15, 2015
1 parent 8e58e4a commit fb4efc3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/testdropout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,21 @@ function run_mnist()
m, historical_pl = fit(m, X; persistent=true, lr=0.1, n_iter=Epochs, batch_size=100, n_gibbs=1, dorate=0.0)

# Put results in dataframe
NoDropoutActivations = Boltzmann.transform(m,X)
DropoutActivations = Boltzmann.transform(m_do,X)

Results = DataFrame(Epochs=[1:Epochs;1:Epochs],PL=[vec(historical_pl_do);vec(historical_pl)],UsingDropout=[trues(Epochs);falses(Epochs)])


# Plot Pseudo-liklihood
PLPlot = plot(Results,x="Epochs",y="PL",color="UsingDropout",Geom.line,Guide.ylabel("Pseudo-Liklihood"),Guide.xlabel("Training Epoch"))
draw(PDF("Dropout_TrainingPL.pdf", 4inch, 3inch), PLPlot)
draw(PDF("Dropout_TrainingPL.pdf", 12inch, 9inch), PLPlot)



# Plot Activations
Activations = DataFrame(Act=[vec(NoDropoutActivations);vec(DropoutActivations)],UsingDropout=[falses(vec(NoDropoutActivations));trues(vec(DropoutActivations))])
HAPlot = plot(Activations,x="Act",color="UsingDropout",Geom.histogram(bincount=100))
draw(PDF("HiddenActivations.pdf", 12inch, 9inch), HAPlot)

return m
end
Expand Down

0 comments on commit fb4efc3

Please sign in to comment.