Skip to main content

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.

GitHub Repo

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

expviz-0.0.3.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

expviz-0.0.3-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page