Comments (2)
To keep information complete I copy-paste here comments from #33 (which is an issue that duplicates this one):
msavinash commented 15 hours ago
I don't understand how parametrize is supposed to work. From my understanding its something like this:
parametrize_parameters = [
{"y_test": [1, 2, 3], "y_pred": [4, 5, 6]},
{"y_test": [1, 2, 3], "y_pred": [1, 2, 3]},
]
@nnbench.parametrize(parameters=parametrize_parameters)
def accuracy(model: base.BaseEstimator, y_test: np.ndarray, y_pred: np.ndarray) -> float:
accuracy = metrics.accuracy_score(y_test, y_pred)
return accuracy
Is this accurate?
nicholasjng commented 31 minutes ago
Is this accurate?
Yes.
(The arguments in the decorator dictionaries should match the parametrized benchmark function's typing, so the arguments should be np.array([1, 2, 3]), np.array([4, 5, 6]), ..., but you got it right conceptually.)
from nnbench.
I tried running this:
import nnbench
from sklearn import base
import numpy as np
parametrize_parameters = [
{"y_test": np.array([1, 2, 3]), "y_pred": np.array([4, 5, 6])},
{"y_test": np.array([1, 2, 3]), "y_pred": np.array([1, 2, 3])},
]
@nnbench.parametrize(parameters=parametrize_parameters)
def accuracy(model: base.BaseEstimator, y_test: np.ndarray, y_pred: np.ndarray) -> float:
accuracy = metrics.accuracy_score(y_test, y_pred)
return accuracy
from nnbench import runner
r = runner.BenchmarkRunner()
y_pred = model.predict(X_test)
result = r.run("__main__", params={"model": model})
r.report(to='console', result=result)
Got this error:
File "C:\Users\Public\Documents\Avinash\Projects\OpenSource\nnbench\test.py", line 65, in <module>
result = r.run("__main__", params={"model": model})#, "y_pred": y_pred, "y_test": y_test})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Public\Documents\Avinash\Projects\OpenSource\nnbench\src\nnbench\runner.py", line 218, in run
_check(dparams, self.benchmarks)
File "C:\Users\Public\Documents\Avinash\Projects\OpenSource\nnbench\src\nnbench\runner.py", line 84, in _check
raise ValueError(f"missing value for required parameter {name!r}")
ValueError: missing value for required parameter 'y_test'
I believe the code expects me to add y_pred and y_test as well, but they are defined for parameterize decorator. What is the expected behavior here?
result = r.run("__main__", params={"model": model, "y_pred": y_pred, "y_test": y_test})
from nnbench.
Related Issues (20)
- Set up best practice for easy record serialization + parametrization + reproducibility HOT 1
- Docs: Versioning considerations
- Remove `ArtifactCollection` Wrapper
- Redesign artifact concept HOT 1
- Module path construction causes typecheck fails
- Improve base `Transform` interface
- Enhance API Reference Documentation for nnbench HOT 1
- Parameter representations instead of parameters in benchmark records HOT 3
- Add `nnbench.State` object holding current benchmark information, inject into setup/teardown tasks
- Add global memo cache and eviction API
- Update Artifact Tutorial
- Supplying `nnbench.Transform`s directly to record IO
- Hint all `name` arguments as `str` only HOT 1
- Add memo followups to the user guide
- Investigate binding params to benchmarks with weakrefs
- Add `transform` slot to record IO types
- Add small parameter representation guide for the benchmark runner
- Stabilize the record IO interface
- Explore a CLI workflow for usage in ML pipelines and CI
- macOS test failure due to GitHub Apple Silicon oddities
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nnbench.