我正在使用A / B拆分测试,并且正在使用此库: https://github.com/namshi/AB
每个测试都会生成一个种子,该种子会告诉AB测试人员要使用哪些参数。
假设我要使用不同的变量(例如背景色,结帐按钮颜色,文本等)来获得最佳的结帐页面转换率。
哪种算法将获得具有最佳转换率的种子?
我尝试过的事情:
我已经编写的代码:
public function conversionTest()
{
// Store successful conversion to $seeds arr
$seeds = [];
// Run 200 "conversions"
for ($i = 0; $i < 200; $i++) {
// Initialize seed container
$container = $this->initializeSeedArr($seeds);
// Random seed test
$randomSeed = new Test('random-seed', $container);
// Get seed
$seed = $randomSeed->getVariation();
// Push to $seeds as "successful conversion"
$seeds[] = $seed;
}
dd($container);
}
private function initializeSeedArr($container)
{
$arr = [];
$count = count($container);
// Add random seed with 10% "weight" of container count
$arr[$this->randomSeed()] = $this->getSeedWeight($count);
// Add rest of the seeds
for ($i = 0; $i < count($container); $i++) {
// Get current seed
$seed = $container[$i];
// If multiple conversion add more weight to current seed
$arr[$seed] = isset($arr[$seed]) ? $arr[$seed] + 1 : 1;
}
return $arr;
}
private function randomSeed()
{
return mt_rand();
}
private function getSeedWeight($count)
{
$round = (int)round($count * 0.1);
$round = $round < 1 ? 1 : $round;
return $round;
}
这种方法存在问题,这就是大多数结果的样子。
array:21 [▼
1641197740 => 20
1787918404 => 155
2108274654 => 1
667244174 => 7
1296436374 => 3
213433208 => 4
450097167 => 4
465517336 => 1
1071877664 => 1
1430346867 => 6
444753032 => 2
1802187446 => 3
1937663980 => 2
315179639 => 2
2067012650 => 1
717546160 => 1
160677944 => 1
822938190 => 2
553738679 => 1
20707768 => 1
932884407 => 1
]
排在最前面的种子获得了大多数“转化”,并且具有最大的权重,添加并测试了新种子,但随着更多的转化开始涌入第一批种子,它们就没有任何分量。因此,从长远来看,这并不是一个很好的解决方案。
您将如何做?