Skip to content

Commit 4dc21c0

Browse files
committed
symbol renames
1 parent a9cb979 commit 4dc21c0

38 files changed

Lines changed: 842 additions & 1512 deletions

Data_science/DataMining/DataMining/Clustering/HDBSCAN/Distance/CosineSimilarity.vb

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,63 @@
11
#Region "Microsoft.VisualBasic::8ecb413476b369d318c83ea59d28f6bc, Data_science\DataMining\DataMining\Clustering\HDBSCAN\Distance\CosineSimilarity.vb"
22

3-
' Author:
4-
'
5-
' asuka (amethyst.asuka@gcmodeller.org)
6-
' xie (genetics@smrucc.org)
7-
' xieguigang (xie.guigang@live.com)
8-
'
9-
' Copyright (c) 2018 GPL3 Licensed
10-
'
11-
'
12-
' GNU GENERAL PUBLIC LICENSE (GPL3)
13-
'
14-
'
15-
' This program is free software: you can redistribute it and/or modify
16-
' it under the terms of the GNU General Public License as published by
17-
' the Free Software Foundation, either version 3 of the License, or
18-
' (at your option) any later version.
19-
'
20-
' This program is distributed in the hope that it will be useful,
21-
' but WITHOUT ANY WARRANTY; without even the implied warranty of
22-
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23-
' GNU General Public License for more details.
24-
'
25-
' You should have received a copy of the GNU General Public License
26-
' along with this program. If not, see <http://www.gnu.org/licenses/>.
27-
28-
29-
30-
' /********************************************************************************/
31-
32-
' Summaries:
33-
34-
35-
' Code Statistics:
36-
37-
' Total Lines: 108
38-
' Code Lines: 86 (79.63%)
39-
' Comment Lines: 4 (3.70%)
40-
' - Xml Docs: 75.00%
41-
'
42-
' Blank Lines: 18 (16.67%)
43-
' File Size: 5.30 KB
44-
45-
46-
' Class CosineSimilarity
47-
'
48-
' Constructor: (+1 Overloads) Sub New
49-
' Function: (+2 Overloads) CalculateAndCacheMagnitude, (+2 Overloads) ComputeDistance, GetMostCommonDistanceValueForSparseMatrix
50-
'
51-
'
52-
' /********************************************************************************/
3+
' Author:
4+
'
5+
' asuka (amethyst.asuka@gcmodeller.org)
6+
' xie (genetics@smrucc.org)
7+
' xieguigang (xie.guigang@live.com)
8+
'
9+
' Copyright (c) 2018 GPL3 Licensed
10+
'
11+
'
12+
' GNU GENERAL PUBLIC LICENSE (GPL3)
13+
'
14+
'
15+
' This program is free software: you can redistribute it and/or modify
16+
' it under the terms of the GNU General Public License as published by
17+
' the Free Software Foundation, either version 3 of the License, or
18+
' (at your option) any later version.
19+
'
20+
' This program is distributed in the hope that it will be useful,
21+
' but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23+
' GNU General Public License for more details.
24+
'
25+
' You should have received a copy of the GNU General Public License
26+
' along with this program. If not, see <http://www.gnu.org/licenses/>.
27+
28+
29+
30+
' /********************************************************************************/
31+
32+
' Summaries:
33+
34+
35+
' Code Statistics:
36+
37+
' Total Lines: 108
38+
' Code Lines: 86 (79.63%)
39+
' Comment Lines: 4 (3.70%)
40+
' - Xml Docs: 75.00%
41+
'
42+
' Blank Lines: 18 (16.67%)
43+
' File Size: 5.30 KB
44+
45+
46+
' Class CosineSimilarity
47+
'
48+
' Constructor: (+1 Overloads) Sub New
49+
' Function: (+2 Overloads) CalculateAndCacheMagnitude, (+2 Overloads) ComputeDistance, GetMostCommonDistanceValueForSparseMatrix
50+
'
51+
'
52+
' /********************************************************************************/
5353

5454
#End Region
5555

56-
Imports System
5756
Imports System.Collections.Concurrent
58-
Imports System.Collections.Generic
59-
Imports stdNum = System.Math
57+
Imports std = System.Math
6058

6159
Namespace HDBSCAN.Distance
60+
6261
''' <summary>
6362
''' Computes cosine similarity between two points, d = 1 - ((X*Y) / (||X||*||Y||))
6463
''' </summary>
@@ -116,7 +115,7 @@ Namespace HDBSCAN.Distance
116115
i += 1
117116
End While
118117

119-
Dim lComputeDistance = stdNum.Max(0, 1 - dotProduct / stdNum.Sqrt(magnitudeOne * magnitudeTwo))
118+
Dim lComputeDistance = std.Max(0, 1 - dotProduct / std.Sqrt(magnitudeOne * magnitudeTwo))
120119
Return lComputeDistance
121120
End Function
122121

@@ -137,15 +136,15 @@ Namespace HDBSCAN.Distance
137136
Next
138137
End If
139138

140-
Return stdNum.Max(0, 1 - dotProduct / stdNum.Sqrt(magnitudeOne * magnitudeTwo))
139+
Return std.Max(0, 1 - dotProduct / std.Sqrt(magnitudeOne * magnitudeTwo))
141140
End Function
142141

143142
Private Function CalculateAndCacheMagnitude(index As Integer, attributes As Dictionary(Of Integer, Integer)) As Double
144143
Dim hasValueValue As (hasValue As Boolean, value As Double) = Nothing
145144
hasValueValue = _tryGet(index)
146145
If hasValueValue.hasValue Then Return hasValueValue.value
147146

148-
Dim magnitude = attributes.Keys.Sum(Function(i) stdNum.Pow(attributes(i), 2))
147+
Dim magnitude = attributes.Keys.Sum(Function(i) std.Pow(attributes(i), 2))
149148
_tryAdd(index, magnitude)
150149
Return magnitude
151150
End Function
@@ -155,7 +154,7 @@ Namespace HDBSCAN.Distance
155154
hasValueValue = _tryGet(index)
156155
If hasValueValue.hasValue Then Return hasValueValue.value
157156

158-
Dim magnitude = attributes.Sum(Function(val) stdNum.Pow(val, 2))
157+
Dim magnitude = attributes.Sum(Function(val) std.Pow(val, 2))
159158
_tryAdd(index, magnitude)
160159
Return magnitude
161160
End Function
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
#Region "Microsoft.VisualBasic::8a3335ba8382060b67ee54ecd9eb0a78, Data_science\DataMining\DataMining\Clustering\HDBSCAN\Distance\EuclideanDistance.vb"
22

3-
' Author:
4-
'
5-
' asuka (amethyst.asuka@gcmodeller.org)
6-
' xie (genetics@smrucc.org)
7-
' xieguigang (xie.guigang@live.com)
8-
'
9-
' Copyright (c) 2018 GPL3 Licensed
10-
'
11-
'
12-
' GNU GENERAL PUBLIC LICENSE (GPL3)
13-
'
14-
'
15-
' This program is free software: you can redistribute it and/or modify
16-
' it under the terms of the GNU General Public License as published by
17-
' the Free Software Foundation, either version 3 of the License, or
18-
' (at your option) any later version.
19-
'
20-
' This program is distributed in the hope that it will be useful,
21-
' but WITHOUT ANY WARRANTY; without even the implied warranty of
22-
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23-
' GNU General Public License for more details.
24-
'
25-
' You should have received a copy of the GNU General Public License
26-
' along with this program. If not, see <http://www.gnu.org/licenses/>.
3+
' Author:
4+
'
5+
' asuka (amethyst.asuka@gcmodeller.org)
6+
' xie (genetics@smrucc.org)
7+
' xieguigang (xie.guigang@live.com)
8+
'
9+
' Copyright (c) 2018 GPL3 Licensed
10+
'
11+
'
12+
' GNU GENERAL PUBLIC LICENSE (GPL3)
13+
'
14+
'
15+
' This program is free software: you can redistribute it and/or modify
16+
' it under the terms of the GNU General Public License as published by
17+
' the Free Software Foundation, either version 3 of the License, or
18+
' (at your option) any later version.
19+
'
20+
' This program is distributed in the hope that it will be useful,
21+
' but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23+
' GNU General Public License for more details.
24+
'
25+
' You should have received a copy of the GNU General Public License
26+
' along with this program. If not, see <http://www.gnu.org/licenses/>.
2727

2828

2929

30-
' /********************************************************************************/
30+
' /********************************************************************************/
3131

32-
' Summaries:
32+
' Summaries:
3333

3434

35-
' Code Statistics:
35+
' Code Statistics:
3636

37-
' Total Lines: 20
38-
' Code Lines: 15 (75.00%)
39-
' Comment Lines: 3 (15.00%)
40-
' - Xml Docs: 100.00%
41-
'
42-
' Blank Lines: 2 (10.00%)
43-
' File Size: 895 B
37+
' Total Lines: 20
38+
' Code Lines: 15 (75.00%)
39+
' Comment Lines: 3 (15.00%)
40+
' - Xml Docs: 100.00%
41+
'
42+
' Blank Lines: 2 (10.00%)
43+
' File Size: 895 B
4444

4545

46-
' Class EuclideanDistance
47-
'
48-
' Function: ComputeDistance
49-
'
50-
'
51-
' /********************************************************************************/
46+
' Class EuclideanDistance
47+
'
48+
' Function: ComputeDistance
49+
'
50+
'
51+
' /********************************************************************************/
5252

5353
#End Region
5454

55-
Imports stdNum = System.Math
55+
Imports std = System.Math
5656

5757
Namespace HDBSCAN.Distance
5858
''' <summary>
@@ -68,7 +68,7 @@ Namespace HDBSCAN.Distance
6868
distance += (attributesOne(i) - attributesTwo(i)) * (attributesOne(i) - attributesTwo(i))
6969
i += 1
7070
End While
71-
Return stdNum.Sqrt(distance)
71+
Return std.Sqrt(distance)
7272
End Function
7373
End Class
7474
End Namespace

Data_science/DataMining/DataMining/Clustering/HDBSCAN/Distance/ManhattanDistance.vb

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
#Region "Microsoft.VisualBasic::89ba23ef83e45034d62aad9f11bf22ae, Data_science\DataMining\DataMining\Clustering\HDBSCAN\Distance\ManhattanDistance.vb"
22

3-
' Author:
4-
'
5-
' asuka (amethyst.asuka@gcmodeller.org)
6-
' xie (genetics@smrucc.org)
7-
' xieguigang (xie.guigang@live.com)
8-
'
9-
' Copyright (c) 2018 GPL3 Licensed
10-
'
11-
'
12-
' GNU GENERAL PUBLIC LICENSE (GPL3)
13-
'
14-
'
15-
' This program is free software: you can redistribute it and/or modify
16-
' it under the terms of the GNU General Public License as published by
17-
' the Free Software Foundation, either version 3 of the License, or
18-
' (at your option) any later version.
19-
'
20-
' This program is distributed in the hope that it will be useful,
21-
' but WITHOUT ANY WARRANTY; without even the implied warranty of
22-
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23-
' GNU General Public License for more details.
24-
'
25-
' You should have received a copy of the GNU General Public License
26-
' along with this program. If not, see <http://www.gnu.org/licenses/>.
3+
' Author:
4+
'
5+
' asuka (amethyst.asuka@gcmodeller.org)
6+
' xie (genetics@smrucc.org)
7+
' xieguigang (xie.guigang@live.com)
8+
'
9+
' Copyright (c) 2018 GPL3 Licensed
10+
'
11+
'
12+
' GNU GENERAL PUBLIC LICENSE (GPL3)
13+
'
14+
'
15+
' This program is free software: you can redistribute it and/or modify
16+
' it under the terms of the GNU General Public License as published by
17+
' the Free Software Foundation, either version 3 of the License, or
18+
' (at your option) any later version.
19+
'
20+
' This program is distributed in the hope that it will be useful,
21+
' but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23+
' GNU General Public License for more details.
24+
'
25+
' You should have received a copy of the GNU General Public License
26+
' along with this program. If not, see <http://www.gnu.org/licenses/>.
2727

2828

2929

30-
' /********************************************************************************/
30+
' /********************************************************************************/
3131

32-
' Summaries:
32+
' Summaries:
3333

3434

35-
' Code Statistics:
35+
' Code Statistics:
3636

37-
' Total Lines: 20
38-
' Code Lines: 15 (75.00%)
39-
' Comment Lines: 3 (15.00%)
40-
' - Xml Docs: 100.00%
41-
'
42-
' Blank Lines: 2 (10.00%)
43-
' File Size: 840 B
37+
' Total Lines: 20
38+
' Code Lines: 15 (75.00%)
39+
' Comment Lines: 3 (15.00%)
40+
' - Xml Docs: 100.00%
41+
'
42+
' Blank Lines: 2 (10.00%)
43+
' File Size: 840 B
4444

4545

46-
' Class ManhattanDistance
47-
'
48-
' Function: ComputeDistance
49-
'
50-
'
51-
' /********************************************************************************/
46+
' Class ManhattanDistance
47+
'
48+
' Function: ComputeDistance
49+
'
50+
'
51+
' /********************************************************************************/
5252

5353
#End Region
5454

55-
Imports stdNum = System.Math
55+
Imports std = System.Math
5656

5757
Namespace HDBSCAN.Distance
5858
''' <summary>
@@ -65,7 +65,7 @@ Namespace HDBSCAN.Distance
6565
Dim i = 0
6666

6767
While i < attributesOne.Length AndAlso i < attributesTwo.Length
68-
distance += stdNum.Abs(attributesOne(i) - attributesTwo(i))
68+
distance += std.Abs(attributesOne(i) - attributesTwo(i))
6969
i += 1
7070
End While
7171
Return distance

0 commit comments

Comments
 (0)