pmservice / predictive-modeling-samples

documents and samples about how to use Predictive Modeling Service in Bluemix.net
Apache License 2.0
16 stars 43 forks source link

How to : use file(txt,xlsx etc) instead of database table in SPSS model input (NodeJs script) #4

Closed prasanta303 closed 8 years ago

prasanta303 commented 8 years ago

I have downloaded the source and tried to run it. Server was started correctly and first page also appeared correctly. But when I clicked on "Score Now" button nothing happened. Checked the command line for server output it's showing as below, App started on port 3000 === SCORE === URI : xxxxxxxxxxxxxxxxxxx/catalogTS?accesskey=xxxxxxxxxxxxxxxxxxxxx Input: {"tablename":"scoreInput","header":["men"],"data":[[10000],[20000],[300 00],[40000]]}

After that cursor go on blinking.....nothing happened. In the first step I did "npm install" from "app". Folder structure same as given in link. "app" and "module" folders are in same level. I am running it in my local m/c using localhost:3000.

rodney-vin commented 8 years ago

@prasanta303, you can not run the sample in your local machine.

you need to push it into bluemix as one bluemix APP. then create one Predictive Analytics service instance, and bind the instance to your APP.

The PA API server is read from OS env after your binding.

SheenaShen93 commented 8 years ago

@prasanta303, before you running the APP, it is need to put the model "Drug1n.str" to bluemix with the context ID "drug1N" on PA Dashboard. And then Click "Score Now".

prasanta303 commented 8 years ago

Thanks very much. I can able to get the output by running it from my local. I guess the model is fetching records from a database which is some where in a server. I want the records to be fetched from a file/excel sheet instead of database. I think there is a file "DRUG1n" in text format. This is for testing purpose. Please let me know the way to do this. What changes to be needed in scripts ? Where to put the records file ?

prasanta303 commented 8 years ago

In addition to above..... Hello, I can able to use example SPSS model(Drug1n.str) and NodeJs script using database table(scoreInput) as data source. This is working perfectly. I want to use .txt/.xlsx file as data source instead of database table (scoreInput). I made only change for this in file srv.js as

var input = { tablename: 'Drug1n', header: [ 'Age', 'Sex', 'BP', 'Cholesterol', 'Na', 'K' ], data: [[ p.Age, p.Sex, p.BP, p.Cholesterol, p.Na, p.K ]] };

instead of

var input = { tablename: 'scoreInput', header: [ 'Age', 'Sex', 'BP', 'Cholesterol', 'Na', 'K' ], data: [[ p.Age, p.Sex, p.BP, p.Cholesterol, p.Na, p.K ]] };

"Drug1n" is the data file name. But, on doing this it hangs. Please let me know the changes need to be incorporated. I need to do it for testing my application.

prasanta303 commented 8 years ago

Could you please let me know, how it will understand which one is data source. Is it the time when we define/configure the "Source" in SPSS modeller ?

prasanta303 commented 8 years ago

Thanks much for the confirmation. Closing it.