Coder Social home page Coder Social logo

sszuev / fasttext_java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ivanhk/fasttext_java

14.0 14.0 5.0 522 KB

Java port of c++ version of facebook fasttext

License: Other

Java 100.00%
facebook-api fasttext fasttext-java java-fasttext

fasttext_java's People

Contributors

buiquocchinh avatar ivanhk avatar kongya avatar lefromage avatar sebastianarnold avatar sszuev avatar y-yammt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fasttext_java's Issues

Wrong result when using -pretrainedVectors

Hi. Thanks for your work on keeping java version of fastText up-to-date.
I have an issue.
When I train model in supervised mode using pretrained vectors (wiki-news-300d-1M.vec) and then use it to classify sentences, it's result is quite different from original facebook implementation. This happens because you don't add words to dictionary in this loop in FastText.java (lines 1371-1386):

                for (int i = 0; i < n; i++) {
                    String line = in.readLine();
                    String word;
                    String[] array;
                    if (StringUtils.isEmpty(line) || (array = line.split(" ")).length == 0 || StringUtils.isEmpty(word = array[0])) {
                        throw new IllegalArgumentException("Wrong line: " + line);
                    }
                    List<Float> numbers = Arrays.stream(array).skip(1).limit(dim + 1).map(Float::parseFloat).collect(Collectors.toList());
                    if (numbers.size() < dim)
                        throw new IllegalArgumentException("Wrong numbers in the line: " + numbers.size() + ". Expected " + dim);
                    words.add(word);
                    for (int j = 0; j < numbers.size(); j++) {
                        mat.set(i, j, numbers.get(j));
                    }
                }

Could you please fix it?

OOV

Hello,

I want to use your version of fasttext in my poject, but i want to check before if this version handle the OOV words.

Thank in advance for your confirmation on how your code deals with the OOV during test phase
Regards

cannot find symbol: method forEach((f,i)->res[...]), f))

Hi there,

I run into a compile error:

FastText.java:860: error: cannot find symbol
map.forEach((f, i) -> res.put(dict.getLabel(i), f));
^
symbol: method forEach((f,i)->res[...]), f))
location: variable map of type TreeMultimap<Float,Integer>

Any hint? Thanks!

different predict results

i have model trained by c++ version fastText and the model is used for predicting in java version. But the two results is much different and the result of java version is obviously wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.