Ibrahim, Sebastian,

I precisely am trying to create a PHP Webservice to deliver recommendations.

On a webpage, I would call that webservice, and I was imagining having that
webservice calling the factorize-movielens script itself, and transforming
the latter output to something like
[{itemID:557,value:5.988698},{itemID:578,value:5.0461025},{itemID:1149,value:4.9268165},{itemID:572,value:4.9265957},{itemID:3245,value:4.8139095}],
a JSON I could easily parse in my front-end.

I don't want (if possible) to involve any Java application or http server
as suggested (kornapi,myrrix), although I understand these would be a
sensible way to do (I'm interested in learning MAhout, so obfuscating that
part is something I'd like to avoid).

Regards


2013/1/14 Sebastian Schelter <[email protected]>

> This blog post might be useful for you:
>
> http://ssc.io/a-recommendation-webservice-in-10-minutes/
>
> On 14.01.2013 09:31, Sékine Coulibaly wrote:
> > Hi Ibrahim,
> >
> > Actually, for now, I wish I could use it locally, in other words without
> > using Haddop framework. I've been successfull in trying to launch :
> > factorize-movielense-1M.sh ratings.dat
> >
> > I wish I could launch that very same command from PHP. The Apache user is
> > www-data indeed. The /tmp/mahout-work-www-data directory is created but
> > only contains the ratings.csv file.
> >
> > Regards
> >
> >
> >
> >
> > 2013/1/14 Ibrahim Yakti <[email protected]>
> >
> >> your php scripts run using apache user which most probably doesn't have
> >> HADOOP_HOME, HADOOP_CONF_DIR, ...etc  variables defined, please try to
> >> define them in the php script before making the call.
> >>
> >> I hope it works.
> >>
> >>
> >> --
> >> Ibrahim
> >>
> >>
> >> On Sun, Jan 13, 2013 at 11:38 PM, Sékine Coulibaly <
> [email protected]
> >>> wrote:
> >>
> >>> Hi there,
> >>>
> >>> I've been able to start locally the factorize-movielens script. What
> I'd
> >>> like to do is basically create a PHP webservice able to start that very
> >>> same script, and return the recommendations.
> >>>
> >>> I'm using Apache2, and I use PHP's shell_exec to start the script as
> >>> follows :
> >>>
> >>>
> >>> putenv("JAVA_HOME=" .'/usr/local/jvm/jdk1.7.0_05');
> >>>  $output =
> >>>
> >>>
> >>
> shell_exec('/home/scoulibaly/Téléchargements/mahout-distribution-0.6/examples/bin/factorize-movielens-1M.sh
> >>>
> >>>
> >>
> /home/scoulibaly/Téléchargements/mahout-distribution-0.6/examples/bin/ratings.dat');
> >>>  echo $output;
> >>>
> >>>
> >>> Unfortunately the output I get is as follows :
> >>>
> >>> creating work directory at /tmp/mahout-work-www-data
> >>>
> >>> Converting ratings...
> >>>
> >>> MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
> >>> no HADOOP_HOME set, running locally
> >>> MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
> >>> no HADOOP_HOME set, running locally
> >>> MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
> >>> no HADOOP_HOME set, running locally
> >>> MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
> >>> no HADOOP_HOME set, running locally
> >>>
> >>> RMSE is:
> >>>
> >>>
> >>>
> >>>
> >>> Sample recommendations:
> >>>
> >>>
> >>>
> >>>
> >>> removing work directory
> >>>
> >>>
> >>> I know this is not strictly a Mahout issue, but if someone could point
> >> me a
> >>> way to start Mahout jobs from a PHP script, I'd be very grateful !
> >>>
> >>> Thank you
> >>>
> >>
> >
>
>

Reply via email to