*This short post is going to talk about an interesting statistical distribution, the **Gumbel distribution**, and how to use TensorFlow and SciPy to fit that distribution on historical weather data provided by the government.*

*this *cold here?

**Getting some weather data**

**The Apocalyptic Gumbel distribution**

The form of the Gumbel distribution is quite simple. Here’s the probability density function:

And the cumulative distribution function is as follows:

**TensorFlow isn’t (just) a deep learning tool**

*and* the gradient of that with respect to model parameters. With TensorFlow, one only has to write the objective function and then call tf.gradients, which makes life easier. One can also use optimizers in TensorFlow to estimate models, but one doesn’t need to. For example, the objective function and gradient from TensorFlow can be passed into SciPy’s optimization package, either directly or through this user-contributed interface in the TensorFlow package.

**Some results**

*maximum* temperature model, we see that there’s only 22.9% chance of a day over 100°F in a year. I’ll take that chance.

**Code: **https://gist.githubusercontent.com/mheilman/24012cbf667dc07d2b4a8e9df30c0ba6/raw/40053a9dc3905bdc2f075c849f380a63ab397449/gumbel.ipynb