我有一个这样的数据集(大尺寸)
id_brand id_member
1 100
2 105
1 106
3 100
,我想计算不同品牌之间的余弦相似度。 公式如下
{\ displaystyle \ cos \ theta = {\ frac {\ mathbf {A} \ cdot \ mathbf {B}} {| \ mathbf {A} || \ mathbf {B} |}}}。
我试图在pyspark中使用,但是它很复杂,所以我想在sql(redhisft)中进行操作,但是我不知道要这样做。
谢谢