Sign in

Oliver K. Ernst
Coding & AI — oliver-ernst.com
Artistic visualization of neural network outputs with random weights (2D inputs, scalar output). Credit: Author. To reproduce this visualization, see Wolfram docs.

Seriously? Mathematica?

Yes. Seriously. Keep reading.


Image source: Author (Oliver K. Ernst) All rights reserved.

Slap some docstrings in your code

Click on the method or class to document, then use command-option-/ to insert a docstring…


This article is about compiling all those TensorFlow manuals into one page. Image from Unsplash by Patrick Tomasso.
TensorFlow v2.5.0.

Numpy mappings to TensorFlow

  • Keep in mind for all operations: in TensorFlow, the first axis is the batch_size.
  • Trick to get past the batch size when it’s inconvenient: wrap linear algebra in tf.map_fn , e.g. converting vectors of size n in a batch (batch_size x n) to diagonal matrices of size (batch_size x n x n) :
mats = tf.map_fn(lambda vec: tf.linalg.tensor_diag(vec), vecs)
  • For most operations such…

Nested layers. Image credit: author.

Saving a custom layer

Let’s first make a custom layer:


Noise, noise everywhere. Image by alexey.shikov (License: CC0 1.0)
  • You’re taking data from an infrared sensor or some other displacement sensor, and want to compute velocity and acceleration.
  • You’re tracking the price of your favorite stock, option, or GME short and think your prediction will give you the edge to make money (spoiler: it won’t…).
  • Differentiation amplifies noise.
  • Integration introduces drift.


The Gaussian distributions in your probabilistic PCA model. Source: author.
  • Draw new…


The Masked Manual on the iOS app store: https://apps.apple.com/us/app/the-masked-manual/id1542536599

The problem:

Masks are important. Choosing the right type of mask and understanding its qualifications is critical. Currently, mask information is scattered between the openFDA database, FDA websites and CDC websites.

The solution:

“The Masked Manual” is a free iOS app that shows mask information compiled from openFDA, FDA websites and CDC websites. It lets you easily search for masks and see their qualifications, as well as instructions for wearing it. You can also use the camera to recognize and find your mask by scanning its packaging.


Screenshot from What’s my vote worth? Credit: Author original content.


Image by hans-johnsonsource and license (CC BY-ND 2.0).

Motivation

In all optimization problems, we are ultimately interested in using a computer to find the parameters x that minimize some function f(x) (or -f(x) , if it is a maximization problem). Starting from an initial starting guess x_0, it is common to proceed in one of three ways:

  • Gradient-free optimization — don’t laugh! Everyone does this. Here we are just guessing the next parameters:

Oliver K. Ernst

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store