Giter VIP home page Giter VIP logo

Comments (4)

ltrottier-yelp avatar ltrottier-yelp commented on August 12, 2024

Hello @habib27,

Are you following the tutorial here ?

To transform a frame, you need to format it as mleap expects it. Here is an example for airbnb leap frame:

{
    "schema": {
      "fields": [{
        "name": "state",
        "type": "string"
      }, {
        "name": "bathrooms",
        "type": "double"
      }, {
        "name": "square_feet",
        "type": "double"
      }, {
        "name": "bedrooms",
        "type": "double"
      }, {
        "name": "security_deposit",
        "type": "double"
      }, {
        "name": "cleaning_fee",
        "type": "double"
      }, {
        "name": "extra_people",
        "type": "double"
      }, {
        "name": "number_of_reviews",
        "type": "double"
      }, {
        "name": "review_scores_rating",
        "type": "double"
      }, {
        "name": "room_type",
        "type": "string"
      }, {
        "name": "host_is_superhost",
        "type": "string"
      }, {
        "name": "cancellation_policy",
        "type": "string"
      }, {
        "name": "instant_bookable",
        "type": "string"
      }]
    },
    "rows": [["NY", 2.0, 1250.0, 3.0, 50.0, 30.0, 2.0, 56.0, 90.0, "Entire home/apt", "1.0", "strict", "1.0"]]
  }

Reference for leap frame: https://github.com/combust/mleap/blob/master/mleap-executor-testkit/src/main/resources/leap_frame/frame.airbnb.json

Then, to query the model simply do:

body=$(cat frame.airbnb.json)
curl --header "Content-Type: application/json" \
  --header "timeout: 1000" \
  --request POST \
  --data "$body" http://localhost:8080/models/AirBnBLR/transform

from mleap.

habib27 avatar habib27 commented on August 12, 2024

Hey @ltrottier-yelp ,

Thank you for the reply.

Yes I followed that tutorial. The link to the airbnb frame does not work for me, says all access is disabled. But that payload I was able to find somewhere and use and it does work.

However, the issue is you see that type field that is being used there in the example, it's not in the swagger and I don't know what are the possible values for it. For example if I have a model where the value is double but the base is "Tensor", what type do I pass in to make it work?

I get this error :

"status": "STATUS_ERROR",
"error": "IllegalArgumentException: Cannot cast ScalarType(double,true) to TensorType(double,Some(WrappedArray(75)),true)

Is there anywhere I can find what the valid values are for this type field?

from mleap.

ltrottier-yelp avatar ltrottier-yelp commented on August 12, 2024

I'm taking a look at the swagger file, because it looks outdated. I'll try to update it soon.

The frame that you pass to the server is the same as a leap frame that you create in scala. It is simply its json representation. So you have two choices:

  1. Create it via scala code and save it to json using the provided json FrameWriter. See here for a tutorial.

  2. Create it yourself. Since the swagger is outdated, for now you can look at this file:

    implicit val MleapTensorTypeFormat: JsonFormat[TensorType] = lazyFormat(new JsonFormat[TensorType] {
    . This is where we define the parsing rules for json to create the leap frame. So for a tensor of type double, you need to define the type, base and dimensions.

from mleap.

habib27 avatar habib27 commented on August 12, 2024

Hey @ltrottier-yelp ,

Thank you very much for your help and prompt response. I appreciate it.

from mleap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.