Giter Site home page Giter Site logo

plsa's Introduction

This is a PLSA (Probabilistic Latent Semantic Analysis) implementation via the EM (Expectation-Maximization) algorithm.

Current issues:

  1. The code are not well tested, so it may contain bugs. The test text are in the folder ./texts and ./test.
  2. The code seems not working well with small datasets, such as ./test

Reference:

EM introduction: http://blog.tomtung.com/2011/10/em-algorithm

PLSA introduction: http://blog.tomtung.com/2011/10/plsa

My lda-with-gibbs repo

Note:

A Tutorial on Probabilistic Latent Semantic Analysis by Liangjie Hong is not a very good PLSA introduction material. There are some known bugs.

plsa's People

Contributors

erickpeirson avatar hitalex avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plsa's Issues

main.py 打开大量文件(比如大于1000),会报出异常:[Errno 24] Too many open files

hitalex,您好。
查看plsa.py中Document 类,发现实例Document类时,都会有一个file handler,当实例大量Document类时,会造成资源爆满。
建议将file open的操作放在split方法里面,并及时关闭,代码如下

class Document(object):
    def __init__(self, filepath):
        self.filepath = filepath
        #self.file = open(self.filepath)
        self.lines = []
        self.words = []
    def split(self, STOP_WORDS_SET):
        file = open(self.filepath)
        try:
            self.lines = [line for line in file]
        finally:
            file.close()
        for line in self.lines:
            ...

how to inference a new doc?

how to inference a new doc ?
like lsa, trian again with the original docs?
or is there any inference method like lda?

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.