mi024

College project "Projet IAD" master 1
git clone https://esimon.eu/repos/mi024.git
Log | Files | Refs | README

model.hpp (1253B)


      1 #ifndef MODEL_HPP_INCLUDED
      2 #define MODEL_HPP_INCLUDED
      3 
      4 #include <map>
      5 #include <string>
      6 
      7 #include <boost/shared_ptr.hpp>
      8 
      9 #include "view.hpp"
     10 
     11 // Pre-declaration.
     12 struct Data_set;
     13 
     14 /**
     15  * @brief A set of view with a common concept space.
     16  */
     17 class Model{
     18 public:
     19 	/**
     20 	 * @brief Add a view to the model.
     21 	 * @return whether the view has been added.
     22 	 */
     23 	bool add_view(boost::shared_ptr<View> view);
     24 
     25 	/**
     26 	 * @brief Train the views on a Data_set.
     27 	 *
     28 	 * The algorithm is as follow:
     29 	 *  	- Pick a random element
     30 	 *  	- Pick two random view of this element
     31 	 *  	- Train the corresponding concatenation encoder-decoder.
     32 	 *
     33 	 * Note that the number of vector on which the training function is called (and so the number of time the views are updated) is actually number_of_step * data_set_size.
     34 	 */
     35 	void stochastic_learn(Data_set const&, std::size_t number_of_step, float gradient_step, std::string const &criterion);
     36 
     37 	/** @brief Compute the mean error of the concatenation from_view.encode - to_view.decoder. */
     38 	double error(Data_set const&, std::string const &criterion, std::size_t from_view, std::size_t to_view) const;
     39 
     40 private:
     41 	/** @brief Map between a kind and a view. */
     42 	std::map<std::string, boost::shared_ptr<View> > views;
     43 };
     44 
     45 #endif
     46