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

How to evaluate model with many records at once? #7

Closed
Tenceto opened this issue Nov 13, 2018 · 6 comments
Closed

How to evaluate model with many records at once? #7

Tenceto opened this issue Nov 13, 2018 · 6 comments

Comments

@Tenceto
Copy link

Tenceto commented Nov 13, 2018

The example provided uses just one record:

arguments = {
	"Sepal_Length" : 5.1,
	"Sepal_Width" : 3.5,
	"Petal_Length" : 1.4,
	"Petal_Width" : 0.2
}

result = os.evaluate("Iris", arguments)
print(result)

I was wondering if there was a way to do this but with many records, and to call the Openscorer just once. For example, if I have something like:

arguments = [
{
	"Sepal_Length" : 5.1,
	"Sepal_Width" : 3.5,
	"Petal_Length" : 1.4,
	"Petal_Width" : 0.2
},
{
	"Sepal_Length" : 5.0,
	"Sepal_Width" : 3.7,
	"Petal_Length" : 1.2,
	"Petal_Width" : 0.4
}
]

Is there a way to evaluate the model with both records at once?

@vruusmann
Copy link
Member

Is there a way to evaluate the model with both records at once?

Yes there is - it's called "batch prediction":
https://github.com/openscoring/openscoring#post-modelidbatch

The request and response objects are BatchEvaluationRequest and BatchEvaluationResponse, respectively.

Now, the problem is that the Openscoring-Python client library doesn't provide a method for interacting with this endpoint. The following PR might help, though: #6

@Tenceto
Copy link
Author

Tenceto commented Nov 13, 2018

Thanks for your quick response!

The last link you wrote seems to be the solution. Do you know how can I make it overwrite the current package installation? I've never used GitHub before, sorry if this is too basic.

@vruusmann
Copy link
Member

Do you know how can I make it overwrite the current package installation?

A complete re-install would be the safest option:

pip uninstall openscoring
pip install git+https://github.com/openscoring/openscoring-python.git

@Tenceto
Copy link
Author

Tenceto commented Nov 13, 2018

I think that's what I used to install the original version of the package. Shouldn't I do something different if I want the Openscoring object to have the evaluateBatch() method that has been added in the PR?

@vruusmann
Copy link
Member

Shouldn't I do something different if I want the Openscoring object to have the evaluateBatch() method that has been added in the PR?

  1. Clone Openscoring-Python to local computer.
  2. Apply this PR.
  3. Install Openscoring-Python from local computer using pip install .

@Tenceto
Copy link
Author

Tenceto commented Nov 13, 2018

Thanks!

@Tenceto Tenceto closed this as completed Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants