A Neural Network in Python

I’ve been looking at creating neural networks using the Microsoft CNTK tool. CNTK is complicated. Very complicated, and a bit rough around the edges because it was developed as an internal tool rather than for public use.

In order to understand the architecture of CNTK I wanted to experiment with different input values, weight values, and bias values. So I decided to dust off an old Python implementation of a neural net, and refactor it from Python 2 to Python 3.

The refactoring was much easier than I thought — mostly changing V2 print statements to V3 print functions. Luckily I used V2 range() instead of xrange() so I didn’t have to worry about that.


Another reason I used Python to explore CNTK is that Python seems to be the utility language of choice for CNTK systems. For example, one of the tools that comes with CNTK is a Python script that downloads and formats the MNIST image recognition data set.

I don’t use Python all that often, but when I do use the language I like it. Python hits a sweet spot between simplicity and complexity.

My demo uses fake data that mirrors the famous Iris data set. Good fun.


This entry was posted in Machine Learning. Bookmark the permalink.