deep learning in action - recurrent null · why features matter 4 2017/15/09 deep learning in...
TRANSCRIPT
BASLE BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH
Deep Learning in ActionWith DL4J!
Sigrid Keydana
Deep Learning in action - with DL4J2 2017/15/09
Deep Learning in 3 W’s
What?
Deep Learning in action - with DL4J3 2017/15/09
Pre-ML programs
in: data
in: rules
out: conclusion
Machine Learning (ML)
in: data
learn: mappings/functions
out: conclusion
Deep Learning (DL)
in: data
learn: features
learn: mappings/functions
out: conclusion
Why features matter
Deep Learning in action - with DL4J4 2017/15/09
Source: Goodfellow et al., Deep Learning, 2016
Example: Features for object classification
Deep Learning in action - with DL4J5 2017/15/09
Source: Goodfellow et al., Deep Learning, 2016
hoW?
Deep Learning in action - with DL4J6 2017/15/09
Learning from errors in a deep network
Source: Wikipedia Source: Goodfellow et al., Deep Learning, 2016
Why?
Deep Learning in action - with DL4J7 2017/15/09
$$$
• Google• Microsoft• Facebook• Baidu• Apple• Nvidia• Intel• IBM • . . .
Applications in industry
• Autonomous driving• Machine translation• Image recognition• Manufacturing• Robotics• Healthcare• Music, text, image generation• Chatbots• . . .
Applications in science
• Finance• Physics• Cosmology• Pharmacology• Medicine• Meteorology• Biology• Engineering• . . .
Deep Learning in action - with DL4J8 2017/15/09
So is this just for the big guys?
No.
Deep Learning in action - with DL4J9 2017/15/09
Just need
Reasonable amount of data Adequate hardware – or run in the cloud! Deep learning software – and people who know to code and run it
Let’s zoom in on the software.
Deep Learning frameworks
Deep Learning in action - with DL4J10 2017/15/09
Python (possibly C/C+
+)
Keras
PyTorch
TheanoTensorFlow
MXNet
What if my whole environment is Java/JVM-based?
Deep Learning in action - with DL4J11 2017/15/09
And/or I need to run on a (Spark/Hadoop) cluster?
And/or I need to optimize performance?
Enter…
Deep Learning in action - with DL4J12 2017/15/09
DL4J
DL4J in a nutshell
Deep Learning in action - with DL4J13 2017/15/09
• Open-source DL framework for the JVM ecosystem (maintained by Skymind)
• Distributed – runs on Spark and Hadoop
• Fast (with adequate JVM settings)
• Lots of nicely commented example code
• Helpful developers! (Github / Gitter chat)
So if the focus is on production …
Deep Learning in action - with DL4J14 2017/15/09
… what does the developer’s experience look like?
• Developer 1 (normally uses Keras for quick experiments): “I miss playing around in the notebook… What’s actually going on in that code?”
• Developer 2 (too impatient for fiddling around with parameters): “Is that endless training time really necessary? Can’t I just use something out-of-the-box?”
• Developer 3 (could be me): “I want to apply this method from that paper and don’t have the time… perhaps it’s already implemented in …?”
But first… let’s just see some code!
Deep Learning in action - with DL4J15 2017/15/09
How does linear regression look like in DL4J?
MultiLayerNetwork net = new MultiLayerNetwork(new NeuralNetConfiguration.Builder() .iterations(numEpochs) .optimizationAlgo(OptimizationAlgorithm.CONJUGATE_GRADIENT) .updater(Updater.SGD) .list() .layer(0, new DenseLayer.Builder().nIn(numFeatures).nOut(hiddenDim) .activation(Activation.RELU) .build()) .layer(1, new OutputLayer.Builder(LossFunctions.LossFunction.MSE) .activation(Activation.IDENTITY) .nIn(hiddenDim).nOut(outputDim).build()) .build());net.init();net.fit(X, Y);
Deep Learning in action - with DL4J16 2017/15/09
Spot on … agile development
Keras model import
Deep Learning in action - with DL4J17 2017/15/09
• Can experiment in Keras and then import models
• Let’s see this in action!
MultiLayerNetwork network = KerasModelImport.importKerasSequentialModelAndWeights(modelPath);
Keras model import demo: Crack? No crack?
Deep Learning in action - with DL4J18 2017/15/09
Deep Learning in action - with DL4J19 2017/15/09
Spot on … pretrained models
Model zoo
Deep Learning in action - with DL4J20 2017/15/09
• Can use e.g. VGG16, VGG19, ResNet, GoogleNet… with weights mostly trained on ImageNet
• Examples available for different forms of usage (adaptation to own classes, fine tuning)
• Let’s try this out!
ZooModel vgg16 = new VGG16();ComputationGraph pretrainedNet = (ComputationGraph) vgg16.initPretrained(PretrainedType.IMAGENET);
VGG 16 demo: What’s this?
Deep Learning in action - with DL4J21 2017/15/09
Source: https://www.juggle.org/claude-shannon-mathematician-engineer-genius-juggler/
Source: http://krisholm.com/en/blog/Introducing-the-KH-27.5
Deep Learning in action - with DL4J22 2017/15/09
Spot on … available algorithms
Example: Anomaly detection
Deep Learning in action - with DL4J23 2017/15/09
• One state-of-the-art approach: Variational Autoencoder with reconstruction probability
• Implemented in DL4J as a specific variational layer
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder() .//… .layer(0, new VariationalAutoencoder.Builder() .activation(Activation.LEAKYRELU) .encoderLayerSizes(encoderSizes) .decoderLayerSizes(decoderSizes) .pzxActivationFunction(latentActivation) .reconstructionDistribution(new BernoulliReconstructionDistribution(Activation.SIGMOID)) .nIn(inputSize) .nOut(latentSize) .build()) .pretrain(true).backprop(false).build();
Variational autoencoder demos
Deep Learning in action - with DL4J24 2017/15/09
UNSW-NB15 intrusion detectionMNIST handwritten digits
Conclusion: DL4J
Deep Learning in action - with DL4J25 2017/15/09
• Nice, nicely documented, actively developed
• Many architectures and pretrained models available
• Instructive example code
Questions? Thank you!
2017/15/09 Deep Learning in action - with DL4J26