Python

The programming language, not Monty.

Why should you care? It turns out that Python is quite popular in the scientific research, cloud computing and neural networking communities. The language's interpretive nature also make it an interesting environment for quickly prototyping and trying out software ideas.

In a later post we'll be discussing the Keras API and TensorFlow, which are used for deep learning neural network design and training. Keras can be accessed via Python bindings.


I think a really good place to get started if you are totally clueless about Python is the current wikipedia entry for it. I found it a way better getting started fast overview than the official Python site. I've included some salient information from that article below.


Python is an interpretedhigh-levelgeneral-purpose programming language. Created by Guido van Rossum and first released in 1991. Python's design philosophy emphasizes code readability with its notable use of significant whitespace. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.
Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly, procedural,) object-oriented, and functional programming. Python is often described as a "batteries included" language due to its comprehensive standard library.
Python is a multi-paradigm programming languageObject-oriented programming and structured programmingare fully supported, and many of its features support functional programming and aspect-oriented programming(including by metaprogramming[48] and metaobjects (magic methods)).[49] Many other paradigms are supported via extensions, including design by contract[50][51] and logic programming.[52]


Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management. It also features dynamic name resolution (late binding), which binds method and variable names during program execution.

Python's design offers some support for functional programming in the Lisp tradition. It has filter, map, and reduce functions; list comprehensions, dictionaries, sets, and generator expressions


After getting a feel for what Python is and why they designed it the way they did, then take a dive into the official python.org site.  That site has links to more resources for learning Python then you could ever hope to fully read through. I think that there is also enough free information on the site to get yourself up and running without having to spend money on some kind of pay to learn Python course.

The official Python site also includes a beginners installation guide. If you are on windows, you have to install it to use it. If you are on a mac, then it probably already has a version of python on it (but probably not the version you want to be using, so you will also be doing some installation). 

The free Dive into Python 3 book accessible on the official site includes a pretty thorough beginners Installing Python Chapter. 
You can also use HomeBrew to do your Python 3 installation on macOS.

Eventually you will probably want to work with Python in a virtual environment on your computer. This will allow you do accommodate different versions in sandboxed environments. You can use virtualenv and virtualenvwrapper to do that.



If you are a c or c++ programmer, you will immediately notice the lack of curly brackets and semicolons in Python. Python uses whitespace indentation, not curly brackets, to delineate blocks of code.  The program's visual structure accurately represents the program's semantic structure.

Assignment in C, e.g., x = 2, translates to "typed variable name x receives a copy of numeric value 2". The (right-hand) value is copied into an allocated storage location for which the (left-hand) variable name is the symbolic address. The memory allocated to the variable is large enough (potentially quite large) for the declared type. 

In the simplest case of Python assignment, using the same example, x = 2, translates to "(generic) name x receives a reference to a separate, dynamically allocated object of numeric (int) type of value 2." This is termed binding the name to the object. Since the name's storage location doesn't contain the indicated value, it is improper to call it a variable. Names may be subsequently rebound at any time to objects of greatly varying types, including strings, procedures, complex objects with data and methods, etc.



Python has a large standard library that includes a lot of pre-built tools to help you get things done quickly. There is also a very large Python repository for 3rd party python software.

Computer vision and image processing libraries in the Python programming language leverage the powerful NumPy numerical processing library and thus represent images as multi-dimensional NumPy arrays.

Importing different Python packages into your Python program gives you easy access to whatever functionality that package provides. For example, if you import the NumPy library into your Python program, then you can access all of the different routine calls it provides. For example:
  1. import numpy as np

  2. np.add(B, C)


Could i distribute release software written in Python to customers? Yeah, that is an interesting question. Interpreted language and issues with which Python version is on a given computer should give you serious pause.  

Then again, parts of the DropBox applications for various desktop computer platforms use it for building part of their distributed desktop applications. Here's some information on how they actually pulled this off. They actually embed a Python runtime inside of their application. Fascinating, but a lot of work.



That was a quick overview. Hopefully this is enough information to get you interested in finding out more about Python.  It is definitely a fascinating programming language. But if you follow the links above you will find a ton more information. 

We will be talking more about how to use Python for neural net training in future posts.

Comments

Popular posts from this blog

CycleGAN: a GAN architecture for learning unpaired image to image transformations

Pix2Pix: a GAN architecture for image to image transformation

Smart Fabrics