Model wrapper for Pytorch, which can training, predict, evaluate, etc.
Project description
Usage Sample ''''''''''''
.. code:: python
from model_wrapper import SplitClassModelWrapper
classes = ['class1', 'class2', 'class3'...]
X = [[...], [...],]
y = [0, 0, 1, 2, 1...]
model = ...
wrapper = SplitClassModelWrapper(model, classes=classes)
wrapper.train(X, y, val_size=0.2)
X_test = [[...], [...],]
y_test = [0, 1, 1, 2, 1...]
result = wrapper.evaluate(X_test, y_test)
# 0.953125
result = wrapper.predict(X_test)
# [0, 1]
result = wrapper.predict_classes(X_test)
# ['class1', 'class2']
result = wrapper.predict_proba(X_test)
# ([0, 1], array([0.99439645, 0.99190724], dtype=float32))
result = wrapper.predict_classes_proba(X_test)
# (['class1', 'class2'], array([0.99439645, 0.99190724], dtype=float32))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
model-wrapper-0.0.3.tar.gz
(11.4 kB
view details)
File details
Details for the file model-wrapper-0.0.3.tar.gz
.
File metadata
- Download URL: model-wrapper-0.0.3.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d3176ccefdd635d68d380718d67213dbb8e8b1bc7153033b8192fe6e8de1233 |
|
MD5 | 23e3a97df1703f206bf5a1649e6a126b |
|
BLAKE2b-256 | ad5c0683f429cf9e25ff080220beed0add723298dadb9cb0b488fb0f945b5ab6 |