如何在php中实现调整后的余弦相似度?

时间:2017-12-22 07:07:53

标签: php cosine-similarity

当我尝试在PHP中实现调整后的余弦算法时,我有点困惑,所以在我问这个问题之前,这是我的表。

  

手动评级表

SELECT
    Application_id
FROM yourTable
GROUP BY
    Application_id
HAVING
    SUM(CASE WHEN username='a-pri' AND status='ACTIVE' THEN 1 ELSE 0 END) = 1 AND
    SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) = 1;
  

数据库中的评级表

==========================================================
|       | Item A    | Item B    | Item C    | Average    |
==========================================================
|User 1 | -         | 5         | 4         | 4.5        |
|User 2 | 4         | -         | 3         | 3.5        |
|User 3 | 2         | 2         | 2         | 3          |
==========================================================

然后,我有一个手动计算,我想更改为PHP代码。

the image

然后我的问题,如何在PHP代码中实现该计算?

0 个答案:

没有答案