Functions | |
| def | distance (x, C, N) |
| def | function (x, C, N) |
| def | projection (x, C, N) |
| def | standard_fit (X) |
Variables | |
| list | __all__ = ['standard_fit', 'projection', 'distance', 'function'] |
| string | __author__ = 'Alisue (lambdalisue@hashnote.net)' |
| string | __date__ = '2013-10-28' |
| string | __version__ = '0.1.0' |
| def standard_fit.distance | ( | x, | |
| C, | |||
| N | |||
| ) |
Calculate an orthogonal distance between the points and the standard
Args:
x: n x m dimensional matrix
C: n dimensional vector whicn indicate the centroid of the standard
N: n dimensional vector which indicate the normal vector of the standard
Returns:
m dimensional vector which indicate the orthogonal disntace. the value
will be negative if the points beside opposite side of the normal vector
Definition at line 74 of file standard_fit.py.
| def standard_fit.function | ( | x, | |
| C, | |||
| N | |||
| ) |
Calculate an orthogonal projection of the points on the standard
Args:
x: (n-1) x m dimensional matrix
C: n dimensional vector whicn indicate the centroid of the standard
N: n dimensional vector which indicate the normal vector of the standard
Returns:
m dimensional vector which indicate the last attribute value of
orthogonal projection
Definition at line 89 of file standard_fit.py.
| def standard_fit.projection | ( | x, | |
| C, | |||
| N | |||
| ) |
Create orthogonal projection matrix of x on the plane
Args:
x: n x m dimensional matrix
C: n dimensional vector whicn indicate the centroid of the standard
N: n dimensional vector which indicate the normal vector of the standard
Returns:
n x m dimensional matrix which indicate the orthogonal projection points
on the plane
Definition at line 55 of file standard_fit.py.
| def standard_fit.standard_fit | ( | X | ) |
Find (n - 1) dimensional standard (e.g. line in 2 dimension, plane in 3
dimension, hyperplane in n dimension) via solving Singular Value
Decomposition.
The idea was explained in the following references
- http://www.caves.org/section/commelect/DUSI/openmag/pdf/SphereFitting.pdf
- http://www.geometrictools.com/Documentation/LeastSquaresFitting.pdf
- http://www.ime.unicamp.br/~marianar/MI602/material%20extra/svd-regression-analysis.pdf
- http://www.ling.ohio-state.edu/~kbaker/pubs/Singular_Value_Decomposition_Tutorial.pdf
Example:
>>> XY = [[0, 1], [3, 3]]
>>> XY = np.array(XY)
>>> C, N = standard_fit(XY)
>>> C
array([ 1.5, 2. ])
>>> N
array([-0.5547002 , 0.83205029])
Args:
X: n x m dimensional matrix which n indicate the number of the dimension
and m indicate the number of points
Returns:
[C, N] where C is a centroid vector and N is a normal vector
Definition at line 15 of file standard_fit.py.
|
private |
Definition at line 11 of file standard_fit.py.
|
private |
Definition at line 8 of file standard_fit.py.
|
private |
Definition at line 10 of file standard_fit.py.
|
private |
Definition at line 9 of file standard_fit.py.