/usr/share/doc/libghc-hierarchical-clustering-doc/html/Data-Clustering-Hierarchical.html is in libghc-hierarchical-clustering-doc 0.4.6-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Clustering.Hierarchical</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Clustering-Hierarchical.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Clustering-Hierarchical.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hierarchical-clustering-0.4.6: Fast algorithms for single, average/UPGMA and complete linkage clustering.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Clustering.Hierarchical</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Dendrogram data type</a></li><li><a href="#g:2">Linkage data type</a></li><li><a href="#g:3">Clustering function</a></li></ul></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Dendrogram">Dendrogram</a> a<ul class="subs"><li>= <a href="#v:Leaf">Leaf</a> a</li><li>| <a href="#v:Branch">Branch</a> !<a href="Data-Clustering-Hierarchical.html#t:Distance">Distance</a> (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a) (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a)</li></ul></li><li class="src short"><span class="keyword">type</span> <a href="#t:Distance">Distance</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:elements">elements</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> [a]</li><li class="src short"><a href="#v:cutAt">cutAt</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Distance">Distance</a> -> [<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a]</li><li class="src short"><span class="keyword">data</span> <a href="#t:Linkage">Linkage</a><ul class="subs"><li>= <a href="#v:SingleLinkage">SingleLinkage</a></li><li>| <a href="#v:CompleteLinkage">CompleteLinkage</a></li><li>| <a href="#v:CLINK">CLINK</a></li><li>| <a href="#v:UPGMA">UPGMA</a></li><li>| <a href="#v:FakeAverageLinkage">FakeAverageLinkage</a></li></ul></li><li class="src short"><a href="#v:dendrogram">dendrogram</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> [a] -> (a -> a -> <a href="Data-Clustering-Hierarchical.html#t:Distance">Distance</a>) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a</li></ul></div><div id="interface"><h1 id="g:1">Dendrogram data type</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Dendrogram" class="def">Dendrogram</a> a <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#Dendrogram" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></p><div class="doc"><p>Data structure for storing hierarchical clusters. The
distance between clusters is stored on the branches.
Distances between leafs are the distances between the elements
on those leafs, while distances between branches are defined
by the linkage used (see <code><a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a></code>).</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:Leaf" class="def">Leaf</a> a</td><td class="doc"><p>The leaf contains the item <code>a</code> itself.</p></td></tr><tr><td class="src"><a id="v:Branch" class="def">Branch</a> !<a href="Data-Clustering-Hierarchical.html#t:Distance">Distance</a> (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a) (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a)</td><td class="doc"><p>Each branch connects two clusters/dendrograms that are
<code>d</code> distance apart.</p></td></tr></table></div><div class="subs instances"><p id="control.i:Dendrogram" class="caption collapser" onclick="toggleSection('i:Dendrogram')">Instances</p><div id="section.i:Dendrogram" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Dendrogram:Functor:1" class="instance expander" onclick="toggleSection('i:id:Dendrogram:Functor:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor.html#t:Functor">Functor</a> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-30" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></td><td class="doc"><p>Does not recalculate the distances!</p></td></tr><tr><td colspan="2"><div id="section.i:id:Dendrogram:Functor:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -> b) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(<$)</a> :: a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> b -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Dendrogram:Foldable:2" class="instance expander" onclick="toggleSection('i:id:Dendrogram:Foldable:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Foldable.html#t:Foldable">Foldable</a> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-34" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Dendrogram:Foldable:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fold">fold</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Monoid.html#t:Monoid">Monoid</a> m => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> m -> m <a href="#v:fold" class="selflink">#</a></p><p class="src"><a href="#v:foldMap">foldMap</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Monoid.html#t:Monoid">Monoid</a> m => (a -> m) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> m <a href="#v:foldMap" class="selflink">#</a></p><p class="src"><a href="#v:foldr">foldr</a> :: (a -> b -> b) -> b -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> b <a href="#v:foldr" class="selflink">#</a></p><p class="src"><a href="#v:foldr-39-">foldr'</a> :: (a -> b -> b) -> b -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> b <a href="#v:foldr-39-" class="selflink">#</a></p><p class="src"><a href="#v:foldl">foldl</a> :: (b -> a -> b) -> b -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> b <a href="#v:foldl" class="selflink">#</a></p><p class="src"><a href="#v:foldl-39-">foldl'</a> :: (b -> a -> b) -> b -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> b <a href="#v:foldl-39-" class="selflink">#</a></p><p class="src"><a href="#v:foldr1">foldr1</a> :: (a -> a -> a) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> a <a href="#v:foldr1" class="selflink">#</a></p><p class="src"><a href="#v:foldl1">foldl1</a> :: (a -> a -> a) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> a <a href="#v:foldl1" class="selflink">#</a></p><p class="src"><a href="#v:toList">toList</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> [a] <a href="#v:toList" class="selflink">#</a></p><p class="src"><a href="#v:null">null</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:null" class="selflink">#</a></p><p class="src"><a href="#v:length">length</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="#v:length" class="selflink">#</a></p><p class="src"><a href="#v:elem">elem</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a => a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:elem" class="selflink">#</a></p><p class="src"><a href="#v:maximum">maximum</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> a <a href="#v:maximum" class="selflink">#</a></p><p class="src"><a href="#v:minimum">minimum</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> a <a href="#v:minimum" class="selflink">#</a></p><p class="src"><a href="#v:sum">sum</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Num">Num</a> a => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> a <a href="#v:sum" class="selflink">#</a></p><p class="src"><a href="#v:product">product</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Num">Num</a> a => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> a <a href="#v:product" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Dendrogram:Traversable:3" class="instance expander" onclick="toggleSection('i:id:Dendrogram:Traversable:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Traversable.html#t:Traversable">Traversable</a> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-38" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Dendrogram:Traversable:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:traverse">traverse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Applicative.html#t:Applicative">Applicative</a> f => (a -> f b) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> f (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> b) <a href="#v:traverse" class="selflink">#</a></p><p class="src"><a href="#v:sequenceA">sequenceA</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Applicative.html#t:Applicative">Applicative</a> f => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> (f a) -> f (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a) <a href="#v:sequenceA" class="selflink">#</a></p><p class="src"><a href="#v:mapM">mapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m b) -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> m (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> b) <a href="#v:mapM" class="selflink">#</a></p><p class="src"><a href="#v:sequence">sequence</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> (m a) -> m (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a) <a href="#v:sequence" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Dendrogram:Eq:4" class="instance expander" onclick="toggleSection('i:id:Dendrogram:Eq:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a)</span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-24" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Dendrogram:Eq:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Dendrogram:Ord:5" class="instance expander" onclick="toggleSection('i:id:Dendrogram:Ord:5')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a)</span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-24" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Dendrogram:Ord:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a <a href="#v:min" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Dendrogram:Show:6" class="instance expander" onclick="toggleSection('i:id:Dendrogram:Show:6')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> a => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> (<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a)</span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-24" class="link">Source</a> <a href="#t:Dendrogram" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Dendrogram:Show:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:Distance" class="def">Distance</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Double">Double</a> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#Distance" class="link">Source</a> <a href="#t:Distance" class="selflink">#</a></p><div class="doc"><p>A distance is simply a synonym of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Double">Double</a></code> for efficiency.</p></div></div><div class="top"><p class="src"><a id="v:elements" class="def">elements</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> [a] <a href="src/Data-Clustering-Hierarchical.html#elements" class="link">Source</a> <a href="#v:elements" class="selflink">#</a></p><div class="doc"><p>List of elements in a dendrogram.</p></div></div><div class="top"><p class="src"><a id="v:cutAt" class="def">cutAt</a> :: <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a -> <a href="Data-Clustering-Hierarchical.html#t:Distance">Distance</a> -> [<a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a] <a href="src/Data-Clustering-Hierarchical.html#cutAt" class="link">Source</a> <a href="#v:cutAt" class="selflink">#</a></p><div class="doc"><p><code>dendro `cutAt` threshold</code> cuts the dendrogram <code>dendro</code> at
all branches which have distances strictly greater than
<code>threshold</code>.</p><p>For example, suppose we have</p><pre>dendro = Branch 0.8
(Branch 0.5
(Branch 0.2
(Leaf 'A')
(Leaf 'B'))
(Leaf 'C'))
(Leaf 'D')
</pre><p>Then:</p><pre>dendro `cutAt` 0.9 == dendro `cutAt` 0.8 == [dendro] -- no changes
dendro `cutAt` 0.7 == dendro `cutAt` 0.5 == [Branch 0.5 (Branch 0.2 (Leaf 'A') (Leaf 'B')) (Leaf 'C'), Leaf 'D']
dendro `cutAt` 0.4 == dendro `cutAt` 0.2 == [Branch 0.2 (Leaf 'A') (Leaf 'B'), Leaf 'C', Leaf 'D']
dendro `cutAt` 0.1 == [Leaf 'A', Leaf 'B', Leaf 'C', Leaf 'D'] -- no branches at all
</pre></div></div><h1 id="g:2">Linkage data type</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Linkage" class="def">Linkage</a> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#Linkage" class="link">Source</a> <a href="#t:Linkage" class="selflink">#</a></p><div class="doc"><p>The linkage type determines how the distance between
clusters will be calculated. These are the linkage types
currently available on this library.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:SingleLinkage" class="def">SingleLinkage</a></td><td class="doc"><p>The distance between two clusters <code>a</code> and <code>b</code> is the
<em>minimum</em> distance between an element of <code>a</code> and an element
of <code>b</code>.</p></td></tr><tr><td class="src"><a id="v:CompleteLinkage" class="def">CompleteLinkage</a></td><td class="doc"><p>The distance between two clusters <code>a</code> and <code>b</code> is the
<em>maximum</em> distance between an element of <code>a</code> and an element
of <code>b</code>.</p></td></tr><tr><td class="src"><a id="v:CLINK" class="def">CLINK</a></td><td class="doc"><p>The same as <code><a href="Data-Clustering-Hierarchical.html#v:CompleteLinkage">CompleteLinkage</a></code>, but using the CLINK
algorithm. It's much faster however doesn't always give the
best complete linkage dendrogram.</p></td></tr><tr><td class="src"><a id="v:UPGMA" class="def">UPGMA</a></td><td class="doc"><p>Unweighted Pair Group Method with Arithmetic mean, also
called "average linkage". The distance between two
clusters <code>a</code> and <code>b</code> is the <em>arithmetic average</em> between the
distances of all elements in <code>a</code> to all elements in <code>b</code>.</p></td></tr><tr><td class="src"><a id="v:FakeAverageLinkage" class="def">FakeAverageLinkage</a></td><td class="doc"><p>This method is usually wrongly called "average linkage".
The distance between cluster <code>a = a1 U a2</code> (that is, cluster
<code>a</code> was formed by the linkage of clusters <code>a1</code> and <code>a2</code>) and
an old cluster <code>b</code> is <code>(d(a1,b) + d(a2,b)) / 2</code>. So when
clustering two elements to create a cluster, this method is
the same as UPGMA. However, in general when joining two
clusters this method assigns equal weights to <code>a1</code> and <code>a2</code>,
while UPGMA assigns weights proportional to the number of
elements in each cluster. See, for example:</p><ul><li><a href="http://www.cs.tau.ac.il/~rshamir/algmb/00/scribe00/html/lec08/node21.html">http://www.cs.tau.ac.il/~rshamir/algmb/00/scribe00/html/lec08/node21.html</a>,
which defines the real UPGMA and gives the equation to
calculate the distance between an old and a new cluster.</li><li><a href="http://github.com/JadeFerret/ai4r/blob/master/lib/ai4r/clusterers/average_linkage.rb">http://github.com/JadeFerret/ai4r/blob/master/lib/ai4r/clusterers/average_linkage.rb</a>,
code for "average linkage" on ai4r library implementing
what we call here <code>FakeAverageLinkage</code> and not UPGMA.</li></ul></td></tr></table></div><div class="subs instances"><p id="control.i:Linkage" class="caption collapser" onclick="toggleSection('i:Linkage')">Instances</p><div id="section.i:Linkage" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Linkage:Enum:1" class="instance expander" onclick="toggleSection('i:id:Linkage:Enum:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Enum">Enum</a> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-84" class="link">Source</a> <a href="#t:Linkage" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Linkage:Enum:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:succ">succ</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> <a href="#v:succ" class="selflink">#</a></p><p class="src"><a href="#v:pred">pred</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> <a href="#v:pred" class="selflink">#</a></p><p class="src"><a href="#v:toEnum">toEnum</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> <a href="#v:toEnum" class="selflink">#</a></p><p class="src"><a href="#v:fromEnum">fromEnum</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="#v:fromEnum" class="selflink">#</a></p><p class="src"><a href="#v:enumFrom">enumFrom</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> [<a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a>] <a href="#v:enumFrom" class="selflink">#</a></p><p class="src"><a href="#v:enumFromThen">enumFromThen</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> [<a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a>] <a href="#v:enumFromThen" class="selflink">#</a></p><p class="src"><a href="#v:enumFromTo">enumFromTo</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> [<a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a>] <a href="#v:enumFromTo" class="selflink">#</a></p><p class="src"><a href="#v:enumFromThenTo">enumFromThenTo</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> [<a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a>] <a href="#v:enumFromThenTo" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Linkage:Eq:2" class="instance expander" onclick="toggleSection('i:id:Linkage:Eq:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-84" class="link">Source</a> <a href="#t:Linkage" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Linkage:Eq:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Linkage:Ord:3" class="instance expander" onclick="toggleSection('i:id:Linkage:Ord:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-84" class="link">Source</a> <a href="#t:Linkage" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Linkage:Ord:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> <a href="#v:min" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Linkage:Show:4" class="instance expander" onclick="toggleSection('i:id:Linkage:Show:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a></span> <a href="src/Data-Clustering-Hierarchical-Internal-Types.html#line-84" class="link">Source</a> <a href="#t:Linkage" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:id:Linkage:Show:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:3">Clustering function</h1><div class="top"><p class="src"><a id="v:dendrogram" class="def">dendrogram</a> <a href="src/Data-Clustering-Hierarchical.html#dendrogram" class="link">Source</a> <a href="#v:dendrogram" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Clustering-Hierarchical.html#t:Linkage">Linkage</a></td><td class="doc"><p>Linkage type to be used.</p></td></tr><tr><td class="src">-> [a]</td><td class="doc"><p>Items to be clustered.</p></td></tr><tr><td class="src">-> (a -> a -> <a href="Data-Clustering-Hierarchical.html#t:Distance">Distance</a>)</td><td class="doc"><p>Distance function between items.</p></td></tr><tr><td class="src">-> <a href="Data-Clustering-Hierarchical.html#t:Dendrogram">Dendrogram</a> a</td><td class="doc"><p>Complete dendrogram.</p></td></tr></table></div><div class="doc"><p>Calculates a complete, rooted dendrogram for a list of items
and a linkage type. The following are the time and space
complexities for each linkage:</p><dl><dt><code><a href="Data-Clustering-Hierarchical.html#v:SingleLinkage">SingleLinkage</a></code></dt><dd><em>O(n^2)</em> time and <em>O(n)</em> space, using the
SLINK algorithm. This algorithm is optimal in both space
and time and gives the same answer as the naive algorithm
using a distance matrix.</dd><dt><code><a href="Data-Clustering-Hierarchical.html#v:CompleteLinkage">CompleteLinkage</a></code></dt><dd><em>O(n^3)</em> time and <em>O(n^2)</em> space, using
the naive algorithm with a distance matrix. Use <code><a href="Data-Clustering-Hierarchical.html#v:CLINK">CLINK</a></code> if
you need more performance.</dd><dt>Complete linkage with <code><a href="Data-Clustering-Hierarchical.html#v:CLINK">CLINK</a></code></dt><dd><em>O(n^2)</em> time and <em>O(n)</em>
space, using the CLINK algorithm. Note that this algorithm
doesn't always give the same answer as the naive algorithm
using a distance matrix, but it's much faster.</dd><dt><code><a href="Data-Clustering-Hierarchical.html#v:UPGMA">UPGMA</a></code></dt><dd><em>O(n^3)</em> time and <em>O(n^2)</em> space, using the naive
algorithm with a distance matrix.</dd><dt><code><a href="Data-Clustering-Hierarchical.html#v:FakeAverageLinkage">FakeAverageLinkage</a></code></dt><dd><em>O(n^3)</em> time and <em>O(n^2)</em> space, using
the naive algorithm with a distance matrix.</dd></dl></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|