Deployment and Implementation of Predictive models into Production?

machine_learning
data_mining
data_science
python
text_analytics

#1

Hello all,

I am looking for some guidance on how do we deploy / implement the predictive models we build initially using the training / validation / test data into Production? Till now, I have been building the models and using their results for deriving insights. However, Let’s say I now want to automate this process on the new data of getting output using the predictive model I have built. To elaborate, let’s say I have built a sentiment analysis model by doing text-mining on the customer reviews given for various products and the logistic classifier model is able to predict whether the sentiment is positive or negative along with the probability associated with the review. Now, we want to automate this process for any new product reviews given by customers on the website and feed them to the model built to understand how are the customers feeling about the products they are buying. How to do this? Does it gets deployed as a web-service? If yes, how it is done.

Any thoughts / links for reading materials on this topic would be very helpful. I look forward to hear your thoughts on this.

Thanks


What is the best way to implement the R code (that uses packages from r) on your website?
#2

Hi @rkohli0
Search for Django or Flask or Bottleneck, for machine learning task normal servers does not help, you need to have a computation server,
In short you make your model you run it in train data, you get the object of you model where all the Betas are present you keep that instance always running in server, whenever new data comes you call that object and wolla your output is ready, AWS has some good engines ready but they are costly, some times people just take those betas create a equation and directly put new values in the equation and it gives you the desired output, I am sharing what I know.


#3

Hi @rkohli0

It depends on how are you using the output of your model.

  1. If the output is a static report then it can be done once a day/week/month by pulling data from the backend
  2. If the output is used by your UI code for calculating offers etc and displaying the prices, you need to use the way @Swapnil_Sharma has mentioned
  3. If the request needs to be ad hoc then you can provide it as an elevated service to select people within the firm, but not necessary on the UI

Regards,
Anant


#4

For R : Try deplyR , where in you can build your predictive model , write a scoring engine and expose it as an API for other applications. The ecternal applications can pass the required inputs to your predictive model and the api would respond back with the probability score and prediction. Works for all type of models.

For spss modeler : Use spss collaboration and deployment services , that can score the new datasets using the scoring stream. It also exposes the model as a web service that can be invoked from spss cds (internal call ) or through external calls using soap and rest calls.

Hope this helps…


#5

Adding to what @Shashankp27 has mentioned, on R try OpenCPU , RServe, Rpy2. These help expose the R backend to aHTTP based services. I would suggest OpenCPU, as it provides a robust API interface and is independent of which language you choose your frontend. Python based (django, flask, webpy) or PHP based.

Hope this helps.

The links below should get you started.
www.opencpu.org
https://www.opencpu.org/apps.html

Cheers!
Nayan


#6

Hi Swapnil,

Thanks for the great advice… could you explain how the betas are stored other than as a live instance? Just like some values being store in a table?


#7

Yes just like storing those value

y=ax+bz+c

and you get your a and b and c from some database of hardcore.


#8

Great…
Thanks Shashank…
Thats exactly what i was looking for … :slight_smile:slightly_smiling_face:
Will explore this…

Thanks a lot man…