Moving to Python 3

The time has come. All the libraries I use on a regular basis are available for Python 3.4. I just spent a frighteningly short amount of time with [MacPorts][] installing everything I need and then making sure that Python 3.4 and iPython 3.4 are the defaults. Here’s all that I had to type:

% sudo port selfupdate
% sudo port install python34
% sudo port install py34-numpy
% sudo port install py34-scipy
% sudo port install py34-nltk
% sudo port install py34-pandas
% sudo port install ipython34
% sudo port select –set python python3
% sudo port select –set ipython ipython3

And then, because I’m working on something for [The Programming Historian][] and it’s just easier to do everything in an iPython notebook:

% ipython notebook

Later, all I will need to do is:

% ipython nbconvert –to markdown myFile.ipynb

[The Programming Historian]:


While Mac OS X’s Calendar and the iCloud service handle the back-end, I increasingly only use Fantastical for interacting with times, dates, appointments, and schedules. Not only is its natural language system very good — “Meet with this person next Friday from 2 to 2:30 in my office” — but it just looks good:

Screen Shot 2015-07-24 at 3.27.44 PM

Residential Alternatives

The more I live in Louisiana, the more I would like either to live somewhere else or at least be able to get to other places when I have the time. (Sadly, the more I live here, the less I am able to afford anything.) Until that moment where I live elsewhere, I like to daydream about either living in a small house, maybe even a tiny house as they are now known, or at least camping in a similarly outfitted trailer.

Here are some ideas:

*An [Updated Airstream](*

![Updated 1962 Bambi Airstream](
*A [1962 Airstream Bambi](*

![Travel Trailer Home](
*A [Lived-In Travel Trailer](*

Complete MacPorts Installation Cheat Sheet

The following set of commands assume that you begin with a Mac OS X that does not have any of the necessities already installed. You can, thus, skip anything you have already done, e.g., if you have already installed Xcode, skip to Step 2.

  1. Install the Xcode development and command line tool environment.
  2. Install the MacPorts basic installation.
  3. Install Python 2.7 for math, science, and NLP.
  4. Install iPython and select it like you did for Python:
    port select --set ipython ipython27
  1. Install iPython notebook. (And here’s a list of dependencies in case the notebook installation doesn’t complete by itself.)

Python ML Projects

Bhavya Geethika Peddibhotla at _KD Nuggets_ has compiled a list of the [“Top 20 Python Machine Learning Open Source Projects.”]( At the top? `scikit-learn`, as evidenced in one of the graphics from the article:

![The Top 20 Open Source Machine Learning Projects in Python](

Visual Correspondence

In addition to the Map of Metaphor in English, there is also [Visual Correspondence][1], a project to make available not only the contents of correspondence but also the metadata — who received the letter? who else was a correspondent? — and to make all of this data and metadata available for visualization.


Mapping Metaphor

The [Metaphor Map of English][] is now available. It’s a fascinating labyrinth, especially if you have any interest in conceptual metaphors. Here’s what the map’s developers have to say:

> The Metaphor Map of English shows the metaphorical links which have been identified between different areas of meaning. These links can be from the Anglo-Saxon period right up to the present day so the map covers 1300 years of the English language. This allows us the opportunity to track metaphorical ways of thinking and expressing ourselves over more than a millennium; see the Metaphor in English section for more information.
> The Metaphor Map was built as part of the Mapping Metaphor with the Historical Thesaurus project. This was completed by a team in English Language at the University of Glasgow and funded by the Arts and Humanities Research Council from 2012 to early 2015. The Metaphor Map is based on the Historical Thesaurus of English, which was published in 2009 by Oxford University Press as the Historical Thesaurus of the Oxford English Dictionary.

[Metaphor Map of English]:

From CSV to Bipartite Network to One-Mode Projection

I am continuing my effort to develop my own stack of scripts that do exactly what I want and that I understand how they work. They are not, in all honesty, scalable like the work done by Tim Tangherlini, but my work here pleases me.

I don’t have weighting in place yet to make the projection have more meaning than it does, but this code uses `pandas` and works quite well:

#! /usr/bin/env python

import pandas as pd, networkx as nx, matplotlib.pyplot as plt
from networkx.algorithms import bipartite

# Build lists of nodes and edges:

df = (pd.read_csv(‘tales-01.txt’, header=None)
.apply(lambda x : pd.DataFrame ([[x.iloc[0,0],v] for v in x.iloc[0,1:]]))
edges = df.values.tolist()
nodes_0 = list(set(df[‘text’].values.tolist()))
nodes_1 = list(set(df[‘word’].values.tolist()))

# Build a bipartite graph:

B = nx.Graph()
B.add_nodes_from(nodes_0, bipartite=0) # Add the node attribute “bipartite”
B.add_nodes_from(nodes_1, bipartite=1)

# Project one side of the graph:

G = nx.projected_graph(B, nodes_1)
with_labels = True,
node_color = ‘#00CCFF’)

# Choose your output:
# plt.savefig(“graphing.png”, dpi=300)

For those less familiar with bipartite networks, Wikipedia as always has [a decent introduction][].

[a decent introduction]: