|
160 | 160 | gtk.main() |
161 | 161 |
|
162 | 162 |
|
163 | | -Deprecated functions |
164 | | ---------------------- |
165 | | -
|
166 | | -The following are deprecated; please import directly from numpy (with |
167 | | -care--function signatures may differ): |
168 | | -
|
169 | | -
|
170 | | -:func:`load` |
171 | | - Load ASCII file - use numpy.loadtxt |
172 | | -
|
173 | | -:func:`save` |
174 | | - Save ASCII file - use numpy.savetxt |
175 | | -
|
176 | 163 | """ |
177 | 164 |
|
178 | 165 | from __future__ import (absolute_import, division, print_function, |
@@ -1623,45 +1610,6 @@ def longest_ones(x): |
1623 | 1610 | return longest_contiguous_ones(x) |
1624 | 1611 |
|
1625 | 1612 |
|
1626 | | -def prepca(P, frac=0): |
1627 | | - """ |
1628 | | -
|
1629 | | - .. warning:: |
1630 | | -
|
1631 | | - This function is deprecated -- please see class PCA instead |
1632 | | -
|
1633 | | - Compute the principal components of *P*. *P* is a (*numVars*, |
1634 | | - *numObs*) array. *frac* is the minimum fraction of variance that a |
1635 | | - component must contain to be included. |
1636 | | -
|
1637 | | - Return value is a tuple of the form (*Pcomponents*, *Trans*, |
1638 | | - *fracVar*) where: |
1639 | | -
|
1640 | | - - *Pcomponents* : a (numVars, numObs) array |
1641 | | -
|
1642 | | - - *Trans* : the weights matrix, i.e., *Pcomponents* = *Trans* * |
1643 | | - *P* |
1644 | | -
|
1645 | | - - *fracVar* : the fraction of the variance accounted for by each |
1646 | | - component returned |
1647 | | -
|
1648 | | - A similar function of the same name was in the MATLAB |
1649 | | - R13 Neural Network Toolbox but is not found in later versions; |
1650 | | - its successor seems to be called "processpcs". |
1651 | | - """ |
1652 | | - warnings.warn('This function is deprecated -- see class PCA instead') |
1653 | | - U, s, v = np.linalg.svd(P) |
1654 | | - varEach = s**2/P.shape[1] |
1655 | | - totVar = varEach.sum() |
1656 | | - fracVar = varEach/totVar |
1657 | | - ind = slice((fracVar >= frac).sum()) |
1658 | | - # select the components that are greater |
1659 | | - Trans = U[:, ind].transpose() |
1660 | | - # The transformed data |
1661 | | - Pcomponents = np.dot(Trans, P) |
1662 | | - return Pcomponents, Trans, fracVar[ind] |
1663 | | - |
1664 | | - |
1665 | 1613 | class PCA(object): |
1666 | 1614 | def __init__(self, a, standardize=True): |
1667 | 1615 | """ |
|
0 commit comments