-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example for a prediction using C5.0 decision tree #6
Comments
I'm very happy for your impression. I'm currently in a job transition and further my focus right now is on getting ggforce and ggraph out of the door. Once this has been done I'll begin to pic up the fiery ecosystem again, which has laid dormant the last couple of months... I hope that you can brace yourself with some time. |
If you have a very specific problem or error I'll be happy to look at your code and give my opinion though... |
Thanks for replying to me (impressive response speed!!) I completely Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 4:06 PM, Thomas Lin Pedersen <
|
Thomas, Please find the code that is slightly modified version of your code. My Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 4:07 PM, Thomas Lin Pedersen <
|
You cannot attach files to a GitHub issue email (I assume that this is what you tried) |
Oops didnt know that, where can I send the code to you then. Its not on Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 4:40 PM, Thomas Lin Pedersen <
|
Share it through dropbox etc... and paste a link here. |
Here you go: https://www.dropbox.com/s/zld6f8gefbio29a/Bus_Asset_API.R?dl=0 Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 4:50 PM, Thomas Lin Pedersen <
|
Thanks - I'll have a look as time permits... |
@anubhavdikshit I think your issue might be
don't you want to only have grabbed the query string value to pass into the model, not the entire named list for res <- predict.C5.0(model,
- newdata = fromJSON(input),
type = "class")
res <- predict.C5.0(model,
+ newdata = fromJSON(input$val),
type = "class") assuming input$val is a dataframe you want. On the other hand, if input is a named list of columns, but you you want to pass a dataframe (per your code comments) into predict.C5.0 then you probably need do coerce to a dataframe rather than its list nature
|
Thank you so much, I will get back to you on this!! Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 6:40 PM, Devin Pastoor notifications@github.com
|
Thomas, This is what i am trying in terminal, curl 127.0.0.1:9123/predict.C5.0 -H This is what I get: Error : Argument 'txt' must be a JSON string, URL or Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 6:42 PM, Anubhav Dikshit anubhav@artoo.in wrote:
|
Thomas, I think without the model, its pretty hard to do anything, so please use and the predict function will be predict.gam(tv_model, newdata = newdata) Hope this helps! Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 6:52 PM, Anubhav Dikshit anubhav@artoo.in wrote:
|
ohh @anubhavdikshit you are trying to pass the json as data, @thomasp85 's example is passing it around as a query string for example
the breakdown is:
note, query parameters are separated by so in your case, you might do:
then when you parse the query string you'll get a list like input <- list(age = "26", marital = "MARRIED") # what you'd get from parseQueryParams()
|
@devin Things make a little more sense now, I have one follow up question, why is it still _curl _127.0.0.1:9123/predict?age=26&marital=MARRIED and not *curl * 127.0.0.1:9123/predict.gam?age=26&marital=MARRIED curl 127.0.0.1:9123/predict.C5.0 http://127.0.0.1:9123/predict.C5.0 -H Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 7:07 PM, Devin Pastoor notifications@github.com
|
so there are two parts to this answer. First, purely from a naming perspective, the route name is arbitrarily established. This gets a little into API design, but you need to decide if you want your users being explicit about what they are hitting, eg For example, you could have a model_type query param
then you might have more logic
the predict isn't a magical keyword or anything, you can see in the example
In this case, the logic is saying if there is a query along the route that starts with the word predict, apply the following logic You could just as easily change the route to any wording you'd like. Finally, in sending JSON, I haven't looked into directly how fiery stores data from the response object, however if it is simple values, I would suggest just sending them as query strings. Use https://insomnia.rest/ (its free!) and you can build up Params very easily so you don't have to type them in manually each time for example: |
@dpastoor Thanks for chiming in here! Ive got nothing else to really add... |
@thomasp85 np, your future package has already saved me untold hours of work so want to give back where I can! Also when you get some breathing room I'd be interested in helping out with the routr addition some, so feel free to ping me any time. |
I will keep that in mind - thanks but future is the work of @HenrikBengtsson so credit goes to him for that one - I was just one of the first to pick it up :-) |
ah yes of course - spacey of me - I discovered fiery from discussions about future and have had this on my radar to use for my next REST api I need to build. Anyway, thanks for your work regardless! |
Guys, You are all awesome, I cannot tell you how grateful I as well as many are Thanks and Regards, This e-mail and its attachment(s) contain information from Artoo IT On Tue, Nov 8, 2016 at 7:46 PM, Devin Pastoor notifications@github.com
|
Hi,
I was so impressed and amazed at this package, it seemed to have the right balance between complexity and customization, I found you through this post (https://www.r-bloggers.com/a-simple-prediction-web-service-using-the-new-fiery-package/).
I tired to modify your example to handle a JSON as input, specifically using C5.0 decision tree, however I could not manage to do so. I was hoping you could have a document/pdf on github which would use a complex model (random forest, or anything using Caret) where instead of single parameter we send in a JSON.
I know it may seem a rich of me to ask you to do so, but I see tremendous potential to your package, unlike openCPU this is so easier to setup. Thank you so much for this again!
The text was updated successfully, but these errors were encountered: