Visualize experiments tables and figures.
Project description
Experiments Visualization Toolkit (ExpViz)
Welcome to the Experiments Visualization Toolkit (ExpViz), a Python-based solution designed to facilitate the handling and visualization of experiment results, particularly those stored in JSON format. Whether your results are stored in files or represented as JSON-like dictionaries, ExpViz is here to streamline your data visualization process.
Features
- Read Results: Directly input JSON-like dictionaries or read experiment results from JSON files in a specified directory.
- Convert to DataFrame: Elegantly transform nested dictionaries into customizable Pandas DataFrames.
- Table Rendering: Convert DataFrames to LaTeX and Markdown tables for seamless integration into documents and web pages.
- Jupyter Display: Render and showcase DataFrames interactively within Jupyter notebooks.
Installation
# Clone the repository
git clone https://github.com/fuzihaofzh/expviz.git
# Navigate to the cloned repository
cd expviz
# (Optional) Install any dependencies listed in requirements.txt
pip install -r requirements.txt
Usage
1. Reading Results
# Directly using a JSON-like dictionary
data_dict = {
"exp1": {"Score1": 10.1, "Score2": 20},
"exp2": {"Score1": 30, "Score2": None}
}
results = read_results(data_dict=data_dict)
# Alternatively, using the base URL and experiment names
baseurl = "path/to/experiment/results"
expnames = ["experiment1", "experiment2"] # or {"exp1": "experiment1", "exp2": "experiment2"}
results = read_results(baseurl, expnames, filename="eval.json")
2. Converting to DataFrame
# Format and convert the results to a DataFrame
df = dict_to_dataframe(results, fmt='{:,.3g}', transpose=False)
print(df)
3. Rendering as LaTeX or Markdown
# Convert the DataFrame to a LaTeX table
latex_table = to_latex(results, fmt='{:,.3g}', transpose=False)
print(latex_table)
# Convert the DataFrame to a Markdown table
markdown_table = to_markdown(results, fmt='{:,.3g}', transpose=False)
print(markdown_table)
4. Displaying in Jupyter
# Visualize the DataFrame in a Jupyter notebook
show(results, fmt='{:,.3g}', transpose=False)
Examples
-
Using JSON-like Dictionary
data_dict = { "exp1": {"Score1": 10.1, "Score2": 20}, "exp2": {"Score1": 30, "Score2": None} } results = read_results(data_dict=data_dict)
-
Using a List of Experiments
results = read_results("path/to/results", ["experiment1", "experiment2"])
-
Using a Dictionary of Experiments
results = read_results("path/to/results", {"exp1": "experiment1", "exp2": "experiment2"})
-
Visualizing in Jupyter Notebook
show(results)
-
Rendering as Markdown
md_table = to_markdown(results) print(md_table)
Contributing
Contributions are warmly welcomed! For information on how to contribute, please refer to our contributing guidelines.
License
ExpViz is under the MIT License. For more details, check out the LICENSE.md file in our GitHub repository.
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
Built Distribution
File details
Details for the file expviz-0.0.3.tar.gz
.
File metadata
- Download URL: expviz-0.0.3.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6974bdd2a7374fcfe478628f543748bbcf86f5d3d65ae94235e4f70fa8127b |
|
MD5 | aad5b4e3dea3af1fa99d3f73aede9c7d |
|
BLAKE2b-256 | 4dfd88e996876b8d0b58f55d2d00ef4ad500582ff84dd1a1144d7df3168f5afe |
File details
Details for the file expviz-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: expviz-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 625d8d70c6a24778378660606dbe0ac7234e7dd5145b44e13e947aa1b71c71e3 |
|
MD5 | b92af27f795709604295b8c96c8f34da |
|
BLAKE2b-256 | 278a45e03a75a7b99ccf548c94ed807a723a5f4771af1e4988f1241172719c1e |