Skip to main content
# [SSUmunity Labs](https://www.facebook.com/ai.ssumunity) - Model Value Writer

This repo is a module for handling DeepLearning model values
(accuracy, loss, etc...) based on csv and 'ModelValue' class.

## Simple Use
~~~
from model_writer import *

> mv1 = ModelValue("model1", {"accuracy": 0.7})
> mv2 = ModelValue("model2", {"accuracy": 0.3})

> mv1.set_value("loss",0.3)
> mv2.set_value("loss",0.64)

> writer = ModelValuesWriter([mv1, mv2], io_name='simple')
> writer.to_csv('./test.csv')
> writer.to_md('./README.md')
~~~
#### Result
[](from_simple)

| | model1 | model2 |
|:---------|---------:|---------:|
| accuracy | 0.7 | 0.5 |
| loss | 0.3 | 0.64 |
[](from_simple)


## ModelValue class
"ModelValue" is a class for some values of one model during training or eval.

#### Useage
You can handle this class like this.
~~~
from model_writer import *

> mv1 = ModelValue("model1", {"accuracy": 0.7})
> mv2 = ModelValue("model2", {"loss": 0.3})

# use 'mv.set_value(value_name, value)' to add value in 'mv' instance.
> mv1.set_value("loss",0.3)
> mv2.set_value("accuracy",0.64)
~~~

## ModelWriter class
"ModelWriter" is a class for write to .md or .csv file with ModelValue classes.

#### Useage
You can handle this class like this.
~~~
> writer = ModelValuesWriter([mv1, mv2], io_name='writer')
> writer.to_csv('./test.csv') # save mv1, mv2 as csv file.
> writer.to_md('./README.md') # save mv1, mv2 as a chart in markdown file between "io_name" token.
~~~

#### Result
You can see the chart below is wrapped by "from_{io_name}" token in edit mode.

[](from_writer)

| | model1 | model2 |
|:---------|---------:|---------:|
| accuracy | 0.7 | 0.5 |
| loss | 0.3 | 0.64 |
[](from_writer)

## ModelReader class
"ModelReader" is a class for read from .csv file with ModelValue classes.

#### Useage
You can handle this class like this.
~~~
> reader = ModelValuesReader('./test.csv')
> mv1 = reader.search_model_value('model1')
> mv1.set_value('accuracy', 2)
>
> writer = ModelValuesWriter(reader.classes, io_name='reader')
> writer.to_csv('./test.csv') # save mv1, mv2 as csv file.
> writer.to_md('./README.md') # save mv1, mv2 as a chart in markdown file between "io_name" token.
~~~

#### Result
[](from_reader)

| | model1 | model2 |
|:---------|---------:|---------:|
| accuracy | 2 | 0.5 |
| loss | 0.3 | 0.64 |
[](from_reader)

## License
Project is published under the MIT licence. Feel free to clone and modify repo as you want, but don'y forget to add reference to authors :)


Release files for model-writer 0.0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model-writer 0.0.0.2
File Size Uploaded
model_writer-0.0.0.2.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for model-writer 0.0.0.2
File Interpreter ABI Platform
model_writer-0.0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / model_writer-0.0.0.2.tar.gz

Download URL model_writer-0.0.0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a10c84c0751449daf689f7343407646d3737c28d6fd9acf613a6a1d3b01ea0b5
BLAKE2b-256 checksum
How to use checksums
2303aee575cc8b3485f44a32b4d6c8803f3bbebc83ed88f415a74c681dd92ac1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release files / model_writer-0.0.0.2-py3-none-any.whl

Download URL model_writer-0.0.0.2-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a36f6d8b4cc094517bff5cf4d775382d17b60eeeef2db04e2a9a710514ee20dd
BLAKE2b-256 checksum
How to use checksums
ef753db4bf54d94a998a0a45e80613b0fd44db9ae57ee95d6f758d84583393bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page