定制 phpjuice/slopeone 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phpjuice/slopeone

Composer 安装命令:

composer require phpjuice/slopeone

包简介

PHP implementation of the Weighted Slope One rating-based collaborative filtering scheme.

README 文档

README

Tests Maintainability Latest Stable Version Total Downloads License

PHP implementation of the Weighted Slope One rating-based collaborative filtering scheme.

Installation

Slopeone Package requires PHP 7.4 or higher.

INFO: If you are using an older version of php this package may not function correctly.

The supported way of installing Slopeone package is via Composer.

composer require phpjuice/slopeone

Usage

Slopeone Package is designed to be very simple and straightforward to use. All you have to do is to load rating data, then predict future ratings based on the training set provided.

Loading files

The Slopeone object is created by direct instantiation:

use PHPJuice\Slopeone\Algorithm;

// Create an instance
$slopeone = new Algorithm();

Adding Rating values

Adding Rating values can be easily done by providing an array of users ratings via the update() method:

$data =[
  [
    "squid" => 1,
    "cuttlefish" => 0.5,
    "octopus" => 0.2
  ],
  [
    "squid" => 1,
    "octopus" => 0.5,
    "nautilus" => 0.2
  ],
  [
    "squid" => 0.2,
    "octopus" => 1,
    "cuttlefish" => 0.4,
    "nautilus" => 0.4
  ],
  [
    "cuttlefish" => 0.9,
    "octopus" => 0.4,
    "nautilus" => 0.5
  ]
];

$slopeone->update($data);

Predicting ratings

all you have to do to predict ratings for a new user is to run the slopeone::predict method

$results = $slopeone->predict([
    "squid" => 0.4
]);

this should produce the following results

[
  "cuttlefish"=>0.25,
  "octopus"=>0.23333333333333,
  "nautilus"=>0.1
];

Running the tests

you can easily run tests using composer

composer test

Built With

  • PHP - The programing language used
  • Composer - Dependency Management
  • Pest - An elegant PHP Testing Framework

Changelog

Please see the changelog for more information on what has changed recently.

Contributing

Please see CONTRIBUTING.md for details and a todo list.

Security

If you discover any security related issues, please email author instead of using the issue tracker.

Credits

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

license. Please see the Licence for more information.

Tests Maintainability Latest Stable Version Total Downloads License

统计信息

  • 总下载量: 8.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 86
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 85
  • Watchers: 4
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固