home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.ai      Awaiting the gospel from Sarah Connor      1,954 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,425 of 1,954   
   Ted Dunning to Pavel Kalinov   
   Re: Simpler Bayesian classifier?   
   11 Jun 07 11:47:06   
   
   From: ted.dunning@gmail.com   
      
   On Jun 9, 12:27 am, Pavel Kalinov  wrote:   
   > I am programming it in PHP and I go "by the book" - i.e.   
   > calculating probabilities according to the formula etc.   
   > It works, but it's very slow (due to slow PHP mathematical   
   > implementation, I guess).   
   > Is there some variation of the Naive Bayes classifier which is not so   
   > demanding in the way of computing power used?   
      
   You may need to rearrange your computation so that you do more of the   
   computation when the user isn't waiting.  That could help quite a bit.   
      
   But the simple fact of the matter is that PHP isn't the greatest   
   choice for this kind of computation.  With almost any non-interpreted   
   language, you would be very hard pressed to write an implementation of   
   naive Bayes that has any perceptible delay.   
      
   In large web applications, it is often good to separate functionality   
   by building a simple web-service.  In your situation, you probably   
   don't have the scale necessary to make this sensible, but it would be   
   very easy, for example, to build a fast classifier in, say, Java that   
   you communicate via something like a REST protocol.  PHP can then send   
   requests to this service and do what it does well (make web pages)   
   without having to do what it does incredibly poorly (math).   
      
   Another reasonable option which might make sense in your situation is   
   to write a PHP extension in C.  This would be a very bad architecture   
   for a large-scale system, but it is reasonable for toy-sized   
   implementations.   
      
   [ comp.ai is moderated ... your article may take a while to appear. ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca