This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Machine learning based follow unfollow algorithm

dev-master 2019-09-24 09:19 UTC

This package is auto-updated.

Last update: 2021-09-24 13:57:40 UTC


Class that allows you to predict whether a user will return a follow or not.


  • follow_back
  • not_follow_back

WARNING: the dataset in data/data.csv doesn't contain real data.

How to install

composer require filippofinke/insta-learn

How to use

use FilippoFinke\InstaLearn;
use FilippoFinke\User;
require_once __DIR__ . '/vendor/autoload.php';
ini_set('memory_limit', '-1');

// Loading from a model
$il = new InstaLearn('model.model');
// Or $il->load('model.model');

// Creating a user
$user = new User();
// Get 'nasa' from the instagram API
// Predict the result
$prediction = $il->predict($user);

// Output: string(15) "not_follow_back"

How to train

use FilippoFinke\InstaLearn;

// Get the CsvDataset
$il = new InstaLearn();
// Train the classifier
// Save the model

How to get the training data

You have to do it by yourself.


red = follow_back, green = not_follow_back Dataset Visualization


  • Filippo Finke