0

I have a django app that needs to access methods from a class that was previously trained on some data.

To put things into context, the django app needs to access a classifier for classifying text. The classifier is trained on an initial data set and then I need to call it to classify new input, without re-training it. Therefore, I need one classifier instance to be alive all the time, independently of sessions, etc and to be able to call it to classify new text.

I was looking into Celery, but I have never used it. What is the best way to achieve such functionality? Any pointers to the right direction are much appreciated.

EDIT: To re-define my question. What's the best solution for having a specific object (the classifier), that needs to maintain its state (initial training), accessible from all the views in django? Is it a good practice to train the classifier at server start-up and save it as a variable which is accessible from a global static method?

valentinos
  • 428
  • 2
  • 11
  • 1
    http://stackoverflow.com/questions/8068945/django-long-running-asynchronous-tasks-with-threads-processing – ykaganovich May 24 '13 at 18:14
  • The question is very informative, but I think these solutions are too much of a trouble for what I am trying to do. I solved(?) the problem by simply creating a class with a static variable for the classifier and two static methods for training and then classifying new input. – valentinos May 25 '13 at 01:31
  • Given that you are running django - why don't you store this classifier in the db under a custom field? It's not clear to me what the purpose of the classifier is or why it's so much trouble to spin up a new instance? – rh0dium May 27 '13 at 13:47
  • The problem of creating a new instance is that the classifier needs to be trained before actually using it. The training of the classifier takes a significant amount of time before using it. So the I need an instance of a trained classifier to be available all the time. is there a way to store this in the DB? – valentinos May 27 '13 at 18:21
  • I am using the NLTK toolkit if this helps in any way. – valentinos May 27 '13 at 21:02
  • I edited my question to clarify what I need. – valentinos May 28 '13 at 18:50

0 Answers0