filippofinke/insta-learn

基于机器学习的关注/取消关注算法

dev-master 2022-01-29 15:08 UTC

This package is auto-updated.

Last update: 2024-09-29 05:48:40 UTC


README

一个允许你预测用户是否会返回关注或取消关注的类。

标签

  • follow_back
  • not_follow_back

警告:data/data.csv中的数据集不包含真实数据。

如何安装

composer require filippofinke/insta-learn

如何使用

<?php
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
$user->load('nasa');
// Predict the result
$prediction = $il->predict($user);
var_dump($prediction);

// Output: string(15) "not_follow_back"

如何训练

<?php
use FilippoFinke\InstaLearn;

// Get the CsvDataset
$il = new InstaLearn();
// Train the classifier
$il->train('data/data.csv');
// Save the model
$il->save($model);

如何获取训练数据

你需要自己完成。

可视化

红色 = follow_back,绿色 = not_follow_back 数据集可视化

作者

  • Filippo Finke