If you can explain something better than it was explained to you, it might be worth publishing as your own work. Classic textbook material can often be re-written in a more succinct way to cater to learners in the age of shortened attention spans, and old college textbooks offer a plethora of this admittedly low-hanging fruit.

This is the aim of learning platforms like Khan Academy and Brilliant.org: To condense complex subject matter into short, 10-minute videos or animations; teaching the essence of a subject and omitting superfluous details often found in college textbooks. …

For serious projects, machine learning models are often required to be optimized for statistical accuracy and computational efficiency. It is however possible to use boilerplate models as a sort of black box, without even knowing exactly what’s going on under the hood . All that’s required is a working knowledge of Python.


  1. Boilerplate Models
  2. Decision Boundaries
  3. Regression vs Classification

1. ) Boilerplate Models

Sklearn is built on Numpy, which means that it’s methods take numpy arrays as arguments, like — for example — the columns of a Pandas DataFrame:

Five-minute web apps with Python.

The Flask micro web framework for Python allows for rapid development of web applications. Apps can be deployed to any free web hosting service, but one is particular makes the process seamless, and that is PythonAnywhere.

The Example:

Below is the full code for a (very) simple application, explained in detail further down. For the sake of simplicity and speed, everything is kept inside one Python file, including the HTML which is normally separate:

Brief explanation for those unfamiliar with Flask or HTML

This application is asking the user for data, sending a request to the server with the HTTP method ‘POST’, and then returning a string as HTML.


Stocktwits — The Twitter of stocks, offers a free API to access trending stocks on its site. This list of trending stock tickers can be iterated over to scrape any number of useful sentiment indicators. One such indicator is a weighed opinion of thousands of investors, and it’s a good predictor of short-term valuation.

import requests
from bs4 import BeautifulSoup
import time
stocktwits_trending = requests.get('https://api.stocktwits.com/api/2/streams/trending.json').json()stocktwits_trending_tickers = [stocktwits_trending['messages'][index]['symbols'][0]['symbol'] for index in range(len(stocktwits_trending['messages']))]trending_sentiment = {}for index in stocktwits_trending_tickers:
x =…

Regression is fundamental to Predictive Analytics, and a good example of an optimization problem. The simplest cases of regression are calculable by hand (the results of which we can verify with Python). Below is the linear regression model of some predictor variable ‘x’ with response variable ‘y’.

Populations that undergo a fixed set of age transitions can be modeled as a system of linear equations, from which age distributions can be calculated.

As a brief review of linear algebra, a system of linear equations can be represented as a matrix equation of the form Ax = b. In this form, ‘A is the set of coefficients as some m × n matrix, ‘x is some input vector in n, and ‘b’ is the product of ‘A’ and ‘x’ as an output vector in m, shown below:

Demetri Sims

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store