Skip to content
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

Can we customize the outputs format of Model? #565

Closed
yu-iskw opened this issue May 15, 2019 · 6 comments
Closed

Can we customize the outputs format of Model? #565

yu-iskw opened this issue May 15, 2019 · 6 comments
Assignees
Projects
Milestone

Comments

@yu-iskw
Copy link

yu-iskw commented May 15, 2019

Motivation

When we want to return multiple values with Model, we can format the outputs and label them with class_names. The order of returned values should be kept. Consider if we want to modify the returned value. The order of existing names should be remained.

Otherwise, I would like to know a better way to return multiple values. tags method can look good. But, I am not sure.

I would like to customize the outputs format, since the current spec of outputs format is not useful from the requesters' point of view. Is there any way to customize that?

Current spec

{
  "data": {
    "names": [
      "class",
      "probability"
    ],
    "ndarray": [
      [
        3,
        0.567219348236373
      ]
    ]
  },
  "meta": {
    "tags": {
      "version": "1.0.0"
    }
  }
}

Format I want

I would like to format the output as below. Expressing the returned values as a map would be much better flexible, even when we put additional values to the returned values. I understand the duplicated labels that are class and probability in the below case can increase the data size of returned value. In my opinion, it doesn't matter, since we usually request to the API with a data point. The duplication is not significant.

{
  "predictions": [
    {"class": 3, "probability": 0.567219348236373}
  ],
  "meta": {
    "tags": {
      "version": "1.0.0"
    }
  }
}
@ukclivecox
Copy link
Contributor

I think this would come under the area of allowing arbitrary JSON in the input and output for which there is an existing issues: #434 which is slated for the next release.

@ukclivecox ukclivecox self-assigned this May 16, 2019
@ukclivecox ukclivecox added this to the 0.2.x milestone May 16, 2019
@gsunner gsunner self-assigned this May 16, 2019
@yu-iskw
Copy link
Author

yu-iskw commented May 16, 2019

That is what I want to do. The formats of inputs and outputs can get more user-friendly. The current formats seems sklearn-friendly.

@ukclivecox
Copy link
Contributor

We plan to provide arbitrary JSON input and output in a field, e.g. jsonData. Would this fit your use case?
See #434

@yu-iskw
Copy link
Author

yu-iskw commented May 16, 2019

I think so, as long as we can use a flexible format with arbitrary JSON. I don't stock to have a fixed format. Customizable input and output are more convenient.

@yu-iskw
Copy link
Author

yu-iskw commented May 16, 2019

I want to know more detail about the specification of #434 . And I would be glad to join the discussion. Please keep me in the loop.

@ukclivecox ukclivecox added this to In progress in 0.3.0 May 24, 2019
@ukclivecox
Copy link
Contributor

Close as duplicate of #434

@ukclivecox ukclivecox moved this from In progress to Done in 0.3.0 May 28, 2019
agrski pushed a commit that referenced this issue Dec 2, 2022
* Fix static image uris

* further static fix for readthedocs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.3.0
  
Done
Development

No branches or pull requests

3 participants