Tag Archives: computer programming


Yes, this is still a Magic Math Mandarin blog–but to have tomorrow’s skills means a lot more than just knowing basic math.
API = plugin

This post is a quick note (updates are in progress).

Site that documents most APIs

hash function/ cryptography/ digital signiture

Hash function (散列函數):
Yes, this is still a Magic Math Mandarin blog–but to have tomorrow’s skills means a lot more than just knowing basic math.
A hash function maps arbitrary string of data fix length of bits.

The simplest (a bad one) is to use the ASCii representation of alphabet, sum up the numbers and take mod.   This creates a problem as “cat”, “act” and “tca” are going to be mapped to the same hash.  This problem is called “hash collision” 碰撞.


A CS lecture 马克十几年前教的课

It is amazing how much one can learn from this old video, recorded 2 years after Mark Zuckerburg left Harvard. Here is what I remember after listening 5 times:

1. Don’t follow what the big guys are doing. There is so much you can do on your own with technology (find your own problem and get to it)

Python getting help 帮助 (bāngzhù)

Before searching on the internet, please get help within the system.  It is much faster, and without distraction.


Git and Github

Q: What is git?
A: It is a digit without di 🙂   Git is currently the best (commonly used) tool for version control 目前最好的版本控制系统.

Github can be used for your own code version control by mirroring the code of a folder in your own computer. It enables version control and has workflow capabilities.   Note: if you just want syncing, use Dropbox; git and Github can be a bit confusing.

TensorFlow and many ways to use it | TensorFlow人工智能系统

What is TensorFlow?    Since the best way to learn anything is to first draw upon what we already know, and then to practice.   Let’s start with what it looks like to things we already know, and then what is unique about it.

Relating to the old (or something we already knew): from its design, TensorFlow has something in common with kids’ programming environment Scratch and data mining tool such as SAS Enterprise Miner: all of them use graph to represent a process, and nodes/modules to represent specific blocks of functions, without having to write a ton of code.

SAS Enterprise Miner
SAS Enterprise Miner Project Flow Graph

Although not a drag-and-drop as Scratch, SAS EM,  TensorFlow does operate in similar way in that you define the graph of the process before any numerical computation is done.  According to Google (GCP), “With TensorFlow, you don’t need to be knowledgeable about the advanced math models and optimization algorithms needed to implement deep neural networks. Just download the sample code and read the tutorials and you can get started in no time. The library lowers the barrier to entry for machine learning significantly.” This has been what Scratch, SAS Enterprise Miner, Alteryx and other GUI have done for their specializations.

TensorFlow graph for a simple linear regression from my computer
TensorFlow graph for a simple linear regression from my computer

Why it is so special

There are many other great libraries that help facilitate deep learning as well.  TensorFlow is special because it is developed and maintained by Google, and it has more pros than other libraries.   Google gives it away because Google believes it will have more value if more people uses it.

One of many cool things showcased at Google TF 2017 Developer Summit is a project that detects eye disease based on the same technology that identifies cats from pictures.  What is special is that TF allows the project to focus more on solving the problem than figuring out all the code.

tensorflow detect eye disease
TensorFlow-based project that detects eye disease from images

On Github TensorFlow is one of the most starred repos, where there are many exciting resources and examples getting developed each day.



  • Repository of models: https://github.com/tensorflow/models

Before watching the tutorial or reading example code, it would be better to have TensorFlow installed so that you can learn by doing instead of just watching.

copyright Magic Math Mandarin

I need to start the virtual enviroment, by typing “activate universe” at the command prompt. Then type “tensorboard –logdir=graphs”. Then follow the address provided by tensorboard on the command prompt, which says “http://IBM-THINK:6006”, not “http://localhost:6006”. This was successful.

tensorboard on Magic Math Mandarin

When I ran a different model but with the same graph folder, then I need to delete all contents in graph before running the different model.  Otherwise the graph stays in the old one while information in some other tabs of TensorBoard may change.

tensorboard on Magic Math Mandarin

Python for fun 4

Today we work on animation with hundreds of triangles, balls, squares and vickies (you can call the shapes anything you like).   Shapes are defined by coordinates (x,y).   A huge improvement over last time is that we use a loop to add shape to lists of shapes.

Setting up Python after installing (or re-installing) Anaconda

Everyone of us (adult Python users at least) need to install or re-install Python or the one with Anaconda. Today I had to re-install everything related to Python due to trouble getting Tensor Flow started.   I primarily use Windows 10.  Below steps may serve some who are going through this.

error: Content is protected !!