Below is a distilled collection of conversations, messages, and debates I’ve had with peers and students on how to optimize deep models. If you have tricks you’ve found impactful, please share them!!Deep learning models like the Convolutional Neural Network (CNN) have a massive number of parameters; we can actually call these hyper-parameters because they are not optimized inherently in the model. You could gridsearch the optimal values for these hyper-parameters, but you’ll need a lot of hardware and time. So, does a true data scientist settle for guessing these essential parameters?One of the best ways to improve your models is to build on the design and architecture of the experts who have done deep research in your domain, often with powerful hardware at their disposal. Graciously, they often open-source the resulting modeling architectures and rationale.Here are a few ways you can improve your fit time and accuracy with pre-trained models:Here’s how to modify dropout and limit weight sizes in Keras with MNIST:Here’s an example of final layer modification in Keras with 14 classes for MNIST:And an example of how to freeze weights in the first five layers:Alternatively, we can set the learning rate to zero for that layer, or use per-parameter adaptive learning algorithm like Adadelta or Adam. This is somewhat complicated and better implemented in other platforms, like Caffe.It’s often essential to get a visual idea of how your model looks. If you’re working in Keras, abstraction is nice but doesn’t allow you to drill down into sections of your model for deeper analysis. Fortunately, the code below lets us visualize our models directly with Python:This will plot a graph of the model and save it as a png file:plot takes two optional arguments:You can also directly obtain the pydot.Graph object and render it yourself, for example to show it in an ipython notebook :I hope this collection helps with your modeling endeavors! Let me know your best tricks, and connect with me on Twitter and LinkedIn!From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.Data Science NomadSharing concepts, ideas, and codes.