offdev / bandit
使用 PHP 编写,通过实现多臂老虎机问题的解决方案的 A/B/x 测试算法
1.0.0
2017-02-17 20:42 UTC
Requires
- php: >=7
Requires (Dev)
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: 2.*
This package is auto-updated.
Last update: 2024-09-29 03:52:37 UTC
README
使用 PHP 编写,通过实现多臂老虎机问题的解决方案的 A/B/x 测试算法
需求
- PHP >= 7.4
- Composer
安装
$ composer require offdev/bandit
通用用法
首先,您需要设置一台机器及其可能的杠杆。一个杠杆可能已经被拉动几次,某些杠杆也可能已经奖励了拉动它的幸运儿,因此相应地调整这些数字。示例
use Offdev\Bandit\Lever; use Offdev\Bandit\Machine; $machine = new Machine( new Lever('first-lever', 123, 1), new Lever('second-lever', 108, 3), new Lever('third-lever', 115, 0), );
现在您需要一种策略来解决您的问题。有关策略的更多信息,请参阅此链接,并查看我在 src/php/Strategies 中包含的示例。示例
use Offdev\Bandit\Strategies\EpsilonGreedy; $strategy = new EpsilonGreedy(); $winningLever = $strategy->solve($machine);
就是这样简单:)
待办事项
添加更多文档:)