Skip to content

Instantly share code, notes, and snippets.

@mrm1001
Created August 12, 2018 16:02
Show Gist options
  • Save mrm1001/83a2f3b643666be97bf9750cb8a95dd7 to your computer and use it in GitHub Desktop.
Save mrm1001/83a2f3b643666be97bf9750cb8a95dd7 to your computer and use it in GitHub Desktop.
FastText
void FastText::supervised(
Model& model,
real lr,
const std::vector<int32_t>& line,
const std::vector<int32_t>& labels) {
if (labels.size() == 0 || line.size() == 0) return;
std::uniform_int_distribution<> uniform(0, labels.size() - 1);
int32_t i = uniform(model.rng);
model.update(line, labels[i], lr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment