distclassipy 0.1.5__tar.gz → 0.1.6a0__tar.gz
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-0.1.5 → distclassipy-0.1.6a0}/PKG-INFO +18 -15
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/README.md +17 -14
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy/__init__.py +1 -1
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy/classifier.py +55 -7
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy.egg-info/PKG-INFO +18 -15
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/LICENSE +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy/distances.py +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy.egg-info/SOURCES.txt +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy.egg-info/dependency_links.txt +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy.egg-info/requires.txt +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/distclassipy.egg-info/top_level.txt +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/pyproject.toml +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/setup.cfg +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/setup.py +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/tests/test_classifier.py +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/tests/test_distances.py +0 -0
- {distclassipy-0.1.5 → distclassipy-0.1.6a0}/tests/test_distances_prop.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: distclassipy
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6a0
|
|
4
4
|
Summary: A python package for a distance-based classifier which can use several different distance metrics.
|
|
5
5
|
Author-email: Siddharth Chaini <sidchaini@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -765,27 +765,30 @@ DistClassiPy is released under the [GNU General Public License v3.0](https://www
|
|
|
765
765
|
## Citation
|
|
766
766
|
|
|
767
767
|
If you use DistClassiPy in your research or project, please consider citing the paper:
|
|
768
|
-
> Chaini, S., Mahabal, A., Kembhavi, A., & Bianco, F. B. (2024). Light Curve Classification with DistClassiPy: a new distance-based classifier.
|
|
768
|
+
> Chaini, S., Mahabal, A., Kembhavi, A., & Bianco, F. B. (2024). Light Curve Classification with DistClassiPy: a new distance-based classifier. Astronomy and Computing. https://doi.org/10.1016/j.ascom.2024.100850.
|
|
769
769
|
|
|
770
770
|
### Bibtex
|
|
771
771
|
|
|
772
772
|
|
|
773
773
|
```bibtex
|
|
774
|
-
@ARTICLE{
|
|
775
|
-
author = {{Chaini},
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
774
|
+
@ARTICLE{2024A&C....4800850C,
|
|
775
|
+
author = {{Chaini}, S. and {Mahabal}, A. and {Kembhavi}, A. and {Bianco}, F.~B.},
|
|
776
|
+
title = "{Light curve classification with DistClassiPy: A new distance-based classifier}",
|
|
777
|
+
journal = {Astronomy and Computing},
|
|
778
|
+
keywords = {Variable stars (1761), Astronomy data analysis (1858), Open source software (1866), Astrostatistics (1882), Classification (1907), Light curve classification (1954), Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Solar and Stellar Astrophysics, Computer Science - Machine Learning},
|
|
779
|
+
year = 2024,
|
|
780
|
+
month = jul,
|
|
781
|
+
volume = {48},
|
|
782
|
+
eid = {100850},
|
|
783
|
+
pages = {100850},
|
|
784
|
+
doi = {10.1016/j.ascom.2024.100850},
|
|
785
|
+
archivePrefix = {arXiv},
|
|
784
786
|
eprint = {2403.12120},
|
|
785
|
-
|
|
786
|
-
adsurl = {https://ui.adsabs.harvard.edu/abs/
|
|
787
|
-
|
|
787
|
+
primaryClass = {astro-ph.IM},
|
|
788
|
+
adsurl = {https://ui.adsabs.harvard.edu/abs/2024A&C....4800850C},
|
|
789
|
+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
788
790
|
}
|
|
791
|
+
|
|
789
792
|
```
|
|
790
793
|
|
|
791
794
|
|
|
@@ -65,27 +65,30 @@ DistClassiPy is released under the [GNU General Public License v3.0](https://www
|
|
|
65
65
|
## Citation
|
|
66
66
|
|
|
67
67
|
If you use DistClassiPy in your research or project, please consider citing the paper:
|
|
68
|
-
> Chaini, S., Mahabal, A., Kembhavi, A., & Bianco, F. B. (2024). Light Curve Classification with DistClassiPy: a new distance-based classifier.
|
|
68
|
+
> Chaini, S., Mahabal, A., Kembhavi, A., & Bianco, F. B. (2024). Light Curve Classification with DistClassiPy: a new distance-based classifier. Astronomy and Computing. https://doi.org/10.1016/j.ascom.2024.100850.
|
|
69
69
|
|
|
70
70
|
### Bibtex
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
```bibtex
|
|
74
|
-
@ARTICLE{
|
|
75
|
-
author = {{Chaini},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
@ARTICLE{2024A&C....4800850C,
|
|
75
|
+
author = {{Chaini}, S. and {Mahabal}, A. and {Kembhavi}, A. and {Bianco}, F.~B.},
|
|
76
|
+
title = "{Light curve classification with DistClassiPy: A new distance-based classifier}",
|
|
77
|
+
journal = {Astronomy and Computing},
|
|
78
|
+
keywords = {Variable stars (1761), Astronomy data analysis (1858), Open source software (1866), Astrostatistics (1882), Classification (1907), Light curve classification (1954), Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Solar and Stellar Astrophysics, Computer Science - Machine Learning},
|
|
79
|
+
year = 2024,
|
|
80
|
+
month = jul,
|
|
81
|
+
volume = {48},
|
|
82
|
+
eid = {100850},
|
|
83
|
+
pages = {100850},
|
|
84
|
+
doi = {10.1016/j.ascom.2024.100850},
|
|
85
|
+
archivePrefix = {arXiv},
|
|
84
86
|
eprint = {2403.12120},
|
|
85
|
-
|
|
86
|
-
adsurl = {https://ui.adsabs.harvard.edu/abs/
|
|
87
|
-
|
|
87
|
+
primaryClass = {astro-ph.IM},
|
|
88
|
+
adsurl = {https://ui.adsabs.harvard.edu/abs/2024A&C....4800850C},
|
|
89
|
+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
88
90
|
}
|
|
91
|
+
|
|
89
92
|
```
|
|
90
93
|
|
|
91
94
|
|
|
@@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
|
|
|
19
19
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
+
import warnings
|
|
22
23
|
from typing import Callable
|
|
23
24
|
|
|
24
25
|
import numpy as np
|
|
@@ -72,8 +73,15 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
72
73
|
|
|
73
74
|
calculate_kde : bool, default=False
|
|
74
75
|
Whether to calculate a kernel density estimate based confidence parameter.
|
|
76
|
+
.. deprecated:: 0.2.0
|
|
77
|
+
This parameter will be removed in a future version and only the
|
|
78
|
+
distance confidence parameter will be available.
|
|
75
79
|
calculate_1d_dist : bool, default=False
|
|
76
80
|
Whether to calculate the 1-dimensional distance based confidence parameter.
|
|
81
|
+
.. deprecated:: 0.2.0
|
|
82
|
+
This parameter will be removed in a future version and only the
|
|
83
|
+
distance confidence parameter will be available.
|
|
84
|
+
Whether to calculate the 1-dimensional distance based confidence parameter.
|
|
77
85
|
|
|
78
86
|
Attributes
|
|
79
87
|
----------
|
|
@@ -87,8 +95,12 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
87
95
|
The statistic used for calculating dispersion.
|
|
88
96
|
calculate_kde : bool
|
|
89
97
|
Indicates whether a kernel density estimate is calculated.
|
|
98
|
+
.. deprecated:: 0.2.0
|
|
99
|
+
This parameter will be removed in a future version.
|
|
90
100
|
calculate_1d_dist : bool
|
|
91
101
|
Indicates whether 1-dimensional distances are calculated.
|
|
102
|
+
.. deprecated:: 0.2.0
|
|
103
|
+
This parameter will be removed in a future version.
|
|
92
104
|
|
|
93
105
|
See Also
|
|
94
106
|
--------
|
|
@@ -126,15 +138,26 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
126
138
|
scale: bool = True,
|
|
127
139
|
central_stat: str = "median",
|
|
128
140
|
dispersion_stat: str = "std",
|
|
129
|
-
calculate_kde: bool = True,
|
|
130
|
-
calculate_1d_dist: bool = True,
|
|
141
|
+
calculate_kde: bool = True, # deprecated in 0.2.0
|
|
142
|
+
calculate_1d_dist: bool = True, # deprecated in 0.2.0
|
|
131
143
|
):
|
|
132
144
|
"""Initialize the classifier with specified parameters."""
|
|
133
145
|
self.metric = metric
|
|
134
146
|
self.scale = scale
|
|
135
147
|
self.central_stat = central_stat
|
|
136
148
|
self.dispersion_stat = dispersion_stat
|
|
149
|
+
if calculate_kde:
|
|
150
|
+
warnings.warn(
|
|
151
|
+
"calculate_kde is deprecated and will be removed in version 0.2.0",
|
|
152
|
+
DeprecationWarning,
|
|
153
|
+
)
|
|
137
154
|
self.calculate_kde = calculate_kde
|
|
155
|
+
|
|
156
|
+
if calculate_1d_dist:
|
|
157
|
+
warnings.warn(
|
|
158
|
+
"calculate_1d_dist is deprecated and will be removed in version 0.2.0",
|
|
159
|
+
DeprecationWarning,
|
|
160
|
+
)
|
|
138
161
|
self.calculate_1d_dist = calculate_1d_dist
|
|
139
162
|
|
|
140
163
|
def initialize_metric_function(self):
|
|
@@ -209,7 +232,9 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
209
232
|
"""
|
|
210
233
|
X, y = check_X_y(X, y)
|
|
211
234
|
self.classes_ = unique_labels(y)
|
|
212
|
-
self.n_features_in_ = X.shape[
|
|
235
|
+
self.n_features_in_ = X.shape[
|
|
236
|
+
1
|
|
237
|
+
] # Number of features seen during fit - required for sklearn compatibility.
|
|
213
238
|
|
|
214
239
|
self.initialize_metric_function()
|
|
215
240
|
|
|
@@ -257,6 +282,10 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
257
282
|
self.df_iqr_ = df_iqr
|
|
258
283
|
|
|
259
284
|
if self.calculate_kde:
|
|
285
|
+
warnings.warn(
|
|
286
|
+
"KDE calculation is deprecated and will be removed in version 0.2.0",
|
|
287
|
+
DeprecationWarning,
|
|
288
|
+
)
|
|
260
289
|
self.kde_dict_ = {}
|
|
261
290
|
|
|
262
291
|
for cl in self.classes_:
|
|
@@ -271,7 +300,6 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
271
300
|
)
|
|
272
301
|
kde.fit(subX)
|
|
273
302
|
self.kde_dict_[cl] = kde
|
|
274
|
-
|
|
275
303
|
self.is_fitted_ = True
|
|
276
304
|
|
|
277
305
|
return self
|
|
@@ -382,6 +410,11 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
382
410
|
y_pred = self.classes_[dist_arr.argmin(axis=1)]
|
|
383
411
|
|
|
384
412
|
if self.calculate_kde:
|
|
413
|
+
warnings.warn(
|
|
414
|
+
"KDE calculation in predict_and_analyse is deprecated "
|
|
415
|
+
"and will be removed in version 0.2.0",
|
|
416
|
+
DeprecationWarning,
|
|
417
|
+
)
|
|
385
418
|
# NEW: Rescale in terms of median likelihoods - calculate here
|
|
386
419
|
scale_factors = np.exp(
|
|
387
420
|
[
|
|
@@ -401,8 +434,11 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
401
434
|
|
|
402
435
|
# NEW: Rescale in terms of median likelihoods - rescale here
|
|
403
436
|
self.likelihood_arr_ = self.likelihood_arr_ / scale_factors
|
|
404
|
-
|
|
405
437
|
if self.calculate_1d_dist:
|
|
438
|
+
warnings.warn(
|
|
439
|
+
"calculate_1d_dist is deprecated and will be removed in version 0.2.0",
|
|
440
|
+
DeprecationWarning,
|
|
441
|
+
)
|
|
406
442
|
conf_cl = []
|
|
407
443
|
Xdf_temp = pd.DataFrame(data=X, columns=self.df_centroid_.columns)
|
|
408
444
|
for cl in self.classes_:
|
|
@@ -425,7 +461,6 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
425
461
|
conf_cl.append(confs)
|
|
426
462
|
conf_cl = np.array(conf_cl)
|
|
427
463
|
self.conf_cl_ = conf_cl
|
|
428
|
-
|
|
429
464
|
self.analyis_ = True
|
|
430
465
|
|
|
431
466
|
return y_pred
|
|
@@ -439,10 +474,13 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
439
474
|
|
|
440
475
|
Parameters
|
|
441
476
|
----------
|
|
442
|
-
method : {"distance_inverse", "1d_distance_inverse","kde_likelihood"},
|
|
477
|
+
method : {"distance_inverse", "1d_distance_inverse", "kde_likelihood"},
|
|
443
478
|
default="distance_inverse"
|
|
444
479
|
The method to use for calculating confidence. Default is
|
|
445
480
|
'distance_inverse'.
|
|
481
|
+
.. deprecated:: 0.2.0
|
|
482
|
+
The methods '1d_distance_inverse' and
|
|
483
|
+
'kde_likelihood' will be removed in version 0.2.0.
|
|
446
484
|
"""
|
|
447
485
|
check_is_fitted(self, "is_fitted_")
|
|
448
486
|
if not hasattr(self, "analyis_"):
|
|
@@ -461,6 +499,11 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
461
499
|
]
|
|
462
500
|
|
|
463
501
|
elif method == "1d_distance_inverse":
|
|
502
|
+
warnings.warn(
|
|
503
|
+
"The '1d_distance_inverse' method is deprecated "
|
|
504
|
+
"and will be removed in version 0.2.0",
|
|
505
|
+
DeprecationWarning,
|
|
506
|
+
)
|
|
464
507
|
if not self.calculate_1d_dist:
|
|
465
508
|
raise ValueError(
|
|
466
509
|
"method='1d_distance_inverse' is only valid if calculate_1d_dist "
|
|
@@ -471,6 +514,11 @@ class DistanceMetricClassifier(BaseEstimator, ClassifierMixin):
|
|
|
471
514
|
)
|
|
472
515
|
|
|
473
516
|
elif method == "kde_likelihood":
|
|
517
|
+
warnings.warn(
|
|
518
|
+
"The 'kde_likelihood' method is deprecated and will be "
|
|
519
|
+
"removed in version 0.2.0",
|
|
520
|
+
DeprecationWarning,
|
|
521
|
+
)
|
|
474
522
|
if not self.calculate_kde:
|
|
475
523
|
raise ValueError(
|
|
476
524
|
"method='kde_likelihood' is only valid if calculate_kde is set "
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: distclassipy
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6a0
|
|
4
4
|
Summary: A python package for a distance-based classifier which can use several different distance metrics.
|
|
5
5
|
Author-email: Siddharth Chaini <sidchaini@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -765,27 +765,30 @@ DistClassiPy is released under the [GNU General Public License v3.0](https://www
|
|
|
765
765
|
## Citation
|
|
766
766
|
|
|
767
767
|
If you use DistClassiPy in your research or project, please consider citing the paper:
|
|
768
|
-
> Chaini, S., Mahabal, A., Kembhavi, A., & Bianco, F. B. (2024). Light Curve Classification with DistClassiPy: a new distance-based classifier.
|
|
768
|
+
> Chaini, S., Mahabal, A., Kembhavi, A., & Bianco, F. B. (2024). Light Curve Classification with DistClassiPy: a new distance-based classifier. Astronomy and Computing. https://doi.org/10.1016/j.ascom.2024.100850.
|
|
769
769
|
|
|
770
770
|
### Bibtex
|
|
771
771
|
|
|
772
772
|
|
|
773
773
|
```bibtex
|
|
774
|
-
@ARTICLE{
|
|
775
|
-
author = {{Chaini},
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
774
|
+
@ARTICLE{2024A&C....4800850C,
|
|
775
|
+
author = {{Chaini}, S. and {Mahabal}, A. and {Kembhavi}, A. and {Bianco}, F.~B.},
|
|
776
|
+
title = "{Light curve classification with DistClassiPy: A new distance-based classifier}",
|
|
777
|
+
journal = {Astronomy and Computing},
|
|
778
|
+
keywords = {Variable stars (1761), Astronomy data analysis (1858), Open source software (1866), Astrostatistics (1882), Classification (1907), Light curve classification (1954), Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Solar and Stellar Astrophysics, Computer Science - Machine Learning},
|
|
779
|
+
year = 2024,
|
|
780
|
+
month = jul,
|
|
781
|
+
volume = {48},
|
|
782
|
+
eid = {100850},
|
|
783
|
+
pages = {100850},
|
|
784
|
+
doi = {10.1016/j.ascom.2024.100850},
|
|
785
|
+
archivePrefix = {arXiv},
|
|
784
786
|
eprint = {2403.12120},
|
|
785
|
-
|
|
786
|
-
adsurl = {https://ui.adsabs.harvard.edu/abs/
|
|
787
|
-
|
|
787
|
+
primaryClass = {astro-ph.IM},
|
|
788
|
+
adsurl = {https://ui.adsabs.harvard.edu/abs/2024A&C....4800850C},
|
|
789
|
+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
788
790
|
}
|
|
791
|
+
|
|
789
792
|
```
|
|
790
793
|
|
|
791
794
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|