RStudio AI Blog
https://blogs.rstudio.com/tensorflow/
News, concepts, and applications as regards deep learning, probabilistic computation, distributed computing and machine learning automation from R.
RStudio AI Bloghttps://blogs.rstudio.com/tensorflow/images/favicon.png
https://blogs.rstudio.com/tensorflow/
DistillThu, 30 Jul 2020 00:00:00 +0000FNN-VAE for noisy time series forecastingSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-07-31-fnn-vae-for-noisy-timeseries
<div class="container-fluid main-container">
<div class="fluid-row" id="header">
</div>
<p>") training_loop_vae(ds_train)</p>
<p>test_batch <- as_iterator(ds_test) %>% iter_next() encoded <- encoder(test_batch[[1]][1:1000]) test_var <- tf<span class="math inline">\(math\)</span>reduce_variance(encoded, axis = 0L) print(test_var %>% as.numeric() %>% round(5)) } ```</p>
<div id="experimental-setup-and-data" class="section level2">
<h2>Experimental setup and data</h2>
<p>The idea was to add white noise to a deterministic series. This time, the <a href="https://en.wikipedia.org/wiki/R%C3%B6ssler_attractor">Roessler system</a> was chosen, mainly for the prettiness of its attractor, apparent even in its two-dimensional projections:</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/roessler.png" alt="Roessler attractor, two-dimensional projections." width="600" />
<p class="caption">
(#fig:unnamed-chunk-1)Roessler attractor, two-dimensional projections.
</p>
</div>
<p>Like we did for the Lorenz system in the first part of this series, we use <code>deSolve</code> to generate data from the Roessler equations.</p>
<p>Then, noise is added, to the desired degree, by drawing from a normal distribution, centered at zero, with standard deviations varying between 1 and 2.5.</p>
<p>Here you can compare effects of not adding any noise (left), standard deviation-1 (middle), and standard deviation-2.5 Gaussian noise:</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/roessler_noise.png" alt="Roessler series with added noise. Top: none. Middle: SD = 1. Bottom: SD = 2.5." width="600" />
<p class="caption">
(#fig:unnamed-chunk-4)Roessler series with added noise. Top: none. Middle: SD = 1. Bottom: SD = 2.5.
</p>
</div>
<p>Otherwise, preprocessing proceeds as in the previous posts. In the upcoming results section, we’ll compare forecasts not just to the “real”, after noise addition, test split of the data, but also to the underlying Roessler system – that is, the thing we’re really interested in. (Just that in the real world, we can’t do that check.) This second test set is prepared for forecasting just like the other one; to avoid duplication we don’t reproduce the code.</p>
</div>
<div id="results" class="section level2">
<h2>Results</h2>
<p>The LSTM used for comparison with the VAE described above is identical to the architecture employed in the previous post. While with the VAE, an <code>fnn_multiplier</code> of 1 yielded sufficient regularization for all noise levels, some more experimentation was needed for the LSTM: At noise levels 2 and 2.5, that multiplier was set to 5.</p>
<p>As a result, in all cases, there was one latent variable with high variance and a second one of minor importance. For all others, variance was close to 0.</p>
<p><em>In all cases</em> here means: In all cases where FNN regularization was used. As already hinted at in the introduction, the main regularizing factor providing robustness to noise here seems to be FNN loss, not KL divergence. So for all noise levels, besides FNN-regularized LSTM and VAE models we also tested their non-constrained counterparts.</p>
<div id="low-noise" class="section level4">
<h4>Low noise</h4>
<p>Seeing how all models did superbly on the original deterministic series, a noise level of 1 can almost be treated as a baseline. Here you see sixteen 120-timestep predictions from both regularized models, FNN-VAE (dark blue), and FNN-LSTM (orange). The noisy test data, both input (<code>x</code>, 120 steps) and output (<code>y</code>, 120 steps) are displayed in (blue-ish) grey. In green, also spanning the whole sequence, we have the original Roessler data, the way they would look had no noise been added.</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/noise_1.png" alt="Roessler series with added Gaussian noise of standard deviation 1. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from FNN-LSTM. Dark blue: Predictions from FNN-VAE." width="600" />
<p class="caption">
(#fig:unnamed-chunk-6)Roessler series with added Gaussian noise of standard deviation 1. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from FNN-LSTM. Dark blue: Predictions from FNN-VAE.
</p>
</div>
<p>Despite the noise, forecasts from both models look excellent. Is this due to the FNN regularizer?</p>
<p>Looking at forecasts from their unregularized counterparts, we have to admit these do not look any worse. (For better comparability, the sixteen sequences to forecast were initiallly picked at random, but used to test all models and conditions.)</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/noise_1_nofnn.png" alt="Roessler series with added Gaussian noise of standard deviation 1. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from unregularized LSTM. Dark blue: Predictions from unregularized VAE." width="600" />
<p class="caption">
(#fig:unnamed-chunk-7)Roessler series with added Gaussian noise of standard deviation 1. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from unregularized LSTM. Dark blue: Predictions from unregularized VAE.
</p>
</div>
<p>What happens when we start to add noise?</p>
</div>
<div id="substantial-noise" class="section level4">
<h4>Substantial noise</h4>
<p>Between noise levels 1.5 and 2, something changed, or became noticeable from visual inspection. Let’s jump directly to the highest-used level though: 2.5.</p>
<p>Here first are predictions obtained from the unregularized models.</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/noise_2.5_nofnn.png" alt="Roessler series with added Gaussian noise of standard deviation 2.5. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from unregularized LSTM. Dark blue: Predictions from unregularized VAE." width="600" />
<p class="caption">
(#fig:unnamed-chunk-8)Roessler series with added Gaussian noise of standard deviation 2.5. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from unregularized LSTM. Dark blue: Predictions from unregularized VAE.
</p>
</div>
<p>Both LSTM and VAE get “distracted” a bit too much by the noise, the latter to an even higher degree. This leads to cases where predictions strongly “overshoot” the underlying non-noisy rhythm. This is not surprising, of course: They were <em>trained</em> on the noisy version; predict fluctuations is what they learned.</p>
<p>Do we see the same with the FNN models?</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/noise_2.5.png" alt="Roessler series with added Gaussian noise of standard deviation 2.5. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from FNN-LSTM. Dark blue: Predictions from FNN-VAE." width="600" />
<p class="caption">
(#fig:unnamed-chunk-9)Roessler series with added Gaussian noise of standard deviation 2.5. Grey: actual (noisy) test data. Green: underlying Roessler system. Orange: Predictions from FNN-LSTM. Dark blue: Predictions from FNN-VAE.
</p>
</div>
<p>Interestingly, we see a much better fit to the underlying Roessler system now! Especially the VAE model, FNN-VAE, surprises with a whole new smoothness of predictions; but FNN-LSTM turns up much smoother forecasts as well.</p>
<p>“Smooth, fitting the system…” – by now you may be wondering, when are we going to come up with more quantitative assertions? If quantitative implies “mean squared error” (MSE), and if MSE is taken to be some divergence between forecasts and the true target from the test set, the answer is that this MSE doesn’t differ much between any of the four architectures. Put differently, it is mostly a function of noise level.</p>
<p>However, we could argue that what we’re really interested in is how well a model forecasts the underlying process. And there, we see differences.</p>
<p>In the following plot, we contrast MSEs obtained for the four model types (grey: VAE; orange: LSTM; dark blue: FNN-VAE; green: FNN-LSTM). The rows reflect noise levels (1, 1.5, 2, 2.5); the columns represent MSE in relation to the noisy(“real”) target (left) on the one hand, and in relation to the underlying system on the other (right). For better visibility of the effect, <em>MSEs have been normalized as fractions of the maximum MSE in a category</em>.</p>
<p>So, if we want to predict <em>signal plus noise</em> (left), it is not extremely critical whether we use FNN or not. But if we want to predict the signal only (right), with increasing noise in the data FNN loss becomes increasingly effective. This effect is far stronger for VAE vs. FNN-VAE than for LSTM vs. FNN-LSTM: The distance between the grey line (VAE) and the dark blue one (FNN-VAE) becomes larger and larger as we add more noise.</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-07-31-fnn-vae-for-noisy-timeseries/images/mses.png" alt="Normalized MSEs obtained for the four model types (grey: VAE; orange: LSTM; dark blue: FNN-VAE; green: FNN-LSTM). Rows are noise levels (1, 1.5, 2, 2.5); columns are MSE as related to the real target (left) and the underlying system (right)." width="600" />
<p class="caption">
(#fig:unnamed-chunk-10)Normalized MSEs obtained for the four model types (grey: VAE; orange: LSTM; dark blue: FNN-VAE; green: FNN-LSTM). Rows are noise levels (1, 1.5, 2, 2.5); columns are MSE as related to the real target (left) and the underlying system (right).
</p>
</div>
</div>
</div>
<div id="summing-up" class="section level2">
<h2>Summing up</h2>
<p>Our experiments show that when noise is likely to obscure measurements from an underlying deterministic system, FNN regularization can strongly improve forecasts. This is the case especially for convolutional VAEs, and probably convolutional autoencoders in general. And if an FNN-constrained VAE performs as well, for time series prediction, as an LSTM, there is a strong incentive to use the convolutional model: It trains significantly faster.</p>
<p>With that, we conclude our mini-series on FNN-regularized models. As always, we’d love to hear from you if you were able to make use of this in your own work!</p>
<p>Thanks for reading!</p>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open')
});
});
</script>
<!-- code folding -->
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
931e811b30064bd6be23eefda987ed92RTensorFlow/KerasTime SeriesUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2020-07-31-fnn-vae-for-noisy-timeseriesThu, 30 Jul 2020 00:00:00 +0000State-of-the-art NLP models from RTurgut Abdullayev
https://blogs.rstudio.com/tensorflow/posts/2020-07-30-state-of-the-art-nlp-models-from-r
Nowadays, Microsoft, Google, Facebook, and OpenAI are sharing lots of state-of-the-art models in the field of Natural Language Processing. However, fewer materials exist how to use these models from R. In this post, we will show how R users can access and benefit from these models as well.Natural Language Processinghttps://blogs.rstudio.com/tensorflow/posts/2020-07-30-state-of-the-art-nlp-models-from-rThu, 30 Jul 2020 00:00:00 +0000Parallelized sampling using exponential variatesYitao Li
https://blogs.rstudio.com/tensorflow/posts/2020-07-29-parallelized-sampling
How can the seemingly iterative process of weighted sampling without replacement be transformed into something highly parallelizable? Turns out a well-known technique based on exponential variates accomplishes exactly that.ConceptsDistributed Computinghttps://blogs.rstudio.com/tensorflow/posts/2020-07-29-parallelized-samplingWed, 29 Jul 2020 00:00:00 +0000Time series prediction with FNN-LSTMSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-07-20-fnn-lstm
In a recent post, we showed how an LSTM autoencoder, regularized by false nearest neighbors (FNN) loss, can be used to reconstruct the attractor of a nonlinear, chaotic dynamical system. Here, we explore how that same technique assists in prediction. Matched up with a comparable, capacity-wise, "vanilla LSTM", FNN-LSTM improves performance on a set of very different, real-world datasets, especially for the initial steps in a multi-step forecast.RTensorFlow/KerasTime SeriesUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2020-07-20-fnn-lstmMon, 20 Jul 2020 00:00:00 +0000sparklyr 1.3: Higher-order Functions, Avro and Custom SerializersYitao Li
https://blogs.rstudio.com/tensorflow/posts/2020-07-16-sparklyr-1.3.0-released
Sparklyr 1.3 is now available, featuring exciting new functionalities such as integration of Spark higher-order functions and data import/export in Avro and in user-defined serialization formats.Packages/ReleasesDistributed Computinghttps://blogs.rstudio.com/tensorflow/posts/2020-07-16-sparklyr-1.3.0-releasedThu, 16 Jul 2020 00:00:00 +0000Deep attractors: Where deep learning meets chaosSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-06-24-deep-attractors
<div class="container-fluid main-container">
<div class="fluid-row" id="header">
</div>
<p>") training_loop(ds_train)<br />
}</p>
<p>```</p>
<p>After two hundred epochs, overall loss is at 2.67, with the MSE component at 1.8 and FNN at 0.09.</p>
<div id="obtaining-the-attractor-from-the-test-set" class="section level3">
<h3>Obtaining the attractor from the test set</h3>
<p>We use the test set to inspect the latent code:</p>
<pre><code># A tibble: 6,242 x 10
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 0.439 0.401 -0.000614 -0.0258 -0.00176 -0.0000276 0.000276 0.00677 -0.0239 0.00906
2 0.415 0.504 0.0000481 -0.0279 -0.00435 -0.0000970 0.000921 0.00509 -0.0214 0.00921
3 0.389 0.619 0.000848 -0.0240 -0.00661 -0.000171 0.00106 0.00454 -0.0150 0.00794
4 0.363 0.729 0.00137 -0.0143 -0.00652 -0.000244 0.000523 0.00450 -0.00594 0.00476
5 0.335 0.809 0.00128 -0.000450 -0.00338 -0.000307 -0.000561 0.00407 0.00394 -0.000127
6 0.304 0.828 0.000631 0.0126 0.000889 -0.000351 -0.00167 0.00250 0.0115 -0.00487
7 0.274 0.769 -0.000202 0.0195 0.00403 -0.000367 -0.00220 -0.000308 0.0145 -0.00726
8 0.246 0.657 -0.000865 0.0196 0.00558 -0.000359 -0.00208 -0.00376 0.0134 -0.00709
9 0.224 0.535 -0.00121 0.0162 0.00608 -0.000335 -0.00169 -0.00697 0.0106 -0.00576
10 0.211 0.434 -0.00129 0.0129 0.00606 -0.000306 -0.00134 -0.00927 0.00820 -0.00447
# … with 6,232 more rows</code></pre>
<p>As a result of the FNN regularizer, the latent code units should be ordered roughly by decreasing variance, with a sharp drop appearing some place (if the FNN weight has been chosen adequately).</p>
<p>For an <code>fnn_weight</code> of 10, we do see a drop after the first two units:</p>
<pre><code># A tibble: 1 x 10
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 0.0739 0.0582 1.12e-6 3.13e-4 1.43e-5 1.52e-8 1.35e-6 1.86e-4 1.67e-4 4.39e-5</code></pre>
<p>So the model indicates that the Lorenz attractor can be represented in two dimensions. If we nonetheless want to plot the complete (reconstructed) state space of three dimensions, we should reorder the remaining variables by magnitude of variance<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>. Here, this results in three projections of the set <code>V1</code>, <code>V2</code> and <code>V4</code>:</p>
<div class="figure">
<img src="https://blogs.rstudio.com/tensorflow//posts/2020-06-24-deep-attractors/images/predicted_attractors.png" alt="Attractors as predicted from the latent code (test set). The three highest-variance variables were chosen." width="500" />
<p class="caption">
(#fig:unnamed-chunk-3)Attractors as predicted from the latent code (test set). The three highest-variance variables were chosen.
</p>
</div>
</div>
<div id="wrapping-up-for-this-time" class="section level2">
<h2>Wrapping up (for this time)</h2>
<p>At this point, we’ve seen how to reconstruct the Lorenz attractor from data we did not train on (the test set), using an autoencoder regularized by a custom <em>false nearest neighbors</em> loss. It is important to stress that at no point was the network presented with the expected solution (attractor) – training was purely unsupervised.</p>
<p>This is a fascinating result. Of course, thinking practically, the next step is to obtain predictions on heldout data. Given how long this text has become already, we reserve that for a follow-up post. And again <em>of course</em>, we’re thinking about other datasets, especially ones where the true state space is not known beforehand. What about measurement noise? What about datasets that are not completely deterministic<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a>? There is a lot to explore, stay tuned – and as always, thanks for reading!</p>
</div>
<div class="footnotes">
<hr />
<ol>
<li id="fn1"><p>As per author recommendation (personal communication).<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
<li id="fn2"><p>See <span class="citation">[@Kantz]</span> for detailed discussions on using methodology from nonlinear deterministic systems analysis for noisy and/or partly-stochastic data.<a href="#fnref2" class="footnote-back">↩︎</a></p></li>
</ol>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.header').parent('thead').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open')
});
});
</script>
<!-- code folding -->
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
5503b1da2d7660fbcd2bc810fb123a30RTensorFlow/KerasTime SeriesUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2020-06-24-deep-attractorsWed, 24 Jun 2020 00:00:00 +0000Easy PixelCNN with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-05-29-pixelcnn
PixelCNN is a deep learning architecture - or bundle of architectures - designed to generate highly realistic-looking images. To use it, no reverse-engineering of arXiv papers or search for reference implementations is required: TensorFlow Probability and its R wrapper, tfprobability, now include a PixelCNN distribution that can be used to train a straightforwardly-defined neural network in a parameterizable way.RImage Recognition & Image ProcessingTensorFlow/KerasProbabilistic ML/DLUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2020-05-29-pixelcnnFri, 29 May 2020 00:00:00 +0000Hacking deep learning: model inversion attack by exampleSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-05-15-model-inversion-attacks
Compared to other applications, deep learning models might not seem too likely as victims of privacy attacks. However, methods exist to determine whether an entity was used in the training set (an adversarial attack called member inference), and techniques subsumed under "model inversion" allow to reconstruct raw data input given just model output (and sometimes, context information). This post shows an end-to-end example of model inversion, and explores mitigation strategies using TensorFlow Privacy.RPrivacy & SecurityTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2020-05-15-model-inversion-attacksFri, 15 May 2020 00:00:00 +0000Towards privacy: Encrypted deep learning with Syft and KerasSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-04-29-encrypted_keras_with_syft
Deep learning need not be irreconcilable with privacy protection. Federated learning enables on-device, distributed model training; encryption keeps model and gradient updates private; differential privacy prevents the training data from leaking. As of today, private and secure deep learning is an emerging technology. In this post, we introduce Syft, an open-source framework that integrates with PyTorch as well as TensorFlow. In an example use case, we obtain private predictions from a Keras model.RPrivacy & SecurityTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2020-04-29-encrypted_keras_with_syftWed, 29 Apr 2020 00:00:00 +0000sparklyr 1.2: Foreach, Spark 3.0 and Databricks ConnectYitao Li
https://blogs.rstudio.com/tensorflow/posts/2020-04-21-sparklyr-1.2.0-released
A new sparklyr release is now available. This sparklyr 1.2 release features new functionalities such as support for Databricks Connect, a Spark backend for the 'foreach' package, inter-op improvements for working with Spark 3.0 preview, as well as a number of bug fixes and improvements addressing user-visible pain points.RPackages/ReleasesDistributed Computinghttps://blogs.rstudio.com/tensorflow/posts/2020-04-21-sparklyr-1.2.0-releasedTue, 21 Apr 2020 00:00:00 +0000pins 0.4: VersioningJavier Luraschi
https://blogs.rstudio.com/tensorflow/posts/2020-04-13-pins-04
A new release of pins is available on CRAN today. This release adds support to time travel across dataset versions, which improves collaboration and protects your code from breaking when remote resources change unexpectedly.RPackages/ReleasesData Managementhttps://blogs.rstudio.com/tensorflow/posts/2020-04-13-pins-04Mon, 13 Apr 2020 00:00:00 +0000A first look at federated learning with TensorFlowSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-04-08-tf-federated-intro
The term "federated learning" was coined to describe a form of distributed model training where the data remains on client devices, i.e., is never shipped to the coordinating server. In this post, we introduce central concepts and run first experiments with TensorFlow Federated, using R.Privacy & SecurityTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2020-04-08-tf-federated-introWed, 08 Apr 2020 00:00:00 +0000Introducing: The RStudio AI BlogThe Multiverse Team
https://blogs.rstudio.com/tensorflow/posts/2020-04-01-rstudio-ai-blog
This blog just got a new title: RStudio AI Blog. We explain why.Metahttps://blogs.rstudio.com/tensorflow/posts/2020-04-01-rstudio-ai-blogMon, 30 Mar 2020 00:00:00 +0000Infinite surprise - the iridescent personality of Kullback-Leibler divergenceSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-02-19-kl-divergence
Kullback-Leibler divergence is not just used to train variational autoencoders or Bayesian networks (and not just a hard-to-pronounce thing). It is a fundamental concept in information theory, put to use in a vast range of applications. Most interestingly, it's not always about constraint, regularization or compression. Quite on the contrary, sometimes it is about novelty, discovery and surprise.Probabilistic ML/DLConceptshttps://blogs.rstudio.com/tensorflow/posts/2020-02-19-kl-divergenceWed, 19 Feb 2020 00:00:00 +0000NumPy-style broadcasting for R TensorFlow usersSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-01-24-numpy-broadcasting
Broadcasting, as done by Python's scientific computing library NumPy, involves dynamically extending shapes so that arrays of different sizes may be passed to operations that expect conformity - such as adding or multiplying elementwise. In NumPy, the way broadcasting works is specified exactly; the same rules apply to TensorFlow operations. For anyone who finds herself, occasionally, consulting Python code, this post strives to explain.TensorFlow/KerasConceptshttps://blogs.rstudio.com/tensorflow/posts/2020-01-24-numpy-broadcastingFri, 24 Jan 2020 00:00:00 +0000First experiments with TensorFlow mixed-precision trainingSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2020-01-13-mixed-precision-training
TensorFlow 2.1, released last week, allows for mixed-precision training, making use of the Tensor Cores available in the most recent NVidia GPUs. In this post, we report first experimental results and provide some background on what this is all about.TensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2020-01-13-mixed-precision-trainingMon, 13 Jan 2020 00:00:00 +0000Differential Privacy with TensorFlowSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-12-20-differential-privacy
Differential Privacy guarantees that results of a database query are basically independent of the presence in the data of a single individual. Applied to machine learning, we expect that no single training example influences the parameters of the trained model in a substantial way. This post introduces TensorFlow Privacy, a library built on top of TensorFlow, that can be used to train differentially private deep learning models from R.Privacy & SecurityTensorFlow/KerasTime Serieshttps://blogs.rstudio.com/tensorflow/posts/2019-12-20-differential-privacyFri, 20 Dec 2019 00:00:00 +0000tfhub: R interface to TensorFlow HubDaniel Falbel
https://blogs.rstudio.com/tensorflow/posts/2019-12-18-tfhub-0.7.0
TensorFlow Hub is a library for the publication, discovery, and consumption of reusable parts of machine learning models. A module is a self-contained piece of a TensorFlow graph, along with its weights and assets, that can be reused across different tasks in a process known as transfer learning.TensorFlow/KerasPackages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2019-12-18-tfhub-0.7.0Wed, 18 Dec 2019 00:00:00 +0000Gaussian Process Regression with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-12-10-variational-gaussian-process
Continuing our tour of applications of TensorFlow Probability (TFP), after Bayesian Neural Networks, Hamiltonian Monte Carlo and State Space Models, here we show an example of Gaussian Process Regression. In fact, what we see is a rather "normal" Keras network, defined and trained in pretty much the usual way, with TFP's Variational Gaussian Process layer pulling off all the magic.Probabilistic ML/DLTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-12-10-variational-gaussian-processTue, 10 Dec 2019 00:00:00 +0000Getting started with Keras from R - the 2020 editionSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-11-27-gettingstarted-2020
Looking for materials to get started with deep learning from R? This post presents useful tutorials, guides, and background documentation on the new TensorFlow for R website. Advanced users will find pointers to applications of new release 2.0 (or upcoming 2.1!) features alluded to in the recent TensorFlow 2.0 post.Packages/ReleasesTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-11-27-gettingstarted-2020Wed, 27 Nov 2019 00:00:00 +0000Variational convnets with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-11-13-variational-convnet
In a Bayesian neural network, layer weights are distributions, not tensors. Using tfprobability, the R wrapper to TensorFlow Probability, we can build regular Keras models that have probabilistic layers, and thus get uncertainty estimates "for free". In this post, we show how to define, train and obtain predictions from a probabilistic convolutional neural network.Probabilistic ML/DLTime SeriesTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-11-13-variational-convnetWed, 13 Nov 2019 00:00:00 +0000tfprobability 0.8 on CRAN: Now how can you use it?Sigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-11-07-tfp-cran
Part of the r-tensorflow ecosystem, tfprobability is an R wrapper to TensorFlow Probability, the Python probabilistic programming framework developed by Google. We take the occasion of tfprobability's acceptance on CRAN to give a high-level introduction, highlighting interesting use cases and applications.Probabilistic ML/DLPackages/ReleasesTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-11-07-tfp-cranThu, 07 Nov 2019 00:00:00 +0000Innocent unicorns considered harmful? How to experiment with GPT-2 from RSigrid KeydanaJavier Luraschi
https://blogs.rstudio.com/tensorflow/posts/2019-10-23-gpt-2
Is society ready to deal with challenges brought about by artificially-generated information - fake images, fake videos, fake text? While this post won't answer that question, it should help form an opinion on the threat exerted by fake text as of this writing, autumn 2019. We introduce gpt2, an R package that wraps OpenAI's public implementation of GPT-2, the language model that early this year surprised the NLP community with the unprecedented quality of its creations.Natural Language ProcessingPackages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2019-10-23-gpt-2Wed, 23 Oct 2019 00:00:00 +0000TensorFlow 2.0 is here - what changes for R users?Sigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-10-08-tf2-whatchanges
TensorFlow 2.0 was finally released last week. As R users we have two kinds of questions. First, will my keras code still run? And second, what is it that changes? In this post, we answer both and, then, give a tour of exciting new developments in the r-tensorflow ecosystem.TensorFlow/KerasPackages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2019-10-08-tf2-whatchangesTue, 08 Oct 2019 00:00:00 +0000On leapfrogs, crashing satellites, and going nuts: A very first conceptual introduction to Hamiltonian Monte CarloSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-10-03-intro-to-hmc
TensorFlow Probability, and its R wrapper tfprobability, provide Markov Chain Monte Carlo (MCMC) methods that were used in a number of recent posts on this blog. These posts were directed to users already comfortable with the method, and terminology, per se, which readers mainly interested in deep learning won't necessarily be. Here we try to make up leeway, introducing Hamitonian Monte Carlo (HMC) as well as a few often-heard "buzzwords" accompanying it, always striving to keep in mind what it is all "for".Bayesian ModelingConceptshttps://blogs.rstudio.com/tensorflow/posts/2019-10-03-intro-to-hmcThu, 03 Oct 2019 00:00:00 +0000BERT from RTurgut Abdullayev
https://blogs.rstudio.com/tensorflow/posts/2019-09-30-bert-r
A deep learning model - BERT from Google AI Research - has yielded state-of-the-art results in a wide variety of Natural Language Processing (NLP) tasks. In this tutorial, we will show how to load and train the BERT model from R, using Keras.Natural Language ProcessingTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-09-30-bert-rMon, 30 Sep 2019 00:00:00 +0000So, how come we can use TensorFlow from R?Sigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-08-29-using-tf-from-r
Have you ever wondered why you can call TensorFlow - mostly known as a Python framework - from R? If not - that's how it should be, as the R packages keras and tensorflow aim to make this process as transparent as possible to the user. But for them to be those helpful genies, someone else first has to tame the Python.TensorFlow/KerasMetaConceptshttps://blogs.rstudio.com/tensorflow/posts/2019-08-29-using-tf-from-rThu, 29 Aug 2019 00:00:00 +0000Image segmentation with U-NetDaniel FalbelSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-08-23-unet
In image segmentation, every pixel of an image is assigned a class. Depending on the application, classes could be different cell types; or the task could be binary, as in "cancer cell yes or no?". Area of application notwithstanding, the established neural network architecture of choice is U-Net. In this post, we show how to preprocess data and train a U-Net model on the Kaggle Carvana image segmentation data.Image Recognition & Image ProcessingTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-08-23-unetFri, 23 Aug 2019 00:00:00 +0000Modeling censored data with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-07-31-censored-data
In this post we use tfprobability, the R interface to TensorFlow Probability, to model censored data. Again, the exposition is inspired by the treatment of this topic in Richard McElreath's Statistical Rethinking. Instead of cute cats though, we model immaterial entities from the cold world of technology: This post explores durations of CRAN package checks, a dataset that comes with Max Kuhn's parsnip.Bayesian ModelingTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-07-31-censored-dataWed, 31 Jul 2019 00:00:00 +0000TensorFlow feature columns: Transforming your data recipes-styleDaniel FalbelSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-07-09-feature-columns
TensorFlow feature columns provide useful functionality for preprocessing categorical data and chaining transformations, like bucketization or feature crossing. From R, we use them in popular "recipes" style, creating and subsequently refining a feature specification. In this post, we show how using feature specs frees cognitive resources and lets you focus on what you really want to accomplish. What's more, because of its elegance, feature-spec code reads nice and is fun to write as well.TensorFlow/KerasTabular Datahttps://blogs.rstudio.com/tensorflow/posts/2019-07-09-feature-columnsTue, 09 Jul 2019 00:00:00 +0000Dynamic linear models with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-06-25-dynamic_linear_models_tfprobability
Previous posts featuring tfprobability - the R interface to TensorFlow Probability - have focused on enhancements to deep neural networks (e.g., introducing Bayesian uncertainty estimates) and fitting hierarchical models with Hamiltonian Monte Carlo. This time, we show how to fit time series using dynamic linear models (DLMs), yielding posterior predictive forecasts as well as the smoothed and filtered estimates from the Kálmán filter.Probabilistic ML/DLTime Serieshttps://blogs.rstudio.com/tensorflow/posts/2019-06-25-dynamic_linear_models_tfprobabilityMon, 24 Jun 2019 00:00:00 +0000Adding uncertainty estimates to Keras models with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-06-05-uncertainty-estimates-tfprobability
As of today, there is no mainstream road to obtaining uncertainty estimates from neural networks. All that can be said is that, normally, approaches tend to be Bayesian in spirit, involving some way of putting a prior over model weights. This holds true as well for the method presented in this post: We show how to use tfprobability, the R interface to TensorFlow Probability, to add uncertainty estimates to a Keras model in an elegant and conceptually plausible way.Probabilistic ML/DLTensorFlow/KerasConceptshttps://blogs.rstudio.com/tensorflow/posts/2019-06-05-uncertainty-estimates-tfprobabilityWed, 05 Jun 2019 00:00:00 +0000Hierarchical partial pooling, continued: Varying slopes models with TensorFlow ProbabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-05-24-varying-slopes
This post builds on our recent introduction to multi-level modeling with tfprobability, the R wrapper to TensorFlow Probability. We show how to pool not just mean values ("intercepts"), but also relationships ("slopes"), thus enabling models to learn from data in an even broader way. Again, we use an example from Richard McElreath's "Statistical Rethinking"; the terminology as well as the way we present this topic are largely owed to this book.Bayesian ModelingTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-05-24-varying-slopesFri, 24 May 2019 00:00:00 +0000Tadpoles on TensorFlow: Hierarchical partial pooling with tfprobabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-05-06-tadpoles-on-tensorflow
This post is a first introduction to MCMC modeling with tfprobability, the R interface to TensorFlow Probability (TFP). Our example is a multi-level model describing tadpole mortality, which may be known to the reader from Richard McElreath's wonderful "Statistical Rethinking".Bayesian ModelingTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-05-06-tadpoles-on-tensorflowMon, 06 May 2019 00:00:00 +0000Experimenting with autoregressive flows in TensorFlow ProbabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-04-24-autoregressive-flows
Continuing from the recent introduction to bijectors in TensorFlow Probability (TFP), this post brings autoregressivity to the table. Using TFP through the new R package tfprobability, we look at the implementation of masked autoregressive flows (MAF) and put them to use on two different datasets.Probabilistic ML/DLUnsupervised LearningTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2019-04-24-autoregressive-flowsWed, 24 Apr 2019 00:00:00 +0000Auto-Keras: Tuning-free deep learning from RJuan Cruz Rodriguez
https://blogs.rstudio.com/tensorflow/posts/2019-04-16-autokeras
Sometimes in deep learning, architecture design and hyperparameter tuning pose substantial challenges. Using Auto-Keras, none of these is needed: We start a search procedure and extract the best-performing model. This post presents Auto-Keras in action on the well-known MNIST dataset.TensorFlow/KerasPackages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2019-04-16-autokerasTue, 16 Apr 2019 00:00:00 +0000Getting into the flow: Bijectors in TensorFlow ProbabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-04-05-bijectors-flows
Normalizing flows are one of the lesser known, yet fascinating and successful architectures in unsupervised deep learning. In this post we provide a basic introduction to flows using tfprobability, an R wrapper to TensorFlow Probability. Upcoming posts will build on this, using more complex flows on more complex data.Probabilistic ML/DLTensorFlow/KerasConceptsUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2019-04-05-bijectors-flowsFri, 05 Apr 2019 00:00:00 +0000Math, code, concepts: A third road to deep learningSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-03-15-concepts-way-to-dl
Not everybody who wants to get into deep learning has a strong background in math or programming. This post elaborates on a concepts-driven, abstraction-based way to learn what it's all about.MetaConceptshttps://blogs.rstudio.com/tensorflow/posts/2019-03-15-concepts-way-to-dlFri, 15 Mar 2019 00:00:00 +0000Audio classification with Keras: Looking closer at the non-deep learning partsSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-02-07-audio-background
Sometimes, deep learning is seen - and welcomed - as a way to avoid laborious preprocessing of data. However, there are cases where preprocessing of sorts does not only help improve prediction, but constitutes a fascinating topic in itself. One such case is audio classification. In this post, we build on a previous post on this blog, this time focusing on explaining some of the non-deep learning background. We then link the concepts explained to updated for near-future releases TensorFlow code.TensorFlow/KerasConceptsAudio Processinghttps://blogs.rstudio.com/tensorflow/posts/2019-02-07-audio-backgroundThu, 07 Feb 2019 00:00:00 +0000Discrete Representation Learning with VQ-VAE and TensorFlow ProbabilitySigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-01-24-vq-vae
Mostly when thinking of Variational Autoencoders (VAEs), we picture the prior as an isotropic Gaussian. But this is by no means a necessity. The Vector Quantised Variational Autoencoder (VQ-VAE) described in van den Oord et al's "Neural Discrete Representation Learning" features a discrete latent space that allows to learn impressively concise latent representations. In this post, we combine elements of Keras, TensorFlow, and TensorFlow Probability to see if we can generate convincing letters resembling those in Kuzushiji-MNIST.TensorFlow/KerasProbabilistic ML/DLUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2019-01-24-vq-vaeThu, 24 Jan 2019 00:00:00 +0000Getting started with TensorFlow Probability from RSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2019-01-08-getting-started-with-tf-probability
TensorFlow Probability offers a vast range of functionality ranging from distributions over probabilistic network layers to probabilistic inference. It works seamlessly with core TensorFlow and (TensorFlow) Keras. In this post, we provide a short introduction to the distributions layer and then, use it for sampling and calculating probabilities in a Variational Autoencoder.TensorFlow/KerasProbabilistic ML/DLUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2019-01-08-getting-started-with-tf-probabilityTue, 08 Jan 2019 00:00:00 +0000Concepts in object detectionSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-12-18-object-detection-concepts
As shown in a previous post, naming and locating a single object in an image is a task that may be approached in a straightforward way. This is not the same with general object detection, though - naming and locating several objects at once, with no prior information about how many objects are supposed to be detected.
In this post, we explain the steps involved in coding a basic single-shot object detector: Not unlike SSD (Single-shot Multibox Detector), but simplified and designed not for best performance, but comprehensibility.TensorFlow/KerasImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-12-18-object-detection-conceptsTue, 18 Dec 2018 00:00:00 +0000Entity embeddings for fun and profitSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-11-26-embeddings-fun-and-profit
Embedding layers are not just useful when working with language data. As "entity embeddings", they've recently become famous for applications on tabular, small-scale data. In this post, we exemplify two possible use cases, also drawing attention to what not to expect.TensorFlow/KerasTabular Datahttps://blogs.rstudio.com/tensorflow/posts/2018-11-26-embeddings-fun-and-profitMon, 26 Nov 2018 00:00:00 +0000You sure? A Bayesian approach to obtaining uncertainty estimates from neural networksSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-11-12-uncertainty_estimates_dropout
In deep learning, there is no obvious way of obtaining uncertainty estimates. In 2016, Gal and Ghahramani proposed a method that is both theoretically grounded and practical: use dropout at test time. In this post, we introduce a refined version of this method (Gal et al. 2017) that has the network itself learn how uncertain it is.Image Recognition & Image ProcessingProbabilistic ML/DLTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2018-11-12-uncertainty_estimates_dropoutMon, 12 Nov 2018 00:00:00 +0000Naming and locating objects in imagesSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-11-05-naming-locating-objects
Object detection (the act of classifying and localizing multiple objects in a scene) is one of the more difficult, but very relevant in practice deep learning tasks. We'll build up to it in several posts. Here we start with the simpler tasks of naming and locating a single object.TensorFlow/KerasImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-11-05-naming-locating-objectsMon, 05 Nov 2018 00:00:00 +0000Representation learning with MMD-VAESigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-10-22-mmd-vae
Like GANs, variational autoencoders (VAEs) are often used to generate images. However, VAEs add an additional promise: namely, to model an underlying latent space. Here, we first look at a typical implementation that maximizes the evidence lower bound. Then, we compare it to one of the more recent competitors, MMD-VAE, from the Info-VAE (information maximizing VAE) family.TensorFlow/KerasUnsupervised LearningImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-10-22-mmd-vaeMon, 22 Oct 2018 00:00:00 +0000Winner takes all: A look at activations and cost functionsSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-10-11-activations-intro
Why do we use the activations we use, and how do they relate to the cost functions they tend to co-appear with? In this post we provide a conceptual introduction.TensorFlow/KerasConceptshttps://blogs.rstudio.com/tensorflow/posts/2018-10-11-activations-introThu, 11 Oct 2018 00:00:00 +0000More flexible models with TensorFlow eager execution and KerasSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-10-02-eager-wrapup
Advanced applications like generative adversarial networks, neural style transfer, and the attention mechanism ubiquitous in natural language processing used to be not-so-simple to implement with the Keras declarative coding paradigm. Now, with the advent of TensorFlow eager execution, things have changed. This post explores using eager execution with R.TensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2018-10-02-eager-wrapupTue, 02 Oct 2018 00:00:00 +0000Collaborative filtering with embeddingsSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-09-26-embeddings-recommender
Embeddings are not just for use in natural language processing. Here we apply embeddings to a common task in collaborative filtering - predicting user ratings - and on our way, strive for a better understanding of what an embedding layer really does.TensorFlow/KerasTabular Datahttps://blogs.rstudio.com/tensorflow/posts/2018-09-26-embeddings-recommenderWed, 26 Sep 2018 00:00:00 +0000Image-to-image translation with pix2pixSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-09-20-eager-pix2pix
Conditional GANs (cGANs) may be used to generate one type of object based on another - e.g., a map based on a photo, or a color video based on black-and-white. Here, we show how to implement the pix2pix approach with Keras and eager execution.TensorFlow/KerasImage Recognition & Image ProcessingUnsupervised Learninghttps://blogs.rstudio.com/tensorflow/posts/2018-09-20-eager-pix2pixThu, 20 Sep 2018 00:00:00 +0000Attention-based Image Captioning with KerasSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-09-17-eager-captioning
Image captioning is a challenging task at intersection of vision and language. Here, we demonstrate using Keras and eager execution to incorporate an attention mechanism that allows the network to concentrate on image features relevant to the current state of text generation.Natural Language ProcessingTensorFlow/KerasImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-09-17-eager-captioningMon, 17 Sep 2018 00:00:00 +0000Neural style transfer with eager execution and KerasSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-09-10-eager-style-transfer
Continuing our series on combining Keras with TensorFlow eager execution, we show how to implement neural style transfer in a straightforward way. Based on this easy-to-adapt example, you can easily perform style transfer on your own images.TensorFlow/KerasUnsupervised LearningImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-09-10-eager-style-transferMon, 10 Sep 2018 00:00:00 +0000Getting started with deep learning in RSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-09-07-getting-started
Many fields are benefiting from the use of deep learning, and with the R keras, tensorflow and related packages, you can now easily do state of the art deep learning in R. In this post, we want to give some orientation as to how to best get started.TensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2018-09-07-getting-startedFri, 07 Sep 2018 00:00:00 +0000Generating images with Keras and TensorFlow eager executionSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-08-26-eager-dcgan
Generative adversarial networks (GANs) are a popular deep learning approach to generating new entities (often but not always images). We show how to code them using Keras and TensorFlow eager execution.TensorFlow/KerasUnsupervised LearningImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-08-26-eager-dcganSun, 26 Aug 2018 00:00:00 +0000Attention-based Neural Machine Translation with KerasSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-07-30-attention-layer
As sequence to sequence prediction tasks get more involved, attention mechanisms have proven helpful. A prominent example is neural machine translation. Following a recent Google Colaboratory notebook, we show how to implement attention in R.Natural Language ProcessingTensorFlow/Kerashttps://blogs.rstudio.com/tensorflow/posts/2018-07-30-attention-layerMon, 30 Jul 2018 00:00:00 +0000Classifying physical activity from smartphone dataNick Strayer
https://blogs.rstudio.com/tensorflow/posts/2018-07-17-activity-detection
Using Keras to train a convolutional neural network to classify physical activity. The dataset was built from the recordings of 30 subjects performing basic activities and postural transitions while carrying a waist-mounted smartphone with embedded inertial sensors.https://blogs.rstudio.com/tensorflow/posts/2018-07-17-activity-detectionTue, 17 Jul 2018 00:00:00 +0000Predicting Sunspot Frequency with KerasMatt DanchoSigrid Keydana
https://blogs.rstudio.com/tensorflow/posts/2018-06-25-sunspots-lstm
In this post we will examine making time series predictions using the sunspots dataset that ships with base R. Sunspots are dark spots on the sun, associated with lower temperature. Our post will focus on both how to apply deep learning to time series forecasting, and how to properly apply cross validation in this domain.TensorFlow/KerasTime Serieshttps://blogs.rstudio.com/tensorflow/posts/2018-06-25-sunspots-lstmMon, 25 Jun 2018 00:00:00 +0000Simple Audio Classification with KerasDaniel Falbel
https://blogs.rstudio.com/tensorflow/posts/2018-06-06-simple-audio-classification-keras
In this tutorial we will build a deep learning model to classify words. We will use the Speech Commands dataset which consists of 65,000 one-second audio files of people saying 30 different words.TensorFlow/KerasAudio Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-06-06-simple-audio-classification-kerasWed, 06 Jun 2018 00:00:00 +0000GPU Workstations in the Cloud with PaperspaceJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2018-04-02-rstudio-gpu-paperspace
If you don't have local access to a modern NVIDIA GPU, your best bet is typically to run GPU intensive training jobs in the cloud. Paperspace is a cloud service that provides access to a fully preconfigured Ubuntu 16.04 desktop environment equipped with a GPU.Cloudhttps://blogs.rstudio.com/tensorflow/posts/2018-04-02-rstudio-gpu-paperspaceMon, 02 Apr 2018 00:00:00 +0000lime v0.4: The Kitten Picture EditionThomas Lin Pedersen
https://blogs.rstudio.com/tensorflow/posts/2018-03-09-lime-v04-the-kitten-picture-edition
A new major release of lime has landed on CRAN. lime is an R port of the Python library of the same name by Marco Ribeiro that allows the user to pry open black box machine learning models and explain their outcomes on a per-observation basisPackages/ReleasesTensorFlow/KerasExplainabilityImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-03-09-lime-v04-the-kitten-picture-editionFri, 09 Mar 2018 00:00:00 +0000Deep Learning for Cancer ImmunotherapyLeon Eyrich Jessen
https://blogs.rstudio.com/tensorflow/posts/2018-01-29-dl-for-cancer-immunotherapy
The aim of this post is to illustrate how deep learning is being applied in cancer immunotherapy (Immuno-oncology or Immunooncology) - a cancer treatment strategy, where the aim is to utilize the cancer patient's own immune system to fight the cancer.TensorFlow/KerasTabular Datahttps://blogs.rstudio.com/tensorflow/posts/2018-01-29-dl-for-cancer-immunotherapyMon, 29 Jan 2018 00:00:00 +0000Predicting Fraud with Autoencoders and KerasDaniel Falbel
https://blogs.rstudio.com/tensorflow/posts/2018-01-24-keras-fraud-autoencoder
In this post we will train an autoencoder to detect credit card fraud. We will also demonstrate how to train Keras models in the cloud using CloudML. The basis of our model will be the Kaggle Credit Card Fraud Detection dataset.TensorFlow/KerasUnsupervised LearningCloudhttps://blogs.rstudio.com/tensorflow/posts/2018-01-24-keras-fraud-autoencoderThu, 25 Jan 2018 00:00:00 +0000Analyzing rtweet Data with kerasformulaPete Mohanty
https://blogs.rstudio.com/tensorflow/posts/2018-01-24-analyzing-rtweet-data-with-kerasformula
The kerasformula package offers a high-level interface for the R interface to Keras. It’s main interface is the kms function, a regression-style interface to keras_model_sequential that uses formulas and sparse matrices. We use kerasformula to predict how popular tweets will be based on how often the tweet was retweeted and favorited.TensorFlow/KerasNatural Language Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-01-24-analyzing-rtweet-data-with-kerasformulaWed, 24 Jan 2018 00:00:00 +0000Deep Learning With Keras To Predict Customer ChurnMatt Dancho
https://blogs.rstudio.com/tensorflow/posts/2018-01-11-keras-customer-churn
Using Keras to predict customer churn based on the IBM Watson Telco Customer Churn dataset. We also demonstrate using the lime package to help explain which features drive individual model predictions. In addition, we use three new packages to assist with Machine Learning: recipes for preprocessing, rsample for sampling data and yardstick for model metrics.TensorFlow/KerasTabular DataExplainabilityhttps://blogs.rstudio.com/tensorflow/posts/2018-01-11-keras-customer-churnThu, 11 Jan 2018 00:00:00 +0000R Interface to Google CloudMLJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2018-01-10-r-interface-to-cloudml
We are excited to announce the availability of the cloudml package, which provides an R interface to Google Cloud Machine Learning Engine. CloudML provides a number of services including on-demand access to training on GPUs and hyperparameter tuning to optimize key attributes of model architectures.CloudPackages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2018-01-10-r-interface-to-cloudmlWed, 10 Jan 2018 00:00:00 +0000Classifying Duplicate Questions from Quora with KerasDaniel Falbel
https://blogs.rstudio.com/tensorflow/posts/2018-01-09-keras-duplicate-questions-quora
In this post we will use Keras to classify duplicated questions from Quora. Our implementation is inspired by the Siamese Recurrent Architecture, with modifications to the similarity measure and the embedding layers (the original paper uses pre-trained word vectors)TensorFlow/KerasNatural Language Processinghttps://blogs.rstudio.com/tensorflow/posts/2018-01-09-keras-duplicate-questions-quoraTue, 09 Jan 2018 00:00:00 +0000Word Embeddings with KerasDaniel Falbel
https://blogs.rstudio.com/tensorflow/posts/2017-12-22-word-embeddings-with-keras
Word embedding is a method used to map words of a vocabulary to dense vectors of real numbers where semantically similar words are mapped to nearby points. In this example we'll use Keras to generate word embeddings for the Amazon Fine Foods Reviews dataset.TensorFlow/KerasNatural Language Processinghttps://blogs.rstudio.com/tensorflow/posts/2017-12-22-word-embeddings-with-kerasFri, 22 Dec 2017 00:00:00 +0000Time Series Forecasting with Recurrent Neural NetworksFrançois CholletJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2017-12-20-time-series-forecasting-with-recurrent-neural-networks
In this post, we'll review three advanced techniques for improving the performance and generalization power of recurrent neural networks. We'll demonstrate all three concepts on a temperature-forecasting problem, where you have access to a time series of data points coming from sensors installed on the roof of a building.TensorFlow/KerasTime Serieshttps://blogs.rstudio.com/tensorflow/posts/2017-12-20-time-series-forecasting-with-recurrent-neural-networksWed, 20 Dec 2017 00:00:00 +0000Image Classification on Small Datasets with KerasFrançois CholletJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2017-12-14-image-classification-on-small-datasets
Having to train an image-classification model using very little data is a common situation, in this article we review three techniques for tackling this problem including feature extraction and fine tuning from a pretrained network.TensorFlow/KerasImage Recognition & Image Processinghttps://blogs.rstudio.com/tensorflow/posts/2017-12-14-image-classification-on-small-datasetsThu, 14 Dec 2017 00:00:00 +0000Deep Learning for Text Classification with KerasFrançois CholletJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2017-12-07-text-classification-with-keras
Two-class classification, or binary classification, may be the most widely applied kind of machine-learning problem. In this excerpt from the book Deep Learning with R, you'll learn to classify movie reviews as positive or negative, based on the text content of the reviews.TensorFlow/KerasNatural Language Processinghttps://blogs.rstudio.com/tensorflow/posts/2017-12-07-text-classification-with-kerasThu, 07 Dec 2017 00:00:00 +0000tfruns: Tools for TensorFlow Training RunsJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2017-10-04-tfruns
The tfruns package provides a suite of tools for tracking, visualizing, and managing TensorFlow training runs and experiments from R.Packages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2017-10-04-tfrunsWed, 04 Oct 2017 00:00:00 +0000Keras for RJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2017-09-06-keras-for-r
We are excited to announce that the keras package is now available on CRAN. The package provides an R interface to Keras, a high-level neural networks API developed with a focus on enabling fast experimentation.TensorFlow/KerasPackages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2017-09-06-keras-for-rTue, 05 Sep 2017 00:00:00 +0000TensorFlow EstimatorsYuan Tang
https://blogs.rstudio.com/tensorflow/posts/2017-08-31-tensorflow-estimators-for-r
The tfestimators package is an R interface to TensorFlow Estimators, a high-level API that provides implementations of many different model types including linear models and deep neural networks.Packages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2017-08-31-tensorflow-estimators-for-rThu, 31 Aug 2017 00:00:00 +0000TensorFlow v1.3 ReleasedJ.J. Allaire
https://blogs.rstudio.com/tensorflow/posts/2017-08-17-tensorflow-v13-released
The final release of TensorFlow v1.3 is now available. This release marks the initial availability of several canned estimators including DNNClassifier and DNNRegressor.Packages/Releaseshttps://blogs.rstudio.com/tensorflow/posts/2017-08-17-tensorflow-v13-releasedThu, 17 Aug 2017 00:00:00 +0000