All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smile.nlp.embedding.GloVe Maven / Gradle / Ivy

There is a newer version: 3.1.1
Show newest version
/*******************************************************************************
 * Copyright (c) 2010-2020 Haifeng Li. All rights reserved.
 *
 * Smile is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * Smile is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Smile.  If not, see .
 ******************************************************************************/

package smile.nlp.embedding;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

/**
 * Global Vectors for Word Representation.
 * GloVe is an
 * unsupervised learning algorithm for obtaining vector representations
 * for words.
 * 

* GloVe is essentially a log-bilinear model with a weighted least-squares * objective. The main intuition underlying the model is the simple * observation that ratios of word-word co-occurrence probabilities * have the potential for encoding some form of meaning. *

* Training is performed on aggregated global word-word co-occurrence * statistics from a corpus. The training objective of GloVe is to learn * word vectors such that their dot product equals the logarithm of the * words' probability of co-occurrence. Owing to the fact that the logarithm * of a ratio equals the difference of logarithms, this objective associates * (the logarithm of) ratios of co-occurrence probabilities with vector * differences in the word vector space. Because these ratios can encode * some form of meaning, this information gets encoded as vector differences * as well. * * @author Haifeng Li */ public class GloVe { /** * Loads a





© 2015 - 2024 Weber Informatics LLC | Privacy Policy