affinityMatrix: Calculate the similarity matrix

Description Usage Arguments Value Author(s) Examples

View source: R/affinityMatrix.R

Description

To calculate the similarity matrix with the same method in package M2SMF, for asymmetric case

Usage

1
affinityMatrix(Diff, K = 20, sigma = 0.5)

Arguments

Diff

The distance matrix to culculate the similarity

K

The number of neighbours to culculate the similarity

sigma

A hyper-parameter to culculate the similarity

Value

The similarity matrix

Author(s)

Xiaoyao Yin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
data1 <- matrix(0,100,100)
data2 <- matrix(0,80,100)
for (i in 1:20)
{
  data1[i,] <- rnorm(100,10,1)
}
for (i in 21:40)
{
  data1[i,] <- rnorm(100,20,1)
}
for (i in 41:60)
{
  data1[i,] <- rnorm(100,30,1)
}
for (i in 61:80)
{
  data1[i,] <- rnorm(100,40,1)
}
for (i in 81:100)
{
  data1[i,] <- rnorm(100,50,1)
}
for (i in 1:20)
{
  data2[i,] <- rnorm(100,5,1)
}
for (i in 21:40)
{
  data2[i,] <- rnorm(100,10,1)
}
for (i in 41:60)
{
  data2[i,] <- rnorm(100,15,1)
}
for (i in 61:80)
{
  data2[i,] <- rnorm(100,20,1)
}
new_data1 <- Standard_Normalization(data1)
new_data2 <- Standard_Normalization(data2)
Diff <- dist2eu(new_data1,new_data2)
simi_matr1 <- affinityMatrix(Diff, K = 20, sigma = 0.5)

OSNMTF documentation built on Dec. 1, 2019, 1:22 a.m.