Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

SEFR in Swift

This is the source code that accompanies my blog post The SEFR classifier.

SEFR is a binary classifier. To use it on a binary classfication task:

let sefr = SEFR() X_train, targets: y_train)
let y_pred = sefr.predict(examples: X_test)

You can use it for multiclass tasks by using a simple wrapper that performs one-vs-rest:

let model = SEFRMulticlass() X_train, targets: y_train)
let y_pred = model.predict(examples: X_test)

The demo program is a simple Swift script that runs on macOS. It uses the Vision framework to generate "feature prints" for a set of training and test images. Each feature print consists of 2048 numbers. It trains SEFR on these feature prints.

To run the demo program, open a Terminal on macOS and type:

$ cat SEFR.swift Demo.swift | swift -


The images used in the dataset were hand-picked from Google Open Images Dataset V6. For full credits and license terms, see here.

The source code is licensed as MIT.

My implementation is based on the following sources:


No releases published


No packages published