gpt4 book ai didi

php - 在数据集中找到最真实的市场平均价格的算法

转载 作者:可可西里 更新时间:2023-10-31 23:07:32 25 4
gpt4 key购买 nike

我有什么:

  • 用户在拍卖网站上出售 foobars。
  • 每个 foobar 都是相同的。
  • foobar 的价格由用户决定。
  • 我将废弃每个价目表以形成如下所示的数据集:
    $prices = ('foobar' => [12.34, 15.22, 14.18, 20.55, 9.50]);

我需要什么:

  • 找到每天、每周、每月的实际平均市场价格。

我遇到的问题:

  • 由于数据存在偏差,事实证明异常值拒绝法效果不佳。
  • 用户极不可能以低于平均市场价格的价格进行拍卖,因为这是无法撤销的。即使它远低于市场价格,这种情况也很少发生,因此不会影响整体平均水平。但是,用户试图抬高价格的可能性更大,而且发生的频率足以影响实际的平均市场值(value)。

我想我会怎么做:

Daniel Collicott:

if I understand you correctly, you want to calculate the optimal selling value of an item. (or are you trying to calculate the real value??)

Sellers are quite naturally gaming (e.g. ebay), trying to maximize their profits.

For this reason, I'd would avoid average/SD approaches: they are too sensitive to outliers created by particular selling tactics.

Game-theory-wise, I think clever sellers would estimate the highest likely selling price (maximal profits) by researching their competitors and their historical sales output: to find the sweet spot.

For this reason I would record a histogram of historical prices over all sellers and look at the distribution of prices, using something approaching the mode to determine the optimal price i.e. the most common sale price. Better still, I would weigh prices by the profit (proportional to historical sales volume) of each individual seller.

I suspect this would be nearer to your optimal market value; if you are looking for the real market value then comment below or contact me at my machine learning firm

我的问题:

  • 对@Daniel Collicott 的帖子中提到的内容的更详细解释:

    -->最佳卖价
    --> 实际售价
    --> 两者的算法

最佳答案

使用平均值标准差,您的第一个问题非常简单:

$prices = array
(
'bar' => array(12.34, 102.55),
'foo' => array(12.34, 15.66, 102.55, 134.66),
'foobar' => array(12.34, 15.22, 14.18, 20.55, 99.50, 15.88, 16.99, 102.55),
);

foreach ($prices as $item => $bids)
{
$average = call_user_func_array('Average', $bids);
$standardDeviation = call_user_func_array('standardDeviation', $bids);

foreach ($bids as $key => $bid)
{
if (($bid < ($average - $standardDeviation)) || ($bid > ($average + $standardDeviation)))
{
unset($bids[$key]);
}
}

$prices[$item] = $bids;
}

print_r($prices);

基本上,您只需删除低于 avg - stDev 或高于 avg + stDev 的出价。


以及实际功能(移植自 my framework ):

function Average()
{
if (count($arguments = func_get_args()) > 0)
{
return array_sum($arguments) / count($arguments);
}

return 0;
}

function standardDeviation()
{
if (count($arguments = func_get_args()) > 0)
{
$result = call_user_func_array('Average', $arguments);

foreach ($arguments as $key => $value)
{
$arguments[$key] = pow($value - $result, 2);
}

return sqrt(call_user_func_array('Average', $arguments));
}

return 0;
}

输出(demo):

Array
(
[bar] => Array
(
[0] => 12.34
[1] => 102.55
)

[foo] => Array
(
[1] => 15.66
[2] => 102.55
)

[foobar] => Array
(
[0] => 12.34
[1] => 15.22
[2] => 14.18
[3] => 20.55
[5] => 15.88
[6] => 16.99
)
)

关于php - 在数据集中找到最真实的市场平均价格的算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10376988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com