Skip to content

Commit 5ff4f8d

Browse files
committed
Refine documentation for FAQ, troubleshooting, and basic concepts
- Enhanced the `faq.rst` by improving formatting and clarity, ensuring questions are more accessible and informative for users. - Updated `troubleshooting.rst` to streamline problem descriptions and solutions, making it easier for users to find relevant information. - Revised `basic_concepts.rst` to improve readability and organization, ensuring key concepts are clearly defined and easy to understand. - Removed outdated sections and improved overall structure across the documentation, enhancing user experience and comprehension of TorchSOM functionalities.
1 parent cff8e60 commit 5ff4f8d

File tree

6 files changed

+45
-86
lines changed

6 files changed

+45
-86
lines changed

docs/source/faq.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ General Questions
55
-----------------
66

77
What is TorchSOM?
8-
~~~~~~~~~~~~~~~~
8+
~~~~~~~~~~~~~~~~~
99

1010
TorchSOM is a modern PyTorch-based implementation of Self-Organizing Maps (SOMs), designed for efficient training and comprehensive visualization of high-dimensional data clustering and analysis.
1111

1212
How does TorchSOM differ from other SOM implementations?
13-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1414

1515
TorchSOM offers several advantages:
1616

@@ -23,22 +23,22 @@ Installation and Setup
2323
----------------------
2424

2525
Which Python versions are supported?
26-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2727

2828
We recommend using Python 3.9+.
2929

3030
Do I need a GPU to use TorchSOM?
31-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3232

3333
No, TorchSOM works on both CPU and GPU.
3434
However, GPU acceleration significantly improves training speed for large datasets and maps.
3535
We recommend using a GPU for training.
3636

3737
Data Preprocessing
38-
-----------------
38+
------------------
3939

4040
Should I always normalize my data?
41-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4242

4343
Yes, normalization is crucial because:
4444

@@ -47,7 +47,7 @@ Yes, normalization is crucial because:
4747
- StandardScaler or MinMaxScaler from scikit-learn both work well
4848

4949
What about categorical features?
50-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5151

5252
SOMs operate exclusively on numerical data. Therefore, it is essential to convert any categorical features into a numerical format before using them with TorchSOM. Common strategies include:
5353

@@ -63,7 +63,7 @@ Performance and Optimization
6363
----------------------------
6464

6565
My training is very slow. How can I speed it up?
66-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6767

6868
Try these optimizations:
6969

@@ -74,7 +74,7 @@ Try these optimizations:
7474
5. **Reduce epochs**: Monitor convergence and stop early
7575

7676
How much memory does TorchSOM use?
77-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7878

7979
Memory usage depends on:
8080

@@ -88,10 +88,10 @@ For large datasets, consider:
8888
- Reducing precision (float32 vs float64)
8989

9090
Visualization Issues
91-
-------------------
91+
--------------------
9292

9393
Why are some neurons white in my visualizations?
94-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9595

9696
White neurons typically indicate:
9797

@@ -102,7 +102,7 @@ White neurons typically indicate:
102102
This is normal for sparse data or oversized maps.
103103

104104
How do I interpret the distance map (D-Matrix)?
105-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106106

107107
In the D-Matrix:
108108

@@ -111,25 +111,25 @@ In the D-Matrix:
111111
- **Patterns**: Reveal cluster structure and boundaries
112112

113113
Can I customize the visualization colors?
114-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
114+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115115

116116
Yes! Use the VisualizationConfig:
117117

118118
.. code-block:: python
119119
120120
from torchsom.visualization.config import VisualizationConfig
121-
121+
122122
config = VisualizationConfig(
123123
cmap="plasma", # Use a different colormap
124124
figsize=(15, 10), # Set larger figure size
125125
dpi=300 # Set higher resolution
126126
)
127127
128128
Advanced Topics
129-
--------------
129+
---------------
130130

131131
Can I use TorchSOM for time series data?
132-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133133

134134
TorchSOM is designed to work with tabular data, meaning any data type—such as time series, images, or text—can be used as long as it is represented in a tabular (2D array) format.
135135
This typically means that each sample should be a fixed-length feature vector.
@@ -139,7 +139,7 @@ Common approaches include extracting statistical features, flattening fixed-leng
139139
As long as your data can be converted into a matrix of shape `[n_samples, n_features]`, it can be used with TorchSOM.
140140

141141
How do I implement custom distance functions?
142-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143143

144144
Create a function following the signature:
145145

@@ -157,7 +157,7 @@ Create a function following the signature:
157157
return distances
158158
159159
Can I save and load trained SOMs?
160-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161161

162162
Yes, use PyTorch's standard mechanisms:
163163

@@ -171,10 +171,10 @@ Yes, use PyTorch's standard mechanisms:
171171
som.load_state_dict(torch.load('som_weights.pth'))
172172
173173
Integration Questions
174-
--------------------
174+
---------------------
175175

176176
How do I cite TorchSOM in my research?
177-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178178

179179
Please cite TorchSOM as:
180180

@@ -198,17 +198,17 @@ Please cite TorchSOM as:
198198
}
199199
200200
Getting Help
201-
-----------
201+
------------
202202

203203
Where can I get more help?
204-
~~~~~~~~~~~~~~~~~~~~~~~~~
204+
~~~~~~~~~~~~~~~~~~~~~~~~~~
205205

206206
1. **`Documentation <https://opensource.michelin.io/TorchSOM/>`_**: Check our comprehensive guides
207207
2. **`GitHub Issues <https://github.com/michelin/TorchSOM/issues>`_**: Report bugs and request features
208208
3. **`Notebooks <https://github.com/michelin/TorchSOM/tree/main/notebooks>`_**: See our tutorial notebooks.
209209

210210
How do I report a bug?
211-
~~~~~~~~~~~~~~~~~~~~
211+
~~~~~~~~~~~~~~~~~~~~~~
212212

213213
Please include:
214214

@@ -220,7 +220,7 @@ Please include:
220220
6. **Full error traceback**
221221

222222
Can I contribute to TorchSOM?
223-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
223+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224224

225225
Yes! We welcome contributions:
226226

docs/source/getting_started/basic_concepts.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ SOMs organize neurons in a grid structure:
7676
- Better for circular/radial patterns
7777

7878
2. Neighborhood Function
79-
~~~~~~~~~~~~~~~~~~~~~~~
79+
~~~~~~~~~~~~~~~~~~~~~~~~
8080

8181
Determines how much each neuron is affected by the BMU:
8282

@@ -91,7 +91,7 @@ Determines how much each neuron is affected by the BMU:
9191
Linear decay from BMU to neighborhood boundary
9292

9393
3. Learning Rate Decay
94-
~~~~~~~~~~~~~~~~~~~~~
94+
~~~~~~~~~~~~~~~~~~~~~~
9595

9696
Controls how much weights change during training:
9797

@@ -104,7 +104,7 @@ Controls how much weights change during training:
104104
\alpha(t) = \alpha_0 \cdot (1 - t/T)
105105
106106
4. Distance Functions
107-
~~~~~~~~~~~~~~~~~~~~
107+
~~~~~~~~~~~~~~~~~~~~~
108108

109109
Different ways to measure similarity:
110110

@@ -123,15 +123,15 @@ Strengths and Weaknesses
123123
------------------------
124124

125125
Advantages
126-
~~~~~~~~~
126+
~~~~~~~~~~
127127

128128
- **No assumptions** about data distribution
129129
- **Topology preservation** maintains relationships
130130
- **Intuitive visualization** of complex data
131131
- **Unsupervised learning** - no labels needed
132132

133133
Limitations
134-
~~~~~~~~~~
134+
~~~~~~~~~~~
135135

136136
- **Computationally expensive** for large datasets
137137
- **Parameter sensitive** - requires tuning
@@ -141,21 +141,21 @@ Best Practices
141141
--------------
142142

143143
Data Preparation
144-
~~~~~~~~~~~~~~~
144+
~~~~~~~~~~~~~~~~
145145

146146
1. **Normalize features** to similar scales
147147
2. **Remove highly correlated** features
148148
3. **Handle missing values** appropriately
149149
4. **Consider dimensionality reduction** for very high dimensions
150150

151151
Parameter Selection
152-
~~~~~~~~~~~~~~~~~~
152+
~~~~~~~~~~~~~~~~~~~
153153

154154
1. **Experiment with different** topologies and functions
155155
2. **Monitor training progress** with error curves to guide parameter choice
156156

157157
Interpretation
158-
~~~~~~~~~~~~~
158+
~~~~~~~~~~~~~~
159159

160160
1. **Use multiple visualizations** to understand the map
161161
2. **Combine with domain knowledge** for meaningful insights

docs/source/getting_started/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Here's a complete example with data preprocessing and multiple visualizations:
176176
)
177177
178178
What's Next?
179-
-----------
179+
------------
180180

181181
Now that you've created your first SOM, explore:
182182

docs/source/index.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,6 @@ Documentation Structure
9191

9292
user_guide/visualization_help
9393

94-
.. toctree::
95-
:maxdepth: 2
96-
:caption: Tutorials & Examples
97-
98-
tutorials/basic_clustering
99-
tutorials/data_exploration
100-
tutorials/advanced_techniques
101-
tutorials/custom_implementations
102-
10394
.. toctree::
10495
:maxdepth: 2
10596
:caption: API Reference

docs/source/troubleshooting.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Installation Issues
77
-------------------
88

99
Package Issues
10-
~~~~~~~~~~~~~~~~~~~
10+
~~~~~~~~~~~~~~
1111

1212
.. code-block:: bash
1313
@@ -114,7 +114,7 @@ Training Problems
114114
-----------------
115115

116116
Training doesn't converge
117-
~~~~~~~~~~~~~~~~~~~~~~~~~
117+
~~~~~~~~~~~~~~~~~~~~~~~~~~
118118

119119
**Symptoms**: Quantization error doesn't decrease or fluctuates wildly.
120120

@@ -203,7 +203,7 @@ Very slow training
203203
print(f"Training time: {time.time() - start_time:.2f} seconds")
204204
205205
NaN values in results
206-
~~~~~~~~~~~~~~~~~~~~
206+
~~~~~~~~~~~~~~~~~~~~~
207207

208208
**Problem**: Getting NaN values in errors or visualizations.
209209

@@ -279,7 +279,7 @@ Empty or white visualizations
279279
viz = SOMVisualizer(som, config=config)
280280
281281
Figures not displaying
282-
~~~~~~~~~~~~~~~~~~~~~
282+
~~~~~~~~~~~~~~~~~~~~~~
283283

284284
**Problem**: Plots don't show up in Jupyter notebooks or scripts.
285285

@@ -307,7 +307,7 @@ Figures not displaying
307307
viz.plot_distance_map(save_path="results", fig_name="distance_map")
308308
309309
Poor visualization quality
310-
~~~~~~~~~~~~~~~~~~~~~~~~~
310+
~~~~~~~~~~~~~~~~~~~~~~~~~~
311311

312312
**Problem**: Plots look pixelated or unclear.
313313

@@ -338,7 +338,7 @@ Data Issues
338338
-----------
339339

340340
Poor clustering results
341-
~~~~~~~~~~~~~~~~~~~~~~
341+
~~~~~~~~~~~~~~~~~~~~~~~
342342

343343
**Problem**: SOM doesn't find meaningful clusters.
344344

@@ -443,7 +443,7 @@ ValidationError from Pydantic
443443
print(f"- {error['loc'][0]}: {error['msg']}")
444444
445445
Parameter compatibility issues
446-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
446+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
447447

448448
**Problem**: Certain parameter combinations don't work.
449449

@@ -507,7 +507,7 @@ Memory usage too high
507507
som.fit(chunk) # Incremental training
508508
509509
Memory leaks
510-
~~~~~~~~~~~
510+
~~~~~~~~~~~~
511511

512512
**Problem**: Memory usage increases over time.
513513

@@ -539,7 +539,7 @@ Getting Help
539539
------------
540540

541541
Diagnostic Information
542-
~~~~~~~~~~~~~~~~~~~~~
542+
~~~~~~~~~~~~~~~~~~~~~~~
543543

544544
When reporting issues, please include:
545545

@@ -563,7 +563,7 @@ When reporting issues, please include:
563563
print(f"GPU {i}: {torch.cuda.get_device_name(i)}")
564564
565565
Creating Minimal Examples
566-
~~~~~~~~~~~~~~~~~~~~~~~~
566+
~~~~~~~~~~~~~~~~~~~~~~~~~
567567

568568
For bug reports, create minimal reproducible examples:
569569

@@ -586,7 +586,7 @@ For bug reports, create minimal reproducible examples:
586586
raise
587587
588588
Where to Get Help
589-
~~~~~~~~~~~~~~~~
589+
~~~~~~~~~~~~~~~~~
590590

591591
1. **Documentation**: Check our comprehensive guides first
592592
2. **FAQ**: Review the :doc:`faq` for common questions

0 commit comments

Comments
 (0)