MultidimensionalScaling.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2011 Sergey Lisitsyn
00008  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
00009  */
00010 
00011 #ifndef MULTIDIMENSIONALSCALING_H_
00012 #define MULTIDIMENSIONALSCALING_H_
00013 #include <shogun/lib/config.h>
00014 #ifdef HAVE_LAPACK
00015 #include <shogun/converter/EmbeddingConverter.h>
00016 #include <shogun/features/Features.h>
00017 #include <shogun/distance/Distance.h>
00018 
00019 namespace shogun
00020 {
00021 
00022 class CFeatures;
00023 class CDistance;
00024 
00064 class CMultidimensionalScaling: public CEmbeddingConverter
00065 {
00066 public:
00067 
00068     /* constructor */
00069     CMultidimensionalScaling();
00070 
00071     /* destructor */
00072     virtual ~CMultidimensionalScaling();
00073 
00078     virtual CDenseFeatures<float64_t>* embed_distance(CDistance* distance);
00079 
00085     virtual CFeatures* apply(CFeatures* features);
00086 
00088     const char* get_name() const;
00089 
00093     SGVector<float64_t> get_eigenvalues() const;
00094 
00100     void set_landmark_number(int32_t num);
00101 
00105     int32_t get_landmark_number() const;
00106 
00110     void set_landmark(bool landmark);
00111 
00115     bool get_landmark() const;
00116 
00118 protected:
00119 
00121     virtual void init();
00122 
00127     SGMatrix<float64_t> classic_embedding(SGMatrix<float64_t> distance_matrix);
00128 
00133     SGMatrix<float64_t> landmark_embedding(SGMatrix<float64_t> distance_matrix);
00134 
00139     virtual SGMatrix<float64_t> process_distance_matrix(SGMatrix<float64_t> distance_matrix);
00140 
00142 protected:
00143 
00145     SGVector<float64_t> m_eigenvalues;
00146 
00148     bool m_landmark;
00149 
00151     int32_t m_landmark_number;
00152 
00154 protected:
00155 
00159     static void* run_triangulation_thread(void* p);
00160 
00167     static SGVector<int32_t> shuffle(int32_t count, int32_t total_count);
00168 
00169 };
00170 
00171 }
00172 #endif /* HAVE_LAPACK */
00173 #endif /* MULTIDIMENSIONALSCALING_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation