-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
matrix.py - removed overloaded __len__
- Loading branch information
Showing
5 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | ||
<html><head><title>Python: module mola.clustering</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
</head><body bgcolor="#f0f0f8"> | ||
|
||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | ||
<tr bgcolor="#7799ee"> | ||
<td valign=bottom> <br> | ||
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="mola.html"><font color="#ffffff">mola</font></a>.clustering</strong></big></big></font></td | ||
><td align=right valign=bottom | ||
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:c%3A%5Cusers%5Clavik%5Conedrive%5Cdocuments%5Cgithub%5Cpython-linear-algebra%5Cmola%5Cclustering.py">c:\users\lavik\onedrive\documents\github\python-linear-algebra\mola\clustering.py</a></font></td></tr></table> | ||
<p></p> | ||
<p> | ||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | ||
<tr bgcolor="#aa55cc"> | ||
<td colspan=3 valign=bottom> <br> | ||
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> | ||
|
||
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> | ||
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="math.html">math</a><br> | ||
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p> | ||
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | ||
<tr bgcolor="#eeaa77"> | ||
<td colspan=3 valign=bottom> <br> | ||
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> | ||
|
||
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> | ||
<td width="100%"><dl><dt><a name="-distance_euclidean_pow"><strong>distance_euclidean_pow</strong></a>(p1, p2)</dt><dd><tt>Return the squared Euclidean distance between two points.<br> | ||
If you want to retrieve the actual Euclidean distance, take the square root of the result. However, using this squared version is computationally more efficient.<br> | ||
<br> | ||
Arguments:<br> | ||
p1 -- list: the first point<br> | ||
p2 -- list: the second point</tt></dd></dl> | ||
<dl><dt><a name="-distance_taxicab"><strong>distance_taxicab</strong></a>(p1, p2)</dt><dd><tt>Return the taxicab distance (also known as Manhattan distance) between two points.<br> | ||
<br> | ||
Arguments:<br> | ||
p1 -- list: the first point<br> | ||
p2 -- list: the second point</tt></dd></dl> | ||
<dl><dt><a name="-find_c_means"><strong>find_c_means</strong></a>(data, num_centers=2, max_iterations=100, distance_function=<function distance_euclidean_pow at 0x000002575B236E50>, initial_centers=None)</dt><dd><tt>Return the cluster centers and the membership matrix of points using soft k-means clustering (also known as fuzzy c-means).<br> | ||
<br> | ||
This algorithm is well-suited to cluster data that is not clearly separable into distinct clusters.<br> | ||
<br> | ||
Arguments:<br> | ||
data -- Matrix: the data containing the points to be clustered<br> | ||
num_centers -- int: the number of cluster centers to be found (default 2)<br> | ||
max_iterations -- int: the maximum number of iterations where cluster centers are updated (default 100)<br> | ||
distance_function -- function: the distance function to be used (default Euclidean distance); options are squared Euclidean distance (distance_euclidean_pow) and taxicab distance (distance_taxicab)<br> | ||
initial_centers -- Matrix: the initial cluster centers; if not specified, they are initialized randomly (default None)</tt></dd></dl> | ||
<dl><dt><a name="-find_k_means"><strong>find_k_means</strong></a>(data, num_centers=2, max_iterations=100, distance_function=<function distance_euclidean_pow at 0x000002575B236E50>, initial_centers=None)</dt><dd><tt>Return the cluster centers using hard k-means clustering.<br> | ||
<br> | ||
Note that there is no guarantee that the algorithm converges. This is why you should use several restarts or fuzzy k-means (function <a href="#-find_c_means">find_c_means</a>() in this module).<br> | ||
<br> | ||
Arguments:<br> | ||
data -- Matrix: the data containing the points to be clustered<br> | ||
num_centers -- int: the number of centers to be found (default 2)<br> | ||
max_iterations -- int: the maximum number of iterations where cluster centers are updated (default 100)<br> | ||
distance_function -- function: the distance function to be used (default Euclidean distance); options are squared Euclidean distance (distance_euclidean_pow) and taxicab distance (distance_taxicab)<br> | ||
initial_centers -- Matrix: the initial cluster centers; if not specified, they are initialized randomly (default None)</tt></dd></dl> | ||
<dl><dt><a name="-random"><strong>random</strong></a>()<font color="#909090"><font face="helvetica, arial"> method of <a href="random.html#Random">random.Random</a> instance</font></font></dt><dd><tt><a href="#-random">random</a>() -> x in the interval [0, 1).</tt></dd></dl> | ||
</td></tr></table> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters