python-ldl 0.0.1__tar.gz → 0.0.3__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.
Files changed (49) hide show
  1. {python-ldl-0.0.1/python_ldl.egg-info → python_ldl-0.0.3}/PKG-INFO +187 -170
  2. {python-ldl-0.0.1 → python_ldl-0.0.3}/README.md +164 -146
  3. python_ldl-0.0.3/pyldl/algorithms/__init__.py +30 -0
  4. python_ldl-0.0.3/pyldl/algorithms/_algorithm_adaptation.py +198 -0
  5. python_ldl-0.0.3/pyldl/algorithms/_classifier.py +105 -0
  6. python_ldl-0.0.3/pyldl/algorithms/_ensemble.py +99 -0
  7. python_ldl-0.0.3/pyldl/algorithms/_incomplete.py +58 -0
  8. python_ldl-0.0.3/pyldl/algorithms/_label_enhancement.py +285 -0
  9. python_ldl-0.0.3/pyldl/algorithms/_ldl_da.py +182 -0
  10. python_ldl-0.0.3/pyldl/algorithms/_ldl_dpa.py +40 -0
  11. python_ldl-0.0.3/pyldl/algorithms/_ldl_lrr.py +39 -0
  12. python_ldl-0.0.3/pyldl/algorithms/_ldl_scl.py +54 -0
  13. python_ldl-0.0.3/pyldl/algorithms/_ldlf.py +84 -0
  14. python_ldl-0.0.3/pyldl/algorithms/_problem_transformation.py +62 -0
  15. python_ldl-0.0.3/pyldl/algorithms/_specialized_algorithms.py +87 -0
  16. python_ldl-0.0.3/pyldl/algorithms/_ssg_ldl.py +58 -0
  17. python_ldl-0.0.3/pyldl/algorithms/base.py +357 -0
  18. python_ldl-0.0.3/pyldl/applications/__init__.py +0 -0
  19. python_ldl-0.0.3/pyldl/applications/emphasis_selection.py +144 -0
  20. python_ldl-0.0.3/pyldl/applications/facial_emotion_recognition.py +209 -0
  21. python_ldl-0.0.3/pyldl/applications/lesion_counting.py +130 -0
  22. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/AA_BP_fit.m +1 -1
  23. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/AA_BP_predict.m +7 -7
  24. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/AA_KNN.m +3 -3
  25. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/BFGS_Process.m +13 -13
  26. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/PT_Bayes_fit.m +1 -1
  27. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/PT_Bayes_predict.m +2 -2
  28. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/PT_SVM_fit.m +2 -2
  29. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/PT_SVM_predict.m +2 -2
  30. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/SA_BFGS_fit.m +2 -2
  31. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/SA_BFGS_predict.m +1 -1
  32. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/SA_IIS_fit.m +6 -6
  33. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/SA_IIS_predict.m +1 -1
  34. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/matlab_algorithms/__init__.py +158 -158
  35. python_ldl-0.0.3/pyldl/metrics.py +144 -0
  36. python_ldl-0.0.3/pyldl/utils.py +179 -0
  37. {python-ldl-0.0.1 → python_ldl-0.0.3/python_ldl.egg-info}/PKG-INFO +187 -170
  38. {python-ldl-0.0.1 → python_ldl-0.0.3}/python_ldl.egg-info/SOURCES.txt +19 -2
  39. {python-ldl-0.0.1 → python_ldl-0.0.3}/python_ldl.egg-info/requires.txt +0 -1
  40. {python-ldl-0.0.1 → python_ldl-0.0.3}/setup.cfg +4 -4
  41. {python-ldl-0.0.1 → python_ldl-0.0.3}/setup.py +45 -46
  42. python-ldl-0.0.1/pyldl/algorithms.py +0 -1373
  43. python-ldl-0.0.1/pyldl/metrics.py +0 -99
  44. python-ldl-0.0.1/pyldl/rprop.py +0 -75
  45. python-ldl-0.0.1/pyldl/utils.py +0 -91
  46. {python-ldl-0.0.1 → python_ldl-0.0.3}/LICENSE +0 -0
  47. {python-ldl-0.0.1 → python_ldl-0.0.3}/pyldl/__init__.py +0 -0
  48. {python-ldl-0.0.1 → python_ldl-0.0.3}/python_ldl.egg-info/dependency_links.txt +0 -0
  49. {python-ldl-0.0.1 → python_ldl-0.0.3}/python_ldl.egg-info/top_level.txt +0 -0
@@ -1,170 +1,187 @@
1
- Metadata-Version: 2.1
2
- Name: python-ldl
3
- Version: 0.0.1
4
- Summary: Label distribution learning (LDL) and label enhancement (LE) toolkit implemented in python.
5
- Home-page: https://github.com/SpriteMisaka/PyLDL
6
- Author: SpriteMisaka
7
- Author-email: SpriteMisaka@gmail.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: matplotlib
15
- Requires-Dist: numpy
16
- Requires-Dist: qpsolvers
17
- Requires-Dist: quadprog
18
- Requires-Dist: scikit-fuzzy
19
- Requires-Dist: scikit-learn
20
- Requires-Dist: scipy
21
- Requires-Dist: tensorflow
22
- Requires-Dist: tensorflow-addons
23
- Requires-Dist: tensorflow-probability
24
-
25
- # PyLDL
26
-
27
- Label distribution learning (LDL) and label enhancement (LE) toolkit implemented in python, including:
28
-
29
- + LDL algorithms:
30
- + ([Geng, Yin, and Zhou 2013](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2013.pdf))[*TPAMI*]: `CPNN`$^1$.
31
- + ([Geng and Hou 2015](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2015.pdf))[*IJCAI*]: `LDSVR`.
32
- + ⭐([Geng 2016](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2016.pdf))[*TKDE*]: `SA_BFGS`, `SA_IIS`, `AA_KNN`, `AA_BP`, `PT_Bayes`, and `PT_SVM`.
33
- + ([Yang, Sun, and Sun 2017](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/yang2017.pdf))[*AAAI*]: `BCPNN` and `ACPNN`.
34
- + ([Xu and Zhou 2017](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/xu2017.pdf))[*IJCAI*]: `IncomLDL`$^2$.
35
- + ([Shen et al. 2017](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/shen2017.pdf))[*NeurIPS*]: `LDLF`.
36
- + ([Wang and Geng 2019](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wang2019.pdf))[*IJCAI*]: `LDL4C`$^3$.
37
- + ([Shen et al. 2020](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/shen2020.pdf))[*南京理工大学学报* (Chinese)]: `AdaBoostLDL`.
38
- + ([González et al. 2021a](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/gonz%C3%A1lez2021a.pdf))[*Information Sciences*]: `SSG_LDL`$^4$.
39
- + ([González et al. 2021b](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/gonz%C3%A1lez2021b.pdf))[*Information Fusion*]: `DF_LDL`.
40
- + ([Wang and Geng 2021a](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wang2021a.pdf))[*IJCAI*]: `LDL_HR`$^3$.
41
- + ([Wang and Geng 2021b](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wang2021b.pdf))[*ICML*]: `LDLM`$^3$.
42
- + ([Jia et al. 2021](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/jia2021.pdf))[*TKDE*]: `LDL_SCL`.
43
- + ([Jia et al. 2023](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/jia2023.pdf))[*TKDE*]: `LDL_LRR`.
44
- + ([Wen et al. 2023](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wen2023.pdf))[*ICCV*]: `CAD`$^1$, `QFD2`$^1$, and `CJS`$^1$.
45
- + LE algorithms:
46
- + ([Xu, Liu, and Geng 2019](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/xu2019.pdf))[*TKDE*]: `FCM`, `KM`, `LP`, `ML`, and `GLLE`.
47
- + ([Xu et al. 2020](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/xu2020.pdf))[*ICML*]: `LEVI`.
48
- + ([Zheng, Zhu, and Tang 2023](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/zheng2023.pdf))[*CVPR*]: `LIBLE`.
49
-
50
- + LDL metrics: `chebyshev`, `clark`, `canberra`, `kl_divergence`, `cosine`, `intersection`, etc.
51
- + LDL datasets: *Human_Gene*, *Movie*, *Natural_Scene*, *s-BU_3DFE*, *s-JAFFE*, *Yeast*, etc.
52
-
53
- > $^1$ Technically, these methods are only suitable for totally ordered labels.
54
- >
55
- > $^2$ These are algorithms for incomplete LDL, so you should use `utils.random_missing` to generate the missing label distribution matrix and the corresponding mask matrix in the experiments.
56
- >
57
- > $^3$ These are LDL classifiers, so you should use `predict_proba` to get label distributions and `predict` to get predicted labels.
58
- >
59
- > $^4$ These are oversampling algorithms for LDL, therefore you should use `fit_transform` to generate synthetic samples.
60
-
61
- ## Usage
62
-
63
- Here is an example of using PyLDL.
64
-
65
- ```python
66
- from pyldl.utils import load_dataset
67
- from pyldl.algorithms import SA_BFGS
68
- from pyldl.metrics import score
69
-
70
- from sklearn.model_selection import train_test_split
71
-
72
- dataset_name = 'SJAFFE'
73
- X, y = load_dataset(dataset_name)
74
- X_train, X_test, y_train, y_test = train_test_split(X, y)
75
-
76
- model = SA_BFGS()
77
- model.fit(X_train, y_train)
78
-
79
- y_pred = model.predict(X_test)
80
- print(score(y_test, y_pred))
81
- ```
82
-
83
- For those who would like to use the original implementation:
84
-
85
- 1. Install MATLAB.
86
- 2. Install MATLAB engine for python.
87
- 3. Download LDL Package from [here](http://palm.seu.edu.cn/xgeng/LDL/download.htm).
88
- 3. Get the package directory of PyLDL (...\\Lib\\site-packages\\pyldl).
89
- 4. Place the *LDLPackage_v1.2* folder into the *matlab_algorithms* folder.
90
-
91
- Now, you can load the original implementation of the method, e.g.:
92
-
93
- ```python
94
- from pyldl.matlab_algorithms import SA_IIS
95
- ```
96
-
97
- You can visualize the performance of any model on the artificial dataset ([Geng 2016](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2016.pdf)) with the `pyldl.utils.plot_artificial` function, e.g.:
98
-
99
- ```python
100
- from pyldl.algorithms import LDSVR, SA_BFGS, SA_IIS, AA_KNN, PT_Bayes, GLLE, LIBLE
101
- from pyldl.utils import plot_artificial
102
-
103
- methods = ['LDSVR', 'SA_BFGS', 'SA_IIS', 'AA_KNN', 'PT_Bayes', 'GLLE', 'LIBLE']
104
-
105
- plot_artificial(model=None, figname='GT')
106
- for i in methods:
107
- plot_artificial(model=eval(f'{i}()'), figname=i)
108
- ```
109
-
110
- The output images are as follows.
111
-
112
- | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/GT.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/LDSVR.jpg?raw=true" width=300> |
113
- | :----------------------------------------------------------: | :----------------------------------------------------------: |
114
- | (Ground Truth) | `LDSVR` |
115
-
116
- | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/SA_BFGS.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/SA_IIS.jpg?raw=true" width=300> |
117
- | :----------------------------------------------------------: | :----------------------------------------------------------: |
118
- | `SA_BFGS` | `SA_IIS` |
119
-
120
- | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/AA_KNN.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/PT_Bayes.jpg?raw=true" width=300> |
121
- | :----------------------------------------------------------: | :----------------------------------------------------------: |
122
- | `AA_KNN` | `PT_Bayes` |
123
-
124
- | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/GLLE.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/LIBLE.jpg?raw=true" width=300> |
125
- | :----------------------------------------------------------: | :----------------------------------------------------------: |
126
- | `GLLE` | `LIBLE` |
127
-
128
- Enjoy! :)
129
-
130
- ## Experiments
131
-
132
- For each algorithm, a ten-fold cross validation is performed, repeated 10 times with *s-JAFFE* dataset and the average metrics are recorded. Therefore, the results do not fully describe the performance of the model.
133
-
134
- Results of ours are as follows.
135
-
136
- | Algorithm | Cheby.(↓) | Clark(↓) | Can.(↓) | K-L(↓) | Cos.(↑) | Int.(↑) |
137
- | :-------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
138
- | SA-BFGS | **.092 ± .010** | .361 ± .029 | .735 ± .060 | **.051 ± .009** | **.954 ± .009** | **.878 ± .011** |
139
- | SA-IIS | .100 ± .009 | .361 ± .023 | .746 ± .050 | **.051 ± .008** | .952 ± .007 | .873 ± .009 |
140
- | AA-kNN | .098 ± .011 | **.349 ± .029** | **.716 ± .062** | .053 ± .010 | .950 ± .009 | .877 ± .011 |
141
- | AA-BP | .120 ± .012 | .426 ± .025 | .889 ± .057 | .073 ± .010 | .931 ± .010 | .848 ± .011 |
142
- | PT-Bayes | .116 ± .011 | .425 ± .031 | .874 ± .064 | .073 ± .012 | .932 ± .011 | .850 ± .012 |
143
- | PT-SVM | .117 ± .012 | .422 ± .027 | .875 ± .057 | .072 ± .011 | .932 ± .011 | .850 ± .011 |
144
-
145
- Results of the original MATLAB implementation ([Geng 2016](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2016.pdf)) are as follows.
146
-
147
- | Algorithm | Cheby.(↓) | Clark(↓) | Can.(↓) | K-L(↓) | Cos.(↑) | Int.(↑) |
148
- | :-------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
149
- | SA-BFGS | **.107 ± .015** | **.399 ± .044** | **.820 ± .103** | **.064 ± .016** | **.940 ± .015** | **.860 ± .019** |
150
- | SA-IIS | .117 ± .015 | .419 ± .034 | .875 ± .086 | .070 ± .012 | .934 ± .012 | .851 ± .016 |
151
- | AA-kNN | .114 ± .017 | .410 ± .050 | .843 ± .113 | .071 ± .023 | .934 ± .018 | .855 ± .021 |
152
- | AA-BP | .130 ± .017 | .510 ± .054 | 1.05 ± .124 | .113 ± .030 | .908 ± .019 | .824 ± .022 |
153
- | PT-Bayes | .121 ± .016 | .430 ± .035 | .904 ± .086 | .074 ± .014 | .930 ± .016 | .846 ± .016 |
154
- | PT-SVM | .127 ± .017 | .457 ± .039 | .935 ± .074 | .086 ± .016 | .920 ± .014 | .839 ± .015 |
155
-
156
- ## Requirements
157
-
158
- ```
159
- matplotlib>=3.6.1
160
- numpy>=1.22.3
161
- qpsolvers>=4.0.0
162
- quadprog>=0.1.11
163
- scikit-fuzzy>=0.4.2
164
- scikit-learn>=1.0.2
165
- scipy>=1.8.0
166
- tensorflow>=2.8.0
167
- tensorflow-addons>=0.22.0
168
- tensorflow-probability>=0.16.0
169
- ```
170
-
1
+ Metadata-Version: 2.1
2
+ Name: python-ldl
3
+ Version: 0.0.3
4
+ Summary: Label distribution learning (LDL) and label enhancement (LE) toolkit implemented in python.
5
+ Home-page: https://github.com/SpriteMisaka/PyLDL
6
+ Author: SpriteMisaka
7
+ Author-email: SpriteMisaka@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: numpy
16
+ Requires-Dist: qpsolvers
17
+ Requires-Dist: quadprog
18
+ Requires-Dist: scikit-fuzzy
19
+ Requires-Dist: scikit-learn
20
+ Requires-Dist: scipy
21
+ Requires-Dist: tensorflow
22
+ Requires-Dist: tensorflow-probability
23
+
24
+ # PyLDL
25
+
26
+ Label distribution learning (LDL) and label enhancement (LE) toolkit implemented in python, including:
27
+
28
+ + LDL algorithms:
29
+ + ([Geng, Yin, and Zhou 2013](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2013.pdf))[*TPAMI*]: `CPNN`$^1$.
30
+ + ([Geng and Hou 2015](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2015.pdf))[*IJCAI*]: `LDSVR`.
31
+ + ⭐([Geng 2016](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2016.pdf))[*TKDE*]: `SA_BFGS`, `SA_IIS`, `AA_KNN`, `AA_BP`, `PT_Bayes`, and `PT_SVM`.
32
+ + ([Yang, Sun, and Sun 2017](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/yang2017.pdf))[*AAAI*]: `BCPNN` and `ACPNN`.
33
+ + ([Xu and Zhou 2017](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/xu2017.pdf))[*IJCAI*]: `IncomLDL`$^2$.
34
+ + ([Shen et al. 2017](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/shen2017.pdf))[*NeurIPS*]: `LDLF`.
35
+ + ([Wang and Geng 2019](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wang2019.pdf))[*IJCAI*]: `LDL4C`$^3$.
36
+ + ([Shen et al. 2020](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/shen2020.pdf))[*南京理工大学学报* (Chinese)]: `AdaBoostLDL`.
37
+ + ([González et al. 2021a](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/gonz%C3%A1lez2021a.pdf))[*Inf. Sci.*]: `SSG_LDL`$^4$.
38
+ + ([González et al. 2021b](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/gonz%C3%A1lez2021b.pdf))[*Inf. Fusion*]: `DF_LDL`.
39
+ + ([Wang and Geng 2021a](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wang2021a.pdf))[*IJCAI*]: `LDL_HR`$^3$.
40
+ + ([Wang and Geng 2021b](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wang2021b.pdf))[*ICML*]: `LDLM`$^3$.
41
+ + ([Jia et al. 2021](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/jia2021.pdf))[*TKDE*]: `LDL_SCL`.
42
+ + ([Jia et al. 2023a](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/jia2023a.pdf))[*TKDE*]: `LDL_LRR`.
43
+ + ([Jia et al. 2023b](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/jia2023b.pdf))[*TNNLS*]: `LDL_DPA`.
44
+ + ([Wen et al. 2023](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wen2023.pdf))[*ICCV*]: `CAD`$^1$, `QFD2`$^1$, and `CJS`$^1$.
45
+ + LE algorithms:
46
+ + ([Xu, Liu, and Geng 2019](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/xu2019.pdf))[*TKDE*]: `FCM`, `KM`, `LP`, `ML`, and `GLLE`.
47
+ + ([Xu et al. 2020](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/xu2020.pdf))[*ICML*]: `LEVI`.
48
+ + ([Zheng, Zhu, and Tang 2023](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/zheng2023.pdf))[*CVPR*]: `LIBLE`.
49
+ + LDL metrics: `chebyshev`, `clark`, `canberra`, `kl_divergence`, `cosine`, `intersection`, etc.
50
+ + Structured LDL datasets: *Human_Gene*, *Movie*, *Natural_Scene*, *s-BU_3DFE*, *s-JAFFE*, *Yeast*, etc.
51
+ + LDL applications:
52
+ + Facial emotion recognition (supported datasets: [*JAFFE*](https://zenodo.org/records/3451524))
53
+ + ([Shirani et al. 2019](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/shirani2019.pdf))[*ACL*]: Emphasis selection (supported datasets: [*SemEval2020*](https://github.com/RiTUAL-UH/SemEval2020_Task10_Emphasis_Selection); pre-trained GloVe embeddings can be downloaded [here](https://nlp.stanford.edu/projects/glove/)).
54
+ + ([Wu et al. 2019](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/wu2019.pdf))[*ICCV*]: Lesion counting (supported datasets: [*ACNE04*](https://drive.google.com/drive/folders/18yJcHXhzOv7H89t-Lda6phheAicLqMuZ)).
55
+ + ([Chen et al. 2020](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/chen2020.pdf))[*CVPR*]: Facial emotion recognition with auxiliary label space graphs (supported datasets: [*CK+*](https://www.jeffcohn.net/Resources/); OpenFace can be downloaded [here](https://github.com/TadasBaltrusaitis/OpenFace/releases), and the required models can be downloaded [here](https://github.com/TadasBaltrusaitis/OpenFace/wiki/Model-download)).
56
+
57
+ > $^1$ Technically, these methods are only suitable for totally ordered labels.
58
+ >
59
+ > $^2$ These are algorithms for incomplete LDL, so you should use `pyldl.utils.random_missing` to generate the missing label distribution matrix and the corresponding mask matrix in the experiments.
60
+ >
61
+ > $^3$ These are LDL classifiers, so you should use `predict_proba` to get label distributions and `predict` to get predicted labels.
62
+ >
63
+ > $^4$ These are oversampling algorithms for LDL, therefore you should use `fit_transform` to generate synthetic samples.
64
+
65
+ ## Installation
66
+
67
+ PyLDL is now available on [PyPI](https://pypi.org/project/python-ldl/). Use the following command to install.
68
+
69
+ ```shell
70
+ pip install python-ldl
71
+ ```
72
+
73
+ To install the newest version, you can clone this repo and run the `setup.py` file.
74
+
75
+ ```shell
76
+ python setup.py install
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ Here is an example of using PyLDL.
82
+
83
+ ```python
84
+ from pyldl.utils import load_dataset
85
+ from pyldl.algorithms import SA_BFGS
86
+ from pyldl.metrics import score
87
+
88
+ from sklearn.model_selection import train_test_split
89
+
90
+ dataset_name = 'SJAFFE'
91
+ X, y = load_dataset(dataset_name)
92
+ X_train, X_test, y_train, y_test = train_test_split(X, y)
93
+
94
+ model = SA_BFGS()
95
+ model.fit(X_train, y_train)
96
+
97
+ y_pred = model.predict(X_test)
98
+ print(score(y_test, y_pred))
99
+ ```
100
+
101
+ For those who would like to use the original implementation:
102
+
103
+ 1. Install MATLAB.
104
+ 2. Install MATLAB engine for python.
105
+ 3. Download LDL Package [here](http://palm.seu.edu.cn/xgeng/LDL/download.htm).
106
+ 3. Get the package directory of PyLDL (...\\Lib\\site-packages\\pyldl).
107
+ 4. Place the *LDLPackage_v1.2* folder into the *matlab_algorithms* folder.
108
+
109
+ Now, you can load the original implementation of the method, e.g.:
110
+
111
+ ```python
112
+ from pyldl.matlab_algorithms import SA_IIS
113
+ ```
114
+
115
+ You can visualize the performance of any model on the artificial dataset ([Geng 2016](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2016.pdf)) with the `pyldl.utils.plot_artificial` function, e.g.:
116
+
117
+ ```python
118
+ from pyldl.algorithms import LDSVR, SA_BFGS, SA_IIS, AA_KNN, PT_Bayes, GLLE, LIBLE
119
+ from pyldl.utils import plot_artificial
120
+
121
+ methods = ['LDSVR', 'SA_BFGS', 'SA_IIS', 'AA_KNN', 'PT_Bayes', 'GLLE', 'LIBLE']
122
+
123
+ plot_artificial(model=None, figname='GT')
124
+ for i in methods:
125
+ plot_artificial(model=eval(f'{i}()'), figname=i)
126
+ ```
127
+
128
+ The output images are as follows.
129
+
130
+ | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/GT.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/LDSVR.jpg?raw=true" width=300> |
131
+ | :----------------------------------------------------------: | :----------------------------------------------------------: |
132
+ | (Ground Truth) | `LDSVR` |
133
+
134
+ | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/SA_BFGS.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/SA_IIS.jpg?raw=true" width=300> |
135
+ | :----------------------------------------------------------: | :----------------------------------------------------------: |
136
+ | `SA_BFGS` | `SA_IIS` |
137
+
138
+ | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/AA_KNN.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/PT_Bayes.jpg?raw=true" width=300> |
139
+ | :----------------------------------------------------------: | :----------------------------------------------------------: |
140
+ | `AA_KNN` | `PT_Bayes` |
141
+
142
+ | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/GLLE.jpg?raw=true" width=300> | <img src="https://github.com/SpriteMisaka/PyLDL/blob/main/visualization/LIBLE.jpg?raw=true" width=300> |
143
+ | :----------------------------------------------------------: | :----------------------------------------------------------: |
144
+ | `GLLE` | `LIBLE` |
145
+
146
+ Enjoy! :)
147
+
148
+ ## Experiments
149
+
150
+ For each algorithm, a ten-fold cross validation is performed, repeated 10 times with *s-JAFFE* dataset and the average metrics are recorded. Therefore, the results do not fully describe the performance of the model.
151
+
152
+ Results of ours are as follows.
153
+
154
+ | Algorithm | Cheby.(↓) | Clark(↓) | Can.(↓) | K-L(↓) | Cos.(↑) | Int.(↑) |
155
+ | :-------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
156
+ | SA-BFGS | **.092 ± .010** | .361 ± .029 | .735 ± .060 | **.051 ± .009** | **.954 ± .009** | **.878 ± .011** |
157
+ | SA-IIS | .100 ± .009 | .361 ± .023 | .746 ± .050 | **.051 ± .008** | .952 ± .007 | .873 ± .009 |
158
+ | AA-kNN | .098 ± .011 | **.349 ± .029** | **.716 ± .062** | .053 ± .010 | .950 ± .009 | .877 ± .011 |
159
+ | AA-BP | .120 ± .012 | .426 ± .025 | .889 ± .057 | .073 ± .010 | .931 ± .010 | .848 ± .011 |
160
+ | PT-Bayes | .116 ± .011 | .425 ± .031 | .874 ± .064 | .073 ± .012 | .932 ± .011 | .850 ± .012 |
161
+ | PT-SVM | .117 ± .012 | .422 ± .027 | .875 ± .057 | .072 ± .011 | .932 ± .011 | .850 ± .011 |
162
+
163
+ Results of the original MATLAB implementation ([Geng 2016](https://github.com/SpriteMisaka/PyLDL/blob/main/bibliography/geng2016.pdf)) are as follows.
164
+
165
+ | Algorithm | Cheby.(↓) | Clark(↓) | Can.(↓) | K-L(↓) | Cos.(↑) | Int.(↑) |
166
+ | :-------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
167
+ | SA-BFGS | **.107 ± .015** | **.399 ± .044** | **.820 ± .103** | **.064 ± .016** | **.940 ± .015** | **.860 ± .019** |
168
+ | SA-IIS | .117 ± .015 | .419 ± .034 | .875 ± .086 | .070 ± .012 | .934 ± .012 | .851 ± .016 |
169
+ | AA-kNN | .114 ± .017 | .410 ± .050 | .843 ± .113 | .071 ± .023 | .934 ± .018 | .855 ± .021 |
170
+ | AA-BP | .130 ± .017 | .510 ± .054 | 1.05 ± .124 | .113 ± .030 | .908 ± .019 | .824 ± .022 |
171
+ | PT-Bayes | .121 ± .016 | .430 ± .035 | .904 ± .086 | .074 ± .014 | .930 ± .016 | .846 ± .016 |
172
+ | PT-SVM | .127 ± .017 | .457 ± .039 | .935 ± .074 | .086 ± .016 | .920 ± .014 | .839 ± .015 |
173
+
174
+ ## Requirements
175
+
176
+ ```
177
+ matplotlib>=3.6.1
178
+ numpy>=1.22.3
179
+ qpsolvers>=4.0.0
180
+ quadprog>=0.1.11
181
+ scikit-fuzzy>=0.4.2
182
+ scikit-learn>=1.0.2
183
+ scipy>=1.8.0
184
+ tensorflow>=2.8.0
185
+ tensorflow-probability>=0.16.0
186
+ ```
187
+