Ryan Holbrook Profile picture
Math, stats, programming. R, Python, Haskell. Interested in employment opportunities.

Jan 18, 2020, 18 tweets

A thread of classifiers learning a decision rule. Dashed line is optimal boundary. Animations with #gganimate by @thomasp85 and @drob. #rstats

Logistic regression {stats::glm} with each class having normally distributed features. (1/n)

Quadratic discriminant analysis {MASS::qda} with normal features. The QDA model is the same as the data model in this case, and so it fits the optimal boundary very closely. (2/n)

MARS {earth::earth} on normal features. (3/n)

Nearest Neighbors {class::knn} on normal features. (4/n)

Decision tree {rpart::rpart} with features distributed as a mixture of normal distributions. (5/n)

Random forest {ranger::ranger} on mixture of normals. (6/n)

XGBoost {xgboost::xgboost} on mixture of normals. (7/n)

GAM {mgcv::gam} with spline smoother on mixture of normals. (8/n)

SVM {kernlab::ksvm} with RBF kernel on mixture of normals. (9/n)

Neural network {nnet::nnet} on mixture of normals. (10/n)

Also, a blog post on optimal decision boundaries: mathformachines.com/posts/decision/

It has most of the plotting code. I'm planning on writing another on classifiers with the animation code. In the meantime, here's a gist:
gist.github.com/ryanholbrook/2…

Here is a repo with the gif files. I added an open license on the page, but basically you can use them however you like with attribution.

github.com/ryanholbrook/d…

Here's a better GAM animation (more frames!).

Gaussian process {kernlab::gausspr} on mixture of normals. (11/n)

Extreme learning machine {elmNNRcpp::elm_train} on mixture of normals. (12/n)

Mixture discriminant analysis {mda::mda} on mixture of normals. (13/n)

Naive Bayes {naivebayes::naive_bayes} on normal features. (14/n)

Boosted p-splines {mboost::mboost} on mixture of normals. (15/n)

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling