Home How to wrap and unwrap the trained model object generated using Weka for Restful Webservice (Java)
Reply: 0

How to wrap and unwrap the trained model object generated using Weka for Restful Webservice (Java)

Sri09
1#
Sri09 Published in 2017-12-07 15:21:24Z

Is it possible to send the trained model as a GET request to the client using Restful webservice?? I have tried the following way,

@GET
@Produces(MediaType.TEXT_PLAIN)
public String getIt() throws Exception {

    J48 model = (J48) SerializationHelper.read(file.getAbsolutePath());
    return model.toString();
}

I have tested this request with Postman and got the following response

J48 pruned tree
------------------

TMAX <= 0.43381
|   TMIN <= 0.322058: yes (760.0)
|   TMIN > 0.322058
|   |   TMIN <= 0.413488: yes (23.0)
|   |   TMIN > 0.413488: no (3.0)
TMAX > 0.43381: no (14479.0/1.0)

Number of Leaves  :     4

Size of the tree :  7

I have then created a Rest client and got the following response.

InboundJaxrsResponse{context=ClientResponse{method=GET, uri=http://localhost:8080/restserver/webapi/algorithm, status=200, reason=OK}}

Now, I'm stuck at how to use this response as trained model and test the model for new data. I hope and I would get some suggestions from you.

Thanks in advance!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307968 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO