ItemStudy/main.py

33 lines
530 B
Python
Raw Normal View History

import file_load
2024-05-13 20:50:01 +00:00
import json
import os
2024-05-13 20:50:01 +00:00
import numpy
# file_load.make_data()
similarity = file_load.similarity()
corelation = file_load.corelation()
table = {}
for i in corelation:
table[i["from"],i["to"]]=i["psr"]
x=[]
y=[]
2024-05-13 20:50:01 +00:00
for i in similarity:
x.append(abs(table[i["from"],i["to"]]))
y.append(i["similarity"])
print(numpy.corrcoef(x,y)[0,1])
s="similarity, corelation\n"
for i in similarity:
s+=str(i["similarity"])+','+str(table[i["from"],i["to"]])+'\n'
with open("Temp/point.csv","w") as point:
point.write(s)