我有一個數據,包括不同的類型: a <- data.frame(x=c("a","b","b","c","c","c","d","d","e","f"),y=c(1,2,2,2,3,1,4,7,10,2),m=c("a","d","ab","ac","ac","vc","ed","ed","e","df"),n=c(2,1,5,3,3,2,8,10,10,1))
實際上,該數據比這更復雜,可能
我有一個矩陣X,我試圖用KNN和皮爾遜相關性度量。是否有可能使用皮爾遜相關性作爲sklearn度量標準?我已經試過這樣的事情: def pearson_calc(M):
P = (1 - np.array([[pearsonr(a,b)[0] for a in M] for b in M]))
return P
nbrs = NearestNeighbors(n_neigh