Home » Uncategorized

Can we use deliberate practise for learning to code #AI and #machinelearning


In this post, I explore if ideas of deliberate practise can be applied to teaching coding for Artificial Intelligence / Machine Learning

I am exploring these ideas in a free coding workshop/ meetups in London.

There is already a waiting list.

We may hold more workshops next year depending on how these go.

But in this post, I outline the rationale of the learning strategy used

I have been involved in teaching Data Science for a few years now (Oxford University – Data Science for Internet of Things and also online). Over the years, I have tried to improve my teaching .. and adopt ideas from other domains into my teaching

One such technique is Deliberate practice a technique which probably originated in the former Soviet Union to train world class athletes. Deliberate practise is also used in learning complex skills like playing the violin – which require mastering many small steps and then putting the steps together in a complex whole (like a violin concert)

James Clear (whose writings I recommend) says of Deliberate practice

Deliberate practice always follows the same pattern: break the overall process down into parts, identify your weaknesses, test new strategies for each section, and then integrate your learning into the overall process.

And provides examples like

Cooking: Jiro Ono, the subject of the documentary Jiro Dreams of Sushi, is a chef and owner of an award-winning sushi restaurant in Tokyo. Jiro has dedicated his life to perfecting the art of making sushi and he expects the same of his apprentices. Each apprentice must master one tiny part of the sushi-making process at a time—how to wring a towel, how to use a knife, how to cut the fish, and so on. One apprentice trained under Jiro for ten years before being allowed to cook the eggs. Each step of the process is taught with the utmost care.

There are essentially six steps to Deliberate practise 

1. Get motivated
2. Set specific, realistic goals
3. Break out of your comfort zone
4. Be consistent and persistent
5. Seek feedback
6. Take time to recover

So, the question is: Can we apply deliberate practise to learning coding for AI?

To try this, we work in small sections of code which you should master bit by bit

We divide the code into four sections

1) Pandas, NumPy and MathPlotLib

2) Data manipulation and feature engineering

3) Machine Learning models and validation·

4) Deep learning

Each of these topics is divided into detail (subtopics) as below

(note the code itself is taken from the public domain and from existing books under Apache v2 license)

Pandas, NumPy and MathPlotLib 
· initializing NumPy array
· Creating NumPy array
· NumPy datatypes
· Field access
· Basic slicing
· Advanced indexing
· Array math: Sum function, Transpose function
· Broadcasting
· Creating a pandas series
· Creating a pandas dataframe
· Reading / writing data from csv, text, Excel
· Basic statistics on dataframe
· Creating covariance on dataframe
· Creating correlation matrix on dataframe
· Concat or append operation, Merge, join dataframes
· Grouping operation, Pivot tables on Dataframe
· Plots, Bar charts, Pie charts etc for DataFrames

Data manipulation and feature engineering
· Converting categorical variable to numerical
· Normalization and scaling
· Univariate analysis
· Pandas dataframe visualization
· Multivariate analysis
· Correlation matrix
· Pair plot
· Scatter plots
· Find outliers
· Load data
· Normalize data
· Split data into train and test

Machine Learning models and validation·
Linear regression
· Linear regression model accuracy matrices
· Polynomial regression
· Regularization
· Nonlinear regression
· Logistic regression
· Confusion matrix
· Area Under the Curve
· Under-fitting, right-fitting, and over-fitting
· Logistic regression model training and evaluation
· Generalized Linear Model
· Decision tree model
· Support vector machine (SVM) model
· Plotting SVM decision boundaries
· k Nearest Neighbors model
· k-means clustering

Deep Learning·
sklearn perceptron code
· loading MNIST data for training MLP classifier
· sklearn MLP classifier
· Bernoulli RBM with classifier
· grid search with RBM + logistic regression
· Keras MLP
· Compile model
· Train model and evaluate
· dimension reduction using autoencoder
· de-noising using autoencoder
· Keras LSTM

Comments welcome

Does this approach make sense? i.e. would we be able to use the ideas of Deliberate practise in learning coding for AI and Machine Learning

many thanks for the great responses to this post
I have also had feedback from educators 
Here are three additional comments to add
a)  Paired programming – Paired programming has its pros and cons but it a structured learning environment, could help learners who are very new to coding
b)  Understanding the big picture – first explaining some worked examples and then going through the steps of practising in very small segments but relating back to the big picture
c)  learning from teachers in a classroom – not all ideas here apply but many that can be used
we have now launched this program online at a discounted rate
Please contact [email protected] if you are interested

Image source: Vanessa Mae – Violin prodigy/ player