Skip to content

Commit 8ca9994

Browse files
committed
The standalone module for dimension reduction.
1 parent 46c9ea8 commit 8ca9994

File tree

5 files changed

+488
-6
lines changed

5 files changed

+488
-6
lines changed

core/base/dimensionReduction/DimensionReduction.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ namespace ttk {
209209
this->se_Affinity = "precomputed";
210210
this->mds_Dissimilarity = "precomputed";
211211
this->tsne_Metric = "precomputed";
212+
this->tsne_Init = "random";
212213
this->iso_Metric = "precomputed";
213214
} else {
214215
this->se_Affinity = "nearest_neighbors";
@@ -258,7 +259,7 @@ namespace ttk {
258259
int tsne_MaxIterationProgress{300};
259260
float tsne_GradientThreshold{1e-7};
260261
std::string tsne_Metric{"euclidean"};
261-
std::string tsne_Init{"random"};
262+
std::string tsne_Init{"pca"};
262263
int tsne_Verbose{0};
263264
std::string tsne_Method{"barnes_hut"};
264265
float tsne_Angle{0.5};

core/base/topoMap/TopoMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bool computeConvexHull_aux(const std::vector<double> &coords,
2323
}
2424

2525
// Qhull gives us the coordinates of the points in the convex hull. Here we
26-
// retrive the indices of this points in the list we provided. We will also
26+
// retrieve the indices of this points in the list we provided. We will also
2727
// compute the barycenter of the points in the convex hull.
2828
for(const auto &u : qhull.vertexList()) {
2929
const orgQhull::QhullPoint &qhullPt = u.point();

paraview/xmls/DimensionReduction.xml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
295295
panel_visibility="advanced">
296296
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
297297
<Documentation>
298+
Kernel coefficient for rbf kernel. Only used if the affinity is set to rbf.
298299
</Documentation>
299300
</DoubleVectorProperty>
300301

@@ -348,6 +349,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
348349
panel_visibility="advanced">
349350
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
350351
<Documentation>
352+
Not used if the solver is set to dense.
351353
</Documentation>
352354
</DoubleVectorProperty>
353355

@@ -435,6 +437,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
435437
panel_visibility="advanced">
436438
<IntRangeDomain name="range" min="0" max="100" />
437439
<Documentation>
440+
Number of times the SMACOF algorithm will be run with different initializations. The final results will be the best output of the runs, determined by the run with the smallest final stress.
438441
</Documentation>
439442
</IntVectorProperty>
440443

@@ -446,6 +449,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
446449
panel_visibility="advanced">
447450
<IntRangeDomain name="range" min="0" max="100" />
448451
<Documentation>
452+
Maximum number of iterations of the SMACOF algorithm for a single run.
449453
</Documentation>
450454
</IntVectorProperty>
451455

@@ -468,6 +472,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
468472
panel_visibility="advanced">
469473
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
470474
<Documentation>
475+
Relative tolerance with respect to stress at which to declare convergence.
471476
</Documentation>
472477
</DoubleVectorProperty>
473478

@@ -477,8 +482,9 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
477482
number_of_elements="1"
478483
default_values="30"
479484
panel_visibility="advanced">
480-
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
485+
<DoubleRangeDomain name="range" min="5.0" max="50.0" />
481486
<Documentation>
487+
The perplexity is related to the number of nearest neighbors that is used in other manifold learning algorithms. Larger datasets usually require a larger perplexity. Consider selecting a value between 5 and 50.
482488
</Documentation>
483489
</DoubleVectorProperty>
484490

@@ -490,6 +496,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
490496
panel_visibility="advanced">
491497
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
492498
<Documentation>
499+
Controls how tight natural clusters in the original space are in the embedded space and how much space will be between them. For larger values, the space between natural clusters will be larger in the embedded space.
493500
</Documentation>
494501
</DoubleVectorProperty>
495502

@@ -501,6 +508,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
501508
panel_visibility="advanced">
502509
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
503510
<Documentation>
511+
The learning rate for t-SNE is usually in the range [10.0, 1000.0]. If the learning rate is too high, the data may look like a ‘ball’ with any point approximately equidistant from its nearest neighbours. If the learning rate is too low, most points may look compressed in a dense cloud with few outliers. If the cost function gets stuck in a bad local minimum increasing the learning rate may help.
504512
</Documentation>
505513
</DoubleVectorProperty>
506514

@@ -512,6 +520,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
512520
panel_visibility="advanced">
513521
<IntRangeDomain name="range" min="0" max="100" />
514522
<Documentation>
523+
Maximum number of iterations for the optimization. Should be at least 250.
515524
</Documentation>
516525
</IntVectorProperty>
517526

@@ -523,7 +532,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
523532
panel_visibility="advanced">
524533
<IntRangeDomain name="range" min="0" max="100" />
525534
<Documentation>
526-
Documentation.
535+
Maximum number of iterations without progress before we abort the optimization, used after 250 initial iterations with early exaggeration. This value is rounded to the next multiple of 50.
527536
</Documentation>
528537
</IntVectorProperty>
529538

@@ -535,6 +544,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
535544
panel_visibility="advanced">
536545
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
537546
<Documentation>
547+
If the gradient norm is below this threshold, the optimization will be stopped.
538548
</Documentation>
539549
</DoubleVectorProperty>
540550

@@ -544,21 +554,23 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
544554
number_of_elements="1"
545555
default_values="euclidean"
546556
panel_visibility="advanced">
547-
<Documentation>
557+
<Documentation>
558+
The metric to use when calculating distance between instances in a feature array.
548559
</Documentation>
549560
</StringVectorProperty>
550561

551562
<StringVectorProperty name="tsne_Init"
552563
label="Init"
553564
command="Settsne_Init"
554565
number_of_elements="1"
555-
default_values="random"
566+
default_values="pca"
556567
panel_visibility="advanced">
557568
<StringListDomain name="enum">
558569
<String value="random"/>
559570
<String value="pca"/>
560571
</StringListDomain>
561572
<Documentation>
573+
Initialization of embedding. PCA initialization cannot be used with precomputed distances and is usually more globally stable than random initialization.
562574
</Documentation>
563575
</StringVectorProperty>
564576

@@ -584,6 +596,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
584596
<String value="exact"/>
585597
</StringListDomain>
586598
<Documentation>
599+
By default the gradient calculation algorithm uses Barnes-Hut approximation running in O(NlogN) time. exact will run in time O(N^2) time. The exact algorithm should be used when nearest-neighbor errors need to be better than 3%.
587600
</Documentation>
588601
</StringVectorProperty>
589602

@@ -595,6 +608,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
595608
panel_visibility="advanced">
596609
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
597610
<Documentation>
611+
Only used for Barnes Hut. This is the trade-off between speed and accuracy for Barnes-Hut T-SNE. Angle less than 0.2 has quickly increasing computation time and angle greater 0.8 has quickly increasing error.
598612
</Documentation>
599613
</DoubleVectorProperty>
600614

@@ -621,6 +635,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
621635
panel_visibility="advanced">
622636
<DoubleRangeDomain name="range" min="0.0" max="1.0" />
623637
<Documentation>
638+
Only used if the solver is set to arpack.
624639
</Documentation>
625640
</DoubleVectorProperty>
626641

@@ -632,6 +647,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
632647
panel_visibility="advanced">
633648
<IntRangeDomain name="range" min="0" max="100" />
634649
<Documentation>
650+
Only used if the solver is set to arpack.
635651
</Documentation>
636652
</IntVectorProperty>
637653

@@ -647,6 +663,7 @@ IEEE Transactions on Visualization and Computer Graphics 27(2): 561-571, 2020.
647663
<String value="D"/>
648664
</StringListDomain>
649665
<Documentation>
666+
Choosing between Floyd-Warshall and Dijkstra algorithm.
650667
</Documentation>
651668
</StringVectorProperty>
652669

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
3+
project(ttkDimensionReductionCmd)
4+
5+
if(TARGET ttkDimensionReduction)
6+
add_executable(${PROJECT_NAME} main.cpp)
7+
target_link_libraries(${PROJECT_NAME}
8+
PRIVATE
9+
ttkDimensionReduction
10+
ttkDataSetToTable
11+
VTK::IOXML
12+
VTK::IOInfovis
13+
)
14+
set_target_properties(${PROJECT_NAME}
15+
PROPERTIES
16+
INSTALL_RPATH
17+
"${CMAKE_INSTALL_RPATH}"
18+
)
19+
install(
20+
TARGETS
21+
${PROJECT_NAME}
22+
RUNTIME DESTINATION
23+
${TTK_INSTALL_BINARY_DIR}
24+
)
25+
endif()

0 commit comments

Comments
 (0)