Skip to content

Commit c126417

Browse files
committed
[ENH] Linear Discriminant Analysis (LDA): add documentation
1 parent fa353da commit c126417

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

Orange/projection/lda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Orange.data
44
from Orange.classification.logistic_regression import _FeatureScorerMixin
55
from Orange.data.util import SharedComputeValue
6-
from Orange.projection import SklProjector, Projection, LinearCombinationSql
6+
from Orange.projection import SklProjector, Projection
77

88
__all__ = ["LDA"]
99

doc/data-mining-library/source/reference/projection.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,51 @@ Example
8383

8484

8585
.. autoclass:: Orange.projection.freeviz.FreeViz
86+
87+
88+
89+
90+
LDA
91+
---
92+
93+
Linear discriminant analysis is another way of finding a linear transformation of
94+
data that reduces the number of dimensions required to represent it. It is often
95+
used for dimensionality reduction prior to classification, but can also be used as a
96+
classification technique itself ([1]_).
97+
98+
99+
Example
100+
=======
101+
102+
>>> from Orange.projection import LDA
103+
>>> from Orange.data import Table
104+
>>> iris = Table('iris')
105+
>>> lda = LDA()
106+
>>> model = LDA(iris)
107+
>>> model.components_ # LDA components
108+
array([[ 0.20490976, 0.38714331, -0.54648218, -0.71378517],
109+
[ 0.00898234, 0.58899857, -0.25428655, 0.76703217],
110+
[-0.71507172, 0.43568045, 0.45568731, -0.30200008],
111+
[ 0.06449913, -0.35780501, -0.42514529, 0.828895 ]])
112+
>>> transformed_data = model(iris) # transformed data
113+
>>> transformed_data
114+
[[1.492, 1.905 | Iris-setosa],
115+
[1.258, 1.608 | Iris-setosa],
116+
[1.349, 1.750 | Iris-setosa],
117+
[1.180, 1.639 | Iris-setosa],
118+
[1.510, 1.963 | Iris-setosa],
119+
...
120+
]
121+
122+
123+
124+
.. autoclass:: Orange.projection.lda.LDA
125+
126+
127+
128+
References
129+
----------
130+
131+
.. [1] Witten, I.H., Frank, E., Hall, M.A. and Pal, C.J., 2016.
132+
Data Mining: Practical machine learning tools and techniques. Morgan Kaufmann.
133+

0 commit comments

Comments
 (0)