Giter Site home page Giter Site logo

Comments (4)

Frank5547 avatar Frank5547 commented on July 18, 2024

I apologize my code does not seem to be rendering correctly. Please let me know if I can clarify better

from textminer.

TommyJones avatar TommyJones commented on July 18, 2024

Hi @Frank5547. I can't reproduce your example without data, but I think I know what's going on. Your trigram matrix is huge. Fortunately, you can get rid of many of the columns without impacting your end result. Because of Zipf's law, most of your trigrams will only appear once or twice throughout the entire corpus. You can get rid of them by typing

dtm <- dtm[, colSums(dtm) > 1]

or

dtm <- dtm[, colSums(dtm > 0) > 1]

The first prunes trigrams that only appear once. The second prunes trigrams that only appear in one document.

But you may not need trigrams. I generally don't use them because the risk of building a model that does not generalize is too high. I noticed you set ngram_window = c(3,3), which only gives you trigrams and not unigrams or bigrams. Try ngram_window = c(1,2). That's what I usually use and there's usually lots of signal there. (You should still prune infrequent tokens as they will make training time much longer without adding anything worthwhile to the model.)

I'm going to close as this isn't really an issue with textmineR. But please feel free to comment again if you have any questions. I'll help out where I can.

from textminer.

Frank5547 avatar Frank5547 commented on July 18, 2024

You were right it turns out I only needed bigrams after all. I know this reply comes in late, but I wanted to thank you for your comment to my post. It came in handy later on to be reminded of Zipf's Law and that I can delete all the terms with frequency of 1 without losing value.

from textminer.

TommyJones avatar TommyJones commented on July 18, 2024

from textminer.

Related Issues (20)

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.