Real examples that you can incorporate into your code base

Sometimes, it’s the simple, unsung heroes that can make all the difference. Machine learning configuration — that is, the network architecture, the dataset root folder, the learning rate, et al. — is probably not something that’s going to get a lot of airtime when you’re rushing to get your next data analytics software to production. But, with all the work it’s doing, it’s only fair to call your config a hero.

Photo by Eun-Kwang Bae on Unsplash

In this article, I’ll show you ready-to-go examples of how moving your hyper-parameter selections, command-line arguments, and default options…

Are you taking advantage of these features of Python that can help make your code make more sense?

Code readability is not just about making your code shorter. It is about reducing the intellectual burden of understanding what your code is doing and how it is doing it.

Some general rules of thumb are: explicit is better than implicit, clear is better than short, and don’t repeat yourself (DRY).

With that in mind, here are three (plus one bonus!) examples of situations where avoiding an if statement can help make your code more readable. They are:

  1. Testing for equality with…

A splash of sun upon a man, tearing eyes awaken. His turning head arouses dreams from which his mind is taken. His shallow breaths uneasy queasiness the first he’s feeling. Today the day is drawing in and now the dawn is breaking.

For Rey — the one we’re speaking of — this time is cherished, for before his thoughts flood in, before his memories can fill his head with that disquieting uneasiness, he is at peace with what has passed. At least unconsciousness can serve a salve, to save his troubled thoughts until his daily life distracts. …

A butterfly sits in a cradle of leaves, floating on water supporting its weight. With a bat of its wings — its colours revealed — it lifts itself up in response to the air. The same gust of wind that has given it fright with a ripple impresses itself on the lake, a movement that carries a message that comes from a foreign, intangible place.

In the scene aforementioned is formed a whole world. Infinity bounded, alive in its shores: there’s a reason the leaves didn’t sink to the grave and the butterfly chose it to make as its nest…

Jonny Jackson

PhD student in Artificial Intelligence and Medicine. Teacher of coding and machine learning to children and adults alike. ->

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