fasttext::FastText Class Reference

`#include <fasttext.h>`

## Public Member Functions

| FastText ()
void | getVector (Vector &, const std::string &) const
void | saveVectors ()
void | saveOutput ()
void | saveModel ()
void | loadModel (std::istream &)
void | loadModel (const std::string &)
void | printInfo (real, real)
void | supervised (Model &, real, const std::vector< int32_t > &, const std::vector< int32_t > &)
void | cbow (Model &, real, const std::vector< int32_t > &)
void | skipgram (Model &, real, const std::vector< int32_t > &)
std::vector< int32_t > | selectEmbeddings (int32_t) const
void | quantize (std::shared_ptr< Args >)
void | test (std::istream &, int32_t)
void | predict (std::istream &, int32_t, bool)
void | predict (std::istream &, int32_t, std::vector< std::pair< real, std::string >> &) const
void | wordVectors ()
void | sentenceVectors ()
void | ngramVectors (std::string)
void | textVectors ()
void | printWordVectors ()
void | printSentenceVectors ()
void | precomputeWordVectors (Matrix &)
void | findNN (const Matrix &, const Vector &, int32_t, const std::set< std::string > &)
void | nn (int32_t)
void | analogies (int32_t)
void | trainThread (int32_t)
void | train (std::shared_ptr< Args >)
void | loadVectors (std::string)
int | getDimension () const

## Private Member Functions

void | signModel (std::ostream &)
bool | checkModel (std::istream &)

## Private Attributes

std::shared_ptr< Args > | args_
std::shared_ptr< Dictionary > | dict_
std::shared_ptr< Matrix > | input_
std::shared_ptr< Matrix > | output_
std::shared_ptr< QMatrix > | qinput_
std::shared_ptr< QMatrix > | qoutput_
std::shared_ptr< Model > | model_
std::atomic< int64_t > | tokenCount
clock_t | start
bool | quant_

## Constructor & Destructor Documentation

## FastText()

fasttext::FastText::FastText | ( |  | ) |

## Member Function Documentation

## analogies()

void fasttext::FastText::analogies | ( | int32_t | k | ) |

## cbow()

void fasttext::FastText::cbow | ( | Model & | model,
|  | real | lr,
|  | const std::vector< int32_t > & | line
| ) |  |

## checkModel()

bool fasttext::FastText::checkModel | ( | std::istream & | in | ) |

private

## findNN()

void fasttext::FastText::findNN | ( | const Matrix & | wordVectors,
|  | const Vector & | queryVec,
|  | int32_t | k,
|  | const std::set< std::string > & | banSet
| ) |  |

## getDimension()

int fasttext::FastText::getDimension | ( |  | ) | const

## getVector()

void fasttext::FastText::getVector | ( | Vector & | vec,
|  | const std::string & | word
| ) |  | const

## loadModel() [1/2]

void fasttext::FastText::loadModel | ( | std::istream & | in | ) |

## loadModel() [2/2]

void fasttext::FastText::loadModel | ( | const std::string & | filename | ) |

## loadVectors()

void fasttext::FastText::loadVectors | ( | std::string | filename | ) |

## ngramVectors()

void fasttext::FastText::ngramVectors | ( | std::string | word | ) |

## nn()

void fasttext::FastText::nn | ( | int32_t | k | ) |

## precomputeWordVectors()

void fasttext::FastText::precomputeWordVectors | ( | Matrix & | wordVectors | ) |

## predict() [1/2]

void fasttext::FastText::predict | ( | std::istream & | in,
|  | int32_t | k,
|  | bool | print_prob
| ) |  |

## predict() [2/2]

void fasttext::FastText::predict | ( | std::istream & | in,
|  | int32_t | k,
|  | std::vector< std::pair< real, std::string >> & | predictions
| ) |  | const

## printInfo()

void fasttext::FastText::printInfo | ( | real | progress,
|  | real | loss
| ) |  |

## printSentenceVectors()

void fasttext::FastText::printSentenceVectors | ( |  | ) |

## printWordVectors()

void fasttext::FastText::printWordVectors | ( |  | ) |

## quantize()

void fasttext::FastText::quantize | ( | std::shared_ptr< Args > | qargs | ) |

## saveModel()

void fasttext::FastText::saveModel | ( |  | ) |

## saveOutput()

void fasttext::FastText::saveOutput | ( |  | ) |

## saveVectors()

void fasttext::FastText::saveVectors | ( |  | ) |

## selectEmbeddings()

std::vector< int32_t > fasttext::FastText::selectEmbeddings | ( | int32_t | cutoff | ) | const

## sentenceVectors()

void fasttext::FastText::sentenceVectors | ( |  | ) |

## signModel()

void fasttext::FastText::signModel | ( | std::ostream & | out | ) |

private

## skipgram()

void fasttext::FastText::skipgram | ( | Model & | model,
|  | real | lr,
|  | const std::vector< int32_t > & | line
| ) |  |

## supervised()

void fasttext::FastText::supervised | ( | Model & | model,
|  | real | lr,
|  | const std::vector< int32_t > & | line,
|  | const std::vector< int32_t > & | labels
| ) |  |

## test()

void fasttext::FastText::test | ( | std::istream & | in,
|  | int32_t | k
| ) |  |

## textVectors()

void fasttext::FastText::textVectors | ( |  | ) |

## train()

void fasttext::FastText::train | ( | std::shared_ptr< Args > | args | ) |

## trainThread()

void fasttext::FastText::trainThread | ( | int32_t | threadId | ) |

## wordVectors()

void fasttext::FastText::wordVectors | ( |  | ) |

## Member Data Documentation

## args_

std::shared_ptr<Args> fasttext::FastText::args_

private

## dict_

std::shared_ptr<Dictionary> fasttext::FastText::dict_

private

## input_

std::shared_ptr<Matrix> fasttext::FastText::input_

private

## model_

std::shared_ptr<Model> fasttext::FastText::model_

private

## output_

std::shared_ptr<Matrix> fasttext::FastText::output_

private

## qinput_

std::shared_ptr<QMatrix> fasttext::FastText::qinput_

private

## qoutput_

std::shared_ptr<QMatrix> fasttext::FastText::qoutput_

private

## quant_

bool fasttext::FastText::quant_

private

## start

clock_t fasttext::FastText::start

private

## tokenCount

std::atomic<int64_t> fasttext::FastText::tokenCount

private

The documentation for this class was generated from the following files:

- /data/users/cpuhrsch/fbsource/fbcode/deeplearning/fastText/src/fasttext.h
- /data/users/cpuhrsch/fbsource/fbcode/deeplearning/fastText/src/fasttext.cc