mdod 2.0.0__py3-none-any.whl → 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mdod-2.0.0.dist-info → mdod-3.0.0.dist-info}/METADATA +7 -49
- mdod-3.0.0.dist-info/RECORD +5 -0
- mdod-3.0.0.dist-info/top_level.txt +1 -0
- mdod/__init__.py +0 -5
- mdod/mdod.py +0 -55
- mdod-2.0.0.dist-info/RECORD +0 -7
- mdod-2.0.0.dist-info/top_level.txt +0 -1
- {mdod-2.0.0.dist-info → mdod-3.0.0.dist-info}/LICENSE.txt +0 -0
- {mdod-2.0.0.dist-info → mdod-3.0.0.dist-info}/WHEEL +0 -0
@@ -1,12 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: mdod
|
3
|
-
Version:
|
3
|
+
Version: 3.0.0
|
4
4
|
Summary: MDOD, Multi-Dimensional data Outlier Detection
|
5
5
|
Home-page: https://github.com/mddod/mdod
|
6
6
|
Author: Z Shen
|
7
7
|
Author-email: 626456708@qq.com
|
8
8
|
License: BSD 3-Clause License
|
9
|
-
Platform: UNKNOWN
|
10
9
|
Classifier: Development Status :: 5 - Production/Stable
|
11
10
|
Classifier: Intended Audience :: Developers
|
12
11
|
Classifier: Programming Language :: Python
|
@@ -15,17 +14,20 @@ Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE.txt
|
16
15
|
|
17
16
|
# mdod
|
17
|
+
|
18
18
|
MDOD, Multi-Dimensional data Outlier Detection
|
19
19
|
|
20
20
|
Python library for Multi-Dimensional data Outlier/Anomaly Detection algorithm.
|
21
21
|
|
22
|
-
# MDOD paper
|
23
|
-
|
22
|
+
# MDOD paper
|
23
|
+
|
24
|
+
MDOD paper is published in ICAIIC 2024 as title "Outlier Detect using Vector Cosine Similarity by Adding a Dimension"
|
24
25
|
|
25
26
|
https://doi.org/10.1109/ICAIIC60209.2024.10463442
|
26
27
|
|
27
28
|
# Installation:
|
28
|
-
|
29
|
+
|
30
|
+
pip install mdod
|
29
31
|
|
30
32
|
or
|
31
33
|
|
@@ -36,52 +38,8 @@ cd mdod
|
|
36
38
|
python setup.py install
|
37
39
|
|
38
40
|
# usage example:
|
39
|
-
import numpy as np
|
40
|
-
|
41
|
-
import mdod
|
42
|
-
|
43
|
-
localFile = 'TestDataset.txt'
|
44
|
-
|
45
|
-
dets= np.loadtxt(localFile,delimiter=',')
|
46
|
-
|
47
|
-
nd = 1
|
48
|
-
|
49
|
-
sn = 15
|
50
|
-
|
51
|
-
result = mdod.md(dets,nd,sn)
|
52
|
-
|
53
|
-
print (result)
|
54
|
-
|
55
|
-
# TestDataset.txt format:
|
56
|
-
data1,data2,data3,data4,data5,data6
|
57
|
-
|
58
|
-
data1,data2,data3,data4,data5,data6
|
59
|
-
|
60
|
-
data1,data2,data3,data4,data5,data6
|
61
|
-
|
62
|
-
...
|
63
|
-
|
64
|
-
# dets format:
|
65
|
-
[[data1 data2 data3 data4 data5 data6]
|
66
|
-
|
67
|
-
[data1 data2 data3 data4 data5 data6]
|
68
|
-
|
69
|
-
[data1 data2 data3 data4 data5 data6]
|
70
|
-
|
71
|
-
...]
|
72
|
-
|
73
|
-
# result format:
|
74
|
-
[value1, '[data1 data2 data3 data4 data5 data6]', '0']
|
75
|
-
|
76
|
-
[value2, '[data1 data2 data3 data4 data5 data6]', '1']
|
77
|
-
|
78
|
-
[value3, '[data1 data2 data3 data4 data5 data6]', '2']
|
79
|
-
|
80
|
-
...
|
81
41
|
|
82
|
-
# file exampls:
|
83
42
|
Please visit https://github.com/mddod/mdod, or https://mddod.github.io/
|
84
43
|
|
85
|
-
|
86
44
|
|
87
45
|
|
@@ -0,0 +1,5 @@
|
|
1
|
+
mdod-3.0.0.dist-info/LICENSE.txt,sha256=7ToR4JRGCu-ZhydtQcKP7V_h7tesBPP2RAoQM6lfwpk,1492
|
2
|
+
mdod-3.0.0.dist-info/METADATA,sha256=b3vwMKHC7RkQ7qtOC3eBzoosElrkCLb9J6CmoTnRCms,1055
|
3
|
+
mdod-3.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
4
|
+
mdod-3.0.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
5
|
+
mdod-3.0.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
|
mdod/__init__.py
DELETED
mdod/mdod.py
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
import numpy as np
|
2
|
-
|
3
|
-
def md(detections, norm_distance, top_n):
|
4
|
-
"""
|
5
|
-
Calculate the vector cosine similarity score and return the sum of the first top_n scores of each vector.
|
6
|
-
|
7
|
-
Args:
|
8
|
-
detections: Array data
|
9
|
-
norm_distance: Standardized distance value (scalar) in the new dimension
|
10
|
-
top_n: The number of highest similarity scores retained
|
11
|
-
|
12
|
-
Returns:
|
13
|
-
List of [score_sum, original_vector, index]
|
14
|
-
"""
|
15
|
-
# Input verification: check whether detections is empty or whether top_n is valid
|
16
|
-
if detections is None or detections.size == 0 or top_n <= 0:
|
17
|
-
return []
|
18
|
-
|
19
|
-
# Make sure the input is a NumPy array
|
20
|
-
dets_array = np.array(detections, dtype=float)
|
21
|
-
n_samples, n_features = dets_array.shape
|
22
|
-
|
23
|
-
# Precomputed constant term
|
24
|
-
nd_squared = norm_distance ** 2
|
25
|
-
denominator_left = norm_distance
|
26
|
-
|
27
|
-
# Result storage
|
28
|
-
result_list = []
|
29
|
-
|
30
|
-
# Vectorize each vector
|
31
|
-
for i in range(n_samples):
|
32
|
-
current_vector = dets_array[i]
|
33
|
-
|
34
|
-
# Calculate the sum of squares of the difference between all vectors and the current vector
|
35
|
-
diff = dets_array - current_vector
|
36
|
-
diff_squared_sum = np.sum(diff ** 2, axis=1)
|
37
|
-
|
38
|
-
# Calculate the right part of the denominator
|
39
|
-
denominator_right = np.sqrt(diff_squared_sum + nd_squared)
|
40
|
-
denominator = denominator_left * denominator_right
|
41
|
-
|
42
|
-
# Calculate the molecule
|
43
|
-
numerator = nd_squared * np.ones(n_samples)
|
44
|
-
|
45
|
-
# Calculate the similarity score and avoid dividing by zero
|
46
|
-
similarity_scores = np.where(denominator == 0, 0, numerator / denominator)
|
47
|
-
similarity_scores[i] = -np.inf
|
48
|
-
|
49
|
-
# Get the sum of the top_n scores
|
50
|
-
top_scores_sum = np.sum(np.partition(similarity_scores, -top_n)[-top_n:])
|
51
|
-
|
52
|
-
# Save result
|
53
|
-
result_list.append([top_scores_sum, detections[i].tolist(), i])
|
54
|
-
|
55
|
-
return result_list
|
mdod-2.0.0.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
mdod/__init__.py,sha256=Za_ZM6LquGiu3NYA4UQORA-etiQKDfJ1asE7-SJlTNA,71
|
2
|
-
mdod/mdod.py,sha256=d99OTmnXUuIVRVz5HyiM_N8CsQicEL-Y2eCZL3Bssyg,2044
|
3
|
-
mdod-2.0.0.dist-info/LICENSE.txt,sha256=7ToR4JRGCu-ZhydtQcKP7V_h7tesBPP2RAoQM6lfwpk,1492
|
4
|
-
mdod-2.0.0.dist-info/METADATA,sha256=H0fC8nJs5zyT3Ec1pRJ-Pw0xelMDMGV1jMLmiUKE1BA,1776
|
5
|
-
mdod-2.0.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
mdod-2.0.0.dist-info/top_level.txt,sha256=wc3s5DwL33MzLW72ABBR4vg36euFZNFKFD51Og1hnAY,5
|
7
|
-
mdod-2.0.0.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
mdod
|
File without changes
|
File without changes
|