Answers.Body: <p>The two step approach will be used in any cluster algorithm (except see &quot;network theory&quot; below), you just may not see it. Clustering methods are very common in genomics, they are popular because they are very visual and will stack against a heatmap nicely. They have been replaced by dimensionality reduction such as PCA type analysis. For data mining PCA is a much more robust method for a number of reasons for example they overcome the problems listed as &quot;The Bad&quot; and &quot;The Ugly&quot; below. PCA type analysis is difficult to visualise, particularly when it steps into multi-dimensions and thats why developers like clustering ... easy for the developer to understand and easy for the use to visually appreciate, particularly against a heat map.</p>
  <p><strong>Any classical clustering</strong> The first step is to build a matrix and the second is to reorganise the relationships within the matrix using a pre-defined algorithm, unweighted pairwise group method with arithmetic mean (UPGMA).</p>
  <ol>
  <li>The matrix in this case will be the grid.</li>
  <li>The second step is the clustering method. The method used ConsensusClusterPlus by <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2881355/" rel="nofollow noreferrer">Wilkerson and Hayes (2010)</a> is, 0</li>
  </ol>
  <blockquote>
  <p>The consensus clustering (CC) method provides quantitative and visual stability evidence for estimating the number of unsupervised classes in a dataset.</p>
  </blockquote>
  <p>All that means is it stacks a heat map onto a clustering tree. Here's the output of the paper and the 'workhorse' is the tree presented in &quot;A&quot;,</p>
  <p><a href="https://i.sstatic.net/d96jt.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/d96jt.jpg" alt="enter image description here" /></a></p>
  <p>Like all great movies, it has 3 faces,</p>
  <p><strong>The Good</strong> using <code>k-means clustering</code> and that is well respected method in supervised-learning and suspect it performs pretty well in unsupervised learning too. It's a good method.</p>
  <p><strong>The bad</strong> There could easily be artefacts in the deeper relationships of the tree and that would need a full empirical investigation. I know that because genetic diversity is often measured by trees and loads of attention has gone into modelling the process and CCP is assuming homogeneity in the rate process - which rarely hplds in biology. Thus, there will be situations where that falls over, however, what I strongly suspect is that the k-means methods is attempting to circumvent this situation, without doing so explicitly (if that makes any sense). I would need to study the algorithm to assess this and I would not use clustering in data mining/unsupervised learning.</p>
  <p><strong>The Ugly</strong> The basic problem with clustering and the reason it isn't used in genetic diversity <strong>*</strong>, is because there's loads of clustering algorithms, they give different answers and there's no way to distinguish which is which. Having said all that <code>k-means clustering</code> is very respectable.</p>
  <p>The reason it's not common is that there has never been a consensus on the cluster algorithm and modellers prefer to avoid them because they are only used for data exploration/mining and not useful for hypothesis testing. <em>However</em> I do stress that <code>k-means</code> supervised learning is a very good method, but that is not the same as clustering (which is unsupervised learning).</p>
  <p><strong>*</strong> or at least if it is used its just a method to visual a matrix and a like <em>Warning clustering!</em> will appear somewhere in the legend.</p>
  <hr />
  <p><strong>Parameters and conclusion</strong> There is a parameter issue with the Figure above is tracking manually. It demonstrates <em>k</em> has a <em>HUGE</em> influence on the result. In real world supervised learning parameterisation is automated, never ever would it be done manually. The technique is called parameterisation and it's kinda important (so like the user can't use a parameter that gives an output that suits them!! [I've not said that BTW]). So you'd ask an algorithm above the <em>k</em>=<em>x</em> algorithm to find the optimal value of <em>k</em>.</p>
  <p><em>If</em> <code>FlowSOM</code> automates the value for <em>k</em> and then tells you ... thats good and I'd be happy with that. <em>If</em> it doesn't, you have to manually feed loads of values of <em>k</em> and provide an independent assessment on which was the best. That is not cool and you will have to perform a laborious manual calculation.</p>
  <hr />
  <p><strong>Network theory</strong> Leiden looks to be part of network theory e.g. <a href="https://www.nature.com/articles/s41598-019-41695-z" rel="nofollow noreferrer">Trag and van Eck (2019)</a>. That is a significant advantage over classical clustering, because network theory is being dumped over the top, i.e. the third step, which can yield real power over the data set. Personally I follow graph theory, but both have major potential and are heavily under-utilised. Its not really fair to compare a classical method with the power of network theory. Certainly when entering graph theory what you can leverage from the graph (network) is enormous. I personally, thought the whole area was being ignored (there's lots of applications), but maybe its time will yet come into the mainstream.</p>
  <hr />
  <p>To @Pallie's comments of</p>
  <p><strong>dimensionality and distance</strong>. I do not disagree at all and is the reason why dimensionality reduction approaches such as PCA or multi-dimensional scaling are preferred.</p>
  <p><strong>RAM overhead</strong> Of course the calculation will be hard on RAM: if <em>k</em> was fixed at 2 or 3, it will run reasonably quickly, but might not be meaning. Any <em>k</em> parameterisation will be RAM intensive, but IMO thats the nature of big data calculation and cloud computing: you just pick a computer with loads of RAM or just fit more RAM. There will also be a risk of course of RAM bottlenecks on standard machines (where it just freezes). The key thing is whether the approaches are giving biologically significant different results and personally I would consider it empirically. These are different calculations and this is complex data.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T04:24:02.453Z
Answers.Text: There is a lot of great info in your response. We might be counting the steps differently. Your step 1 ("the matrix in this case will be the grid") I would consider to be step 2. Step 1 would be generating the grid. Why generate the SOM grid if you can just run ConsensusClusterPlus directly on the samples?
Answers.UserDisplayName: burger
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T09:13:56.047Z
Answers.Text: People have started using Leiden (a continuation of Louvain, optimizing graph partitions for modularity score) because A) Curse of dimensionality makes distances meaningless in 20k dimensions B) K-means algorithms take far  too long to run and far too much memory on single cell sized datasets (100k * 20k).
Answers.UserDisplayName: Pallie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T13:59:19.293Z
Answers.Text: @burger yes we are counting the steps differently. I would count your second step as two steps within clustering. I would see "your step 1" as preparing the data set for step 2 (which is my original step 1). There could be transformations or standardisations in your step 1.  The later being very likely, almost certain and without it the results could subject to significant artefacts.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T14:07:22.203Z
Answers.Text: @Pallie, thanks for your reply, I've addressed both points above. I certainly agree with the first point.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T18:51:50.820Z
Answers.Text: I just wanted to add a bit regarding dimensionality. My example was using FlowSOM, which is designed for flow data, which was limited to less than 10 markers when it was first released. Thus, unlike scRNA-seq with thousands of genes, there is not much additional dimensionality reduction possible. That may explain some of the choices they made.
Answers.UserDisplayName: burger
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T20:47:28.593Z
Answers.Text: Thanks @burger understand, yes agreed.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-07T00:20:48.483Z
Answers.LastActivityDate: 2022-12-07T14:52:53.620Z
Answers.LastEditDate: 2022-12-07T14:52:53.620Z
Answers.UserDisplayName: M__
Body: <p>There are a few different commonly used clustering algorithms within the single-cell space, although Leiden seems to be the top choice these days. <a href="https://bioconductor.org/packages/release/bioc/html/FlowSOM.html" rel="nofollow noreferrer">FlowSOM</a> is a classic package for analyzing flow cytometry data. It has a two-step approach for clustering. First, it builds a self-organizing map (SOM) where cells are assigned to 100 grid points. Then, it uses ConsensusClusterPlus to meta-cluster the SOM codes. I have not seen other packages that take this approach. There is no publication for FlowSOM and the documentation does not explain this part. Why this two-step approach and why isn't this more common?</p>
  
Tags: <single-cell><clustering><flow-cytometry>
Title: FlowSOM multi-step clustering
ThreadText: # FlowSOM multi-step clustering
  
  (Asked by: username_0 on 2022-12-06)
  
  There are a few different commonly used clustering algorithms within the single-cell space, although Leiden seems to be the top choice these days. [FlowSOM](https://bioconductor.org/packages/release/bioc/html/FlowSOM.html) is a classic package for analyzing flow cytometry data. It has a two-step approach for clustering. First, it builds a self-organizing map (SOM) where cells are assigned to 100 grid points. Then, it uses ConsensusClusterPlus to meta-cluster the SOM codes. I have not seen other packages that take this approach. There is no publication for FlowSOM and the documentation does not explain this part. Why this two-step approach and why isn't this more common?
  
  **Tags:** single-cell, clustering, flow-cytometry
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-07. Score: 1
  
  The two step approach will be used in any cluster algorithm (except see "network theory" below), you just may not see it. Clustering methods are very common in genomics, they are popular because they are very visual and will stack against a heatmap nicely. They have been replaced by dimensionality reduction such as PCA type analysis. For data mining PCA is a much more robust method for a number of reasons for example they overcome the problems listed as "The Bad" and "The Ugly" below. PCA type analysis is difficult to visualise, particularly when it steps into multi-dimensions and thats why developers like clustering ... easy for the developer to understand and easy for the use to visually appreciate, particularly against a heat map.
  
  **Any classical clustering** The first step is to build a matrix and the second is to reorganise the relationships within the matrix using a pre-defined algorithm, unweighted pairwise group method with arithmetic mean (UPGMA).
  
  1. The matrix in this case will be the grid.
  2. The second step is the clustering method. The method used ConsensusClusterPlus by [Wilkerson and Hayes (2010)](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2881355/) is, 0
  
  > The consensus clustering (CC) method provides quantitative and visual stability evidence for estimating the number of unsupervised classes in a dataset.
  
  All that means is it stacks a heat map onto a clustering tree. Here's the output of the paper and the 'workhorse' is the tree presented in "A",
  
  [![enter image description here](https://i.sstatic.net/d96jt.jpg)](https://i.sstatic.net/d96jt.jpg)
  
  Like all great movies, it has 3 faces,
  
  **The Good** using `k-means clustering` and that is well respected method in supervised-learning and suspect it performs pretty well in unsupervised learning too. It's a good method.
  
  **The bad** There could easily be artefacts in the deeper relationships of the tree and that would need a full empirical investigation. I know that because genetic diversity is often measured by trees and loads of attention has gone into modelling the process and CCP is assuming homogeneity in the rate process - which rarely hplds in biology. Thus, there will be situations where that falls over, however, what I strongly suspect is that the k-means methods is attempting to circumvent this situation, without doing so explicitly (if that makes any sense). I would need to study the algorithm to assess this and I would not use clustering in data mining/unsupervised learning.
  
  **The Ugly** The basic problem with clustering and the reason it isn't used in genetic diversity **\***, is because there's loads of clustering algorithms, they give different answers and there's no way to distinguish which is which. Having said all that `k-means clustering` is very respectable.
  
  The reason it's not common is that there has never been a consensus on the cluster algorithm and modellers prefer to avoid them because they are only used for data exploration/mining and not useful for hypothesis testing. *However* I do stress that `k-means` supervised learning is a very good method, but that is not the same as clustering (which is unsupervised learning).
  
  **\*** or at least if it is used its just a method to visual a matrix and a like *Warning clustering!* will appear somewhere in the legend.
  
  ---
  
  **Parameters and conclusion** There is a parameter issue with the Figure above is tracking manually. It demonstrates *k* has a *HUGE* influence on the result. In real world supervised learning parameterisation is automated, never ever would it be done manually. The technique is called parameterisation and it's kinda important (so like the user can't use a parameter that gives an output that suits them!! [I've not said that BTW]). So you'd ask an algorithm above the *k*=*x* algorithm to find the optimal value of *k*.
  
  *If* `FlowSOM` automates the value for *k* and then tells you ... thats good and I'd be happy with that. *If* it doesn't, you have to manually feed loads of values of *k* and provide an independent assessment on which was the best. That is not cool and you will have to perform a laborious manual calculation.
  
  ---
  
  **Network theory** Leiden looks to be part of network theory e.g. [Trag and van Eck (2019)](https://www.nature.com/articles/s41598-019-41695-z). That is a significant advantage over classical clustering, because network theory is being dumped over the top, i.e. the third step, which can yield real power over the data set. Personally I follow graph theory, but both have major potential and are heavily under-utilised. Its not really fair to compare a classical method with the power of network theory. Certainly when entering graph theory what you can leverage from the graph (network) is enormous. I personally, thought the whole area was being ignored (there's lots of applications), but maybe its time will yet come into the mainstream.
  
  ---
  
  To @username_2's comments of
  
  **dimensionality and distance**. I do not disagree at all and is the reason why dimensionality reduction approaches such as PCA or multi-dimensional scaling are preferred.
  
  **RAM overhead** Of course the calculation will be hard on RAM: if *k* was fixed at 2 or 3, it will run reasonably quickly, but might not be meaning. Any *k* parameterisation will be RAM intensive, but IMO thats the nature of big data calculation and cloud computing: you just pick a computer with loads of RAM or just fit more RAM. There will also be a risk of course of RAM bottlenecks on standard machines (where it just freezes). The key thing is whether the approaches are giving biologically significant different results and personally I would consider it empirically. These are different calculations and this is complex data.
  
  > **Comments:**
  > **username_0**: There is a lot of great info in your response. We might be counting the steps differently. Your step 1 ("the matrix in this case will be the grid") I would consider to be step 2. Step 1 would be generating the grid. Why generate the SOM grid if you can just run ConsensusClusterPlus directly on the samples?  
  > **username_2**: People have started using Leiden (a continuation of Louvain, optimizing graph partitions for modularity score) because A) Curse of dimensionality makes distances meaningless in 20k dimensions B) K-means algorithms take far  too long to run and far too much memory on single cell sized datasets (100k * 20k).  
  > **username_1**: @username_0 yes we are counting the steps differently. I would count your second step as two steps within clustering. I would see "your step 1" as preparing the data set for step 2 (which is my original step 1). There could be transformations or standardisations in your step 1.  The later being very likely, almost certain and without it the results could subject to significant artefacts.  
  > **username_1**: @username_2, thanks for your reply, I've addressed both points above. I certainly agree with the first point.  
  > **username_0**: I just wanted to add a bit regarding dimensionality. My example was using FlowSOM, which is designed for flow data, which was limited to less than 10 markers when it was first released. Thus, unlike scRNA-seq with thousands of genes, there is not much additional dimensionality reduction possible. That may explain some of the choices they made.  
  > **username_1**: Thanks @username_0 understand, yes agreed.  
  
  ---
  
  