distclassipy 0.0.1__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.
- distclassipy/__init__.py +2 -0
- distclassipy/classifier.py +282 -0
- distclassipy/distances.py +926 -0
- distclassipy-0.0.1.dist-info/LICENSE +674 -0
- distclassipy-0.0.1.dist-info/METADATA +21 -0
- distclassipy-0.0.1.dist-info/RECORD +11 -0
- distclassipy-0.0.1.dist-info/WHEEL +5 -0
- distclassipy-0.0.1.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/test_classifier.py +60 -0
- tests/test_distances.py +2 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: distclassipy
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A python package for a distance-based classifier which can use several different distance metrics.
|
|
5
|
+
Home-page: https://github.com/sidchaini/DistClassiPy
|
|
6
|
+
Author: Siddharth Chaini
|
|
7
|
+
Author-email: sidchaini@gmail.com
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Requires-Dist: pandas
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: sklearn
|
|
19
|
+
|
|
20
|
+
# DistClassiPy
|
|
21
|
+
A python package for a distance-based classifier which can use several different distance metrics.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
distclassipy/__init__.py,sha256=1RXFX6RkKI9-pfcVXnHJgg-z-6dXC0gWekbzdsjYHss,208
|
|
2
|
+
distclassipy/classifier.py,sha256=1_L6MTmQGzWMPXm363F6HU31wDD3U7_3cDL-oluFE6o,12658
|
|
3
|
+
distclassipy/distances.py,sha256=L2I9RK7JCvR-2HXyZhUZtf1wEipG9N5lcio1IOW9XLs,34004
|
|
4
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
tests/test_classifier.py,sha256=ihimWr-mGUqjvsC4Jc9m0hZlUlsc8vpbxONF0__TvOQ,1724
|
|
6
|
+
tests/test_distances.py,sha256=daEdpEyAJIa8b2VkCqSKcw8PaExcB6Qro80XNes_sHA,2
|
|
7
|
+
distclassipy-0.0.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
8
|
+
distclassipy-0.0.1.dist-info/METADATA,sha256=yXL3uWcty7WpWEodrHp6zHrsykFKacRYyDmOjEcHO9I,789
|
|
9
|
+
distclassipy-0.0.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
10
|
+
distclassipy-0.0.1.dist-info/top_level.txt,sha256=AgabaGERHX1imAdPNtgTGDHYUFByjwCagQXapwG__jc,19
|
|
11
|
+
distclassipy-0.0.1.dist-info/RECORD,,
|
tests/__init__.py
ADDED
|
File without changes
|
tests/test_classifier.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
import numpy as np
|
|
3
|
+
from distclassipy import classifier
|
|
4
|
+
|
|
5
|
+
class TestClassifier(unittest.TestCase):
|
|
6
|
+
"""
|
|
7
|
+
Unit test for the Classifier class.
|
|
8
|
+
"""
|
|
9
|
+
def setUp(self):
|
|
10
|
+
"""
|
|
11
|
+
Set up the test case.
|
|
12
|
+
"""
|
|
13
|
+
self.clf = classifier.Classifier()
|
|
14
|
+
|
|
15
|
+
def test_fit(self):
|
|
16
|
+
"""
|
|
17
|
+
Test the fit method of the Classifier class.
|
|
18
|
+
"""
|
|
19
|
+
X = np.array([[1, 2], [3, 4], [5, 6]])
|
|
20
|
+
y = np.array([0, 1, 0])
|
|
21
|
+
self.clf.fit(X, y)
|
|
22
|
+
self.assertEqual(self.clf.X_.tolist(), X.tolist())
|
|
23
|
+
self.assertEqual(self.clf.y_.tolist(), y.tolist())
|
|
24
|
+
|
|
25
|
+
def test_predict(self):
|
|
26
|
+
"""
|
|
27
|
+
Test the predict method of the Classifier class.
|
|
28
|
+
"""
|
|
29
|
+
X = np.array([[1, 2], [3, 4], [5, 6]])
|
|
30
|
+
y = np.array([0, 1, 0])
|
|
31
|
+
self.clf.fit(X, y)
|
|
32
|
+
predictions = self.clf.predict(X)
|
|
33
|
+
self.assertEqual(predictions.tolist(), y.tolist())
|
|
34
|
+
|
|
35
|
+
def test_predict_and_analyse(self):
|
|
36
|
+
"""
|
|
37
|
+
Test the predict_and_analyse method of the Classifier class.
|
|
38
|
+
"""
|
|
39
|
+
X = np.array([[1, 2], [3, 4], [5, 6]])
|
|
40
|
+
y = np.array([0, 1, 0])
|
|
41
|
+
self.clf.fit(X, y)
|
|
42
|
+
analysis = self.clf.predict_and_analyse(X)
|
|
43
|
+
self.assertIsInstance(analysis, dict)
|
|
44
|
+
|
|
45
|
+
def test_calculate_confidence(self):
|
|
46
|
+
"""
|
|
47
|
+
Test the calculate_confidence method of the Classifier class.
|
|
48
|
+
"""
|
|
49
|
+
X = np.array([[1, 2], [3, 4], [5, 6]])
|
|
50
|
+
y = np.array([0, 1, 0])
|
|
51
|
+
self.clf.fit(X, y)
|
|
52
|
+
confidence = self.clf.calculate_confidence(X)
|
|
53
|
+
self.assertIsInstance(confidence, np.ndarray)
|
|
54
|
+
|
|
55
|
+
if __name__ == '__main__':
|
|
56
|
+
"""
|
|
57
|
+
Main entry point for the test module.
|
|
58
|
+
"""
|
|
59
|
+
unittest.main()
|
|
60
|
+
|
tests/test_distances.py
ADDED