Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/tapkee/defines/methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ static const DimensionReductionMethod tDistributedStochasticNeighborEmbedding("t
* @cite Gashler2007 */
static const DimensionReductionMethod ManifoldSculpting("Manifold Sculpting", RequiresFeatures);

/** Uniform Manifold Approximation and Projection (UMAP) */
static const DimensionReductionMethod UniformManifoldApproximationAndProjection("Uniform Manifold Approximation and Projection", RequiresFeatures);

/** Passing through (doing nothing just passes the
* data through) */
static const DimensionReductionMethod PassThru("Pass-through", RequiresFeatures);
Expand Down
1 change: 1 addition & 0 deletions include/tapkee/methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class DynamicImplementation : public ImplementationBase<RandomAccessIterator, Ke
tapkee_method_handle(FactorAnalysis);
tapkee_method_handle(tDistributedStochasticNeighborEmbedding);
tapkee_method_handle(ManifoldSculpting);
tapkee_method_handle(UniformManifoldApproximationAndProjection);
#undef tapkee_method_handle
return TapkeeOutput();
}
Expand Down
1 change: 1 addition & 0 deletions include/tapkee/methods/all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <tapkee/methods/factor_analysis.hpp>
#include <tapkee/methods/manifold_sculpting.hpp>
#include <tapkee/methods/tsne.hpp>
#include <tapkee/methods/umap.hpp>
/* End of Tapkee includes */

namespace tapkee
Expand Down
25 changes: 25 additions & 0 deletions include/tapkee/methods/umap.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Copyright (c) 2024 Sergey Lisitsyn, Fernando Iglesias
*/
#pragma once

/* Tapkee includes */
#include <tapkee/methods/base.hpp>
/* End of Tapkee includes */

namespace tapkee
{
namespace tapkee_internal
{

__TAPKEE_IMPLEMENTATION(UniformManifoldApproximationAndProjection)
TapkeeOutput embed()
{
DenseMatrix feature_matrix{this->end - this->begin, static_cast<IndexType>(this->parameters[target_dimension])};
return TapkeeOutput(feature_matrix, unimplementedProjectingFunction());
}
__TAPKEE_END_IMPLEMENTATION()

} // End of namespace tapkee_internal
} // End of namespace tapkee
2 changes: 1 addition & 1 deletion src/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int run(int argc, const char **argv)
"diffusion_map (dm), isomap, landmark_isomap (l-isomap), multidimensional_scaling (mds), \n"
"landmark_multidimensional_scaling (l-mds), stochastic_proximity_embedding (spe), \n"
"kernel_pca (kpca), pca, random_projection (ra), factor_analysis (fa), \n"
"t-stochastic_neighborhood_embedding (t-sne), manifold_sculpting (ms).",
"t-stochastic_neighborhood_embedding (t-sne), manifold_sculpting (ms), umap.",
with_default("locally_linear_embedding"s)
)
(
Expand Down
2 changes: 2 additions & 0 deletions src/cli/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ tapkee::DimensionReductionMethod parse_reduction_method(const char* str)
return tapkee::tDistributedStochasticNeighborEmbedding;
if (!strcmp(str, "manifold_sculpting") || !strcmp(str, "ms"))
return tapkee::ManifoldSculpting;
if (!strcmp(str, "umap"))
return tapkee::UniformManifoldApproximationAndProjection;

throw std::exception();
return tapkee::PassThru;
Expand Down
5 changes: 5 additions & 0 deletions test/unit/methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ TEST(Methods, tDistributedStochasticNeighborEmbeddingSmokeTest)
{
smoketest(tDistributedStochasticNeighborEmbedding);
}

TEST(Methods, UniformManifoldApproximationAndProjection)
{
smoketest(UniformManifoldApproximationAndProjection);
}