arcticlinux / scientist-chances-fractional
为 daylerees/scientist 的分数概率类
0.1.4
2023-02-02 22:27 UTC
Requires
- php: >=7.3
- daylerees/scientist: ^2.1.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-05 03:16:55 UTC
README
科学家分数概率
用于与 Scientist 库 一起使用的分数概率类
1. 安装
使用 Composer 安装 Scientist Chances Fractional 的最新版本。
composer require arcticlinux/scientist-chances-fractional
2. 使用方法
使用 FractionalChance 使实验仅以 1/100 的概率运行
$chance = new FractionalChance(); // Setting experiment to run 1%, 1/100 times, default 1 out of value sent to setProbability $chance->setProbability(100); // Explicitly setting probability to 1% or 1/100 chance $chance->setProbability(100, 1); $experiment = (new Scientist\Laboratory) ->experiment('experiment title') ->control($controlCallback) ->chance($chance) ->trial('trial name', $trialCallback) ->matcher($matcher);
使用 FractionalChance 使实验以 33.3%,1/3 的时间运行
$chance = new FractionalChance(); $chance->setProbability(3,1); $experiment = (new Scientist\Laboratory) ->experiment('experiment title') ->control($controlCallback) ->chance($chance) ->trial('trial name', $trialCallback) ->matcher($matcher);
