Esempio n. 1
0
 void serialize(TextOutputStream & out, Codec const & codec = Codec_AUTO()) const { vocabulary.serialize(out); }
Esempio n. 2
0
        /** How to seed the initial centers (default Seeding::K_MEANS_PLUS_PLUS). */
        Options & setSeeding(Seeding seeding_) { seeding = seeding_; return *this; }

        /** Accelerate computations by parallelization or not (default true). */
        Options & setParallelize(bool value) { parallelize = value; return *this; }

        /** Set whether progress information will be printed to the console or not (default true). */
        Options & setVerbose(bool value) { verbose = value; return *this; }

        /** Load options from a disk file. */
        bool load(std::string const & path);

        /** Save options to a disk file. */
        bool save(std::string const & path) const;

        void deserialize(BinaryInputStream & in, Codec const & codec = Codec_AUTO());
        void serialize(BinaryOutputStream & out, Codec const & codec = Codec_AUTO()) const;
        void deserialize(TextInputStream & in, Codec const & codec = Codec_AUTO());
        void serialize(TextOutputStream & out, Codec const & codec = Codec_AUTO()) const;

        /** Get the set of default options. */
        static Options const & defaults() { static Options const def; return def; }

      private:
        long max_iterations;  ///< Maximum iterations to seek convergence (ignored if negative).
        double max_time;      ///< Maximum time in seconds to seek convergence (ignored if negative).
        Seeding seeding;      ///< How to seed the initial centers.
        bool parallelize;     ///< Accelerate computations by parallelization.
        bool verbose;         ///< Print progress information to the console.

        friend class KMeans;
Esempio n. 3
0
 void deserialize(TextInputStream & in, Codec const & codec = Codec_AUTO()) { vocabulary.deserialize(in); }