data-morph-ai


Namedata-morph-ai JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryTeaching tool on the importance of data visualization.
upload_time2023-09-24 16:52:28
maintainerStefanie Molin
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2017 jmatejka Copyright (c) 2023 Stefanie Molin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords data visualization summary statistics data animation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            <div align="center">
  <img alt="Data Morph" src="https://github.com/stefmolin/data-morph/raw/main/docs/_static/logo.png">

  <hr>

  <table>
   <tr>
     <td>
      <img alt="Last Release" src="https://img.shields.io/badge/last%20release-inactive?style=for-the-badge">
     </td>
     <td>
      <a href="https://stefmolin.github.io/data-morph" target="_blank" rel="noopener noreferrer">
        <img alt="View docs" src="https://img.shields.io/badge/docs-stable-success">
      </a>
      <a href="https://pypi.org/project/data-morph-ai/" target="_blank" rel="noopener noreferrer">
        <img alt="PyPI release" src="https://img.shields.io/pypi/v/data-morph-ai.svg">
      </a>
      <a href="https://anaconda.org/conda-forge/data-morph-ai" target="_blank" rel="noopener noreferrer">
        <img alt="conda-forge release" src="https://img.shields.io/conda/vn/conda-forge/data-morph-ai.svg">
      </a>
      <a href="https://pypi.org/project/data-morph-ai/" target="_blank" rel="noopener noreferrer">
        <img alt="Supported Python Versions" src="https://img.shields.io/pypi/pyversions/data-morph-ai">
      </a>
      <a href="https://github.com/stefmolin/data-morph/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">
         <img alt="License" src="https://img.shields.io/pypi/l/data-morph-ai.svg?color=blueviolet">
      </a>
     </td>
   </tr>
   <tr>
     <td>
       <img alt="Citation information" src="https://img.shields.io/badge/for%20citation-inactive?style=for-the-badge">
   </td>
     <td>
      <a href="https://zenodo.org/badge/latestdoi/597895841" target="_blank" rel="noopener noreferrer">
        <img alt="DOI" src="https://zenodo.org/badge/597895841.svg">
      </a>
     </td>
   </tr>
   <tr>
     <td>
      <img alt="Build status" src="https://img.shields.io/badge/build%20status-inactive?style=for-the-badge">
     </td>
     <td>
      <a href="https://codecov.io/gh/stefmolin/data-morph" target="_blank" rel="noopener noreferrer">
        <img alt="codecov" src="https://codecov.io/gh/stefmolin/data-morph/branch/main/graph/badge.svg?token=3SEEG9SZQO">
      </a>
      <a href="https://github.com/stefmolin/data-morph/actions/workflows/ci.yml" target="_blank" rel="noopener noreferrer">
        <img alt="CI" src="https://github.com/stefmolin/data-morph/actions/workflows/ci.yml/badge.svg">
      </a>
      <a href="https://github.com/stefmolin/data-morph/actions/workflows/docs.yml" target="_blank" rel="noopener noreferrer">
        <img alt="Deploy Docs" src="https://github.com/stefmolin/data-morph/actions/workflows/docs.yml/badge.svg">
      </a>
     </td>
   </tr>
  </table>
  <hr/>
</div>

Data Morph transforms an input dataset of 2D points into select shapes, while preserving the summary statistics to a given number of decimal points through simulated annealing.

<div align="center">
  <img alt="Morphing the panda dataset into the star shape." src="https://raw.githubusercontent.com/stefmolin/data-morph/main/docs/_static/panda-to-star-eased.gif">
  <br/>
</div>

## Installation

Data Morph can be installed from PyPI using `pip`:

```console
$ pip install data-morph-ai
```

Alternatively, Data Morph can be installed with `conda` by specifying the `conda-forge` channel:

```console
$ conda install -c conda-forge data-morph-ai
```

## Usage

Once installed, Data Morph can be used on the command line or as an importable Python package. Below are some examples; be sure to check out the [documentation](https://stefmolin.github.io/data-morph) for more information.


### Command Line Usage

Run `data-morph` on the command line:

```console
$ data-morph --start-shape panda --target-shape star
```

This produces the animation in the newly-created `morphed_data` directory within your current working directory (shown above).

----

See all available CLI options by passing in `--help`:

```console
$ data-morph --help
```

### Python Usage

The `DataMorpher` class performs the morphing from a `Dataset` to a `Shape`. Any `pandas.DataFrame` with numeric columns `x` and `y` can be a `Dataset`. Use the `DataLoader` to create the `Dataset` from a file or use a built-in dataset:

```python
from data_morph.data.loader import DataLoader

dataset = DataLoader.load_dataset('panda')
```

For morphing purposes, all target shapes are placed/sized based on aspects of the `Dataset` class.
All shapes are accessible via the `ShapeFactory` class:

```python
from data_morph.shapes.factory import ShapeFactory

shape_factory = ShapeFactory(dataset)
target_shape = shape_factory.generate_shape('star')
```

With the `Dataset` and `Shape` created, here is a minimal example of morphing:

```python
from data_morph.morpher import DataMorpher

morpher = DataMorpher(
    decimals=2,
    in_notebook=False,  # whether you are running in a Jupyter Notebook
    output_dir='data_morph/output',
)

result = morpher.morph(start_shape=dataset, target_shape=target_shape)
```

Note that the `result` variable in the above code block is a `pandas.DataFrame` of the data after completing the specified iterations of the simulated annealing process. The `DataMorpher.morph()` method is also saving plots to visualize the output periodically and make an animation; these end up in `data_morph/output`, which we set as `DataMorpher.output_dir`.


----

In this example, we morphed the built-in panda `Dataset` into the star `Shape`. Be sure to try out the other built-in options:

* The `DataLoader.AVAILABLE_DATASETS` attribute contains a list of available datasets, which are also visualized in the `DataLoader` documentation.

* The `ShapeFactory.AVAILABLE_SHAPES` attribute contains a list of available shapes, which are also visualized in the `ShapeFactory` documentation.

## Acknowledgements

This code has been altered by Stefanie Molin ([@stefmolin](https://github.com/stefmolin)) to work for other input datasets by parameterizing the target shapes with information from the input shape. The original code works for a specific dataset called the "Datasaurus" and was created for the paper *Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing* by Justin Matejka and George Fitzmaurice (ACM CHI 2017).

The paper and video can be found on the Autodesk Research website [here](https://www.research.autodesk.com/publications/same-stats-different-graphs-generating-datasets-with-varied-appearance-and-identical-statistics-through-simulated-annealing/). The version of the code placed on GitHub at [jmatejka/same-stats-different-graphs](https://github.com/jmatejka/same-stats-different-graphs), served as the starting point for the Data Morph code base, which is on GitHub at [stefmolin/data-morph](https://github.com/stefmolin/data-morph).

Read more about the creation of Data Morph [here](https://medium.com/@stefaniemolin/data-morph-moving-beyond-the-datasaurus-dozen-156927b20f8c).

## Citations

If you use this software, please cite both Data Morph (DOI: [10.5281/zenodo.7834197](https://doi.org/10.5281/zenodo.7834197)) and *[Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing](https://damassets.autodesk.net/content/dam/autodesk/research/publications-assets/pdf/same-stats-different-graphs.pdf)* by Justin Matejka and George Fitzmaurice (ACM CHI 2017).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "data-morph-ai",
    "maintainer": "Stefanie Molin",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "data visualization,summary statistics,data animation",
    "author": "",
    "author_email": "Stefanie Molin <24376333+stefmolin@users.noreply.github.com>, Aaron Stevens <bheklilr2@gmail.com>, Justin Matejka <Justin.Matejka@Autodesk.com>",
    "download_url": "https://files.pythonhosted.org/packages/03/de/497891d62a7812986e908b58112a0f1a74fb5f215cfedc6189d7a3f3211a/data-morph-ai-0.2.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img alt=\"Data Morph\" src=\"https://github.com/stefmolin/data-morph/raw/main/docs/_static/logo.png\">\n\n  <hr>\n\n  <table>\n   <tr>\n     <td>\n      <img alt=\"Last Release\" src=\"https://img.shields.io/badge/last%20release-inactive?style=for-the-badge\">\n     </td>\n     <td>\n      <a href=\"https://stefmolin.github.io/data-morph\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"View docs\" src=\"https://img.shields.io/badge/docs-stable-success\">\n      </a>\n      <a href=\"https://pypi.org/project/data-morph-ai/\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"PyPI release\" src=\"https://img.shields.io/pypi/v/data-morph-ai.svg\">\n      </a>\n      <a href=\"https://anaconda.org/conda-forge/data-morph-ai\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"conda-forge release\" src=\"https://img.shields.io/conda/vn/conda-forge/data-morph-ai.svg\">\n      </a>\n      <a href=\"https://pypi.org/project/data-morph-ai/\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"Supported Python Versions\" src=\"https://img.shields.io/pypi/pyversions/data-morph-ai\">\n      </a>\n      <a href=\"https://github.com/stefmolin/data-morph/blob/main/LICENSE\" target=\"_blank\" rel=\"noopener noreferrer\">\n         <img alt=\"License\" src=\"https://img.shields.io/pypi/l/data-morph-ai.svg?color=blueviolet\">\n      </a>\n     </td>\n   </tr>\n   <tr>\n     <td>\n       <img alt=\"Citation information\" src=\"https://img.shields.io/badge/for%20citation-inactive?style=for-the-badge\">\n   </td>\n     <td>\n      <a href=\"https://zenodo.org/badge/latestdoi/597895841\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"DOI\" src=\"https://zenodo.org/badge/597895841.svg\">\n      </a>\n     </td>\n   </tr>\n   <tr>\n     <td>\n      <img alt=\"Build status\" src=\"https://img.shields.io/badge/build%20status-inactive?style=for-the-badge\">\n     </td>\n     <td>\n      <a href=\"https://codecov.io/gh/stefmolin/data-morph\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"codecov\" src=\"https://codecov.io/gh/stefmolin/data-morph/branch/main/graph/badge.svg?token=3SEEG9SZQO\">\n      </a>\n      <a href=\"https://github.com/stefmolin/data-morph/actions/workflows/ci.yml\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"CI\" src=\"https://github.com/stefmolin/data-morph/actions/workflows/ci.yml/badge.svg\">\n      </a>\n      <a href=\"https://github.com/stefmolin/data-morph/actions/workflows/docs.yml\" target=\"_blank\" rel=\"noopener noreferrer\">\n        <img alt=\"Deploy Docs\" src=\"https://github.com/stefmolin/data-morph/actions/workflows/docs.yml/badge.svg\">\n      </a>\n     </td>\n   </tr>\n  </table>\n  <hr/>\n</div>\n\nData Morph transforms an input dataset of 2D points into select shapes, while preserving the summary statistics to a given number of decimal points through simulated annealing.\n\n<div align=\"center\">\n  <img alt=\"Morphing the panda dataset into the star shape.\" src=\"https://raw.githubusercontent.com/stefmolin/data-morph/main/docs/_static/panda-to-star-eased.gif\">\n  <br/>\n</div>\n\n## Installation\n\nData Morph can be installed from PyPI using `pip`:\n\n```console\n$ pip install data-morph-ai\n```\n\nAlternatively, Data Morph can be installed with `conda` by specifying the `conda-forge` channel:\n\n```console\n$ conda install -c conda-forge data-morph-ai\n```\n\n## Usage\n\nOnce installed, Data Morph can be used on the command line or as an importable Python package. Below are some examples; be sure to check out the [documentation](https://stefmolin.github.io/data-morph) for more information.\n\n\n### Command Line Usage\n\nRun `data-morph` on the command line:\n\n```console\n$ data-morph --start-shape panda --target-shape star\n```\n\nThis produces the animation in the newly-created `morphed_data` directory within your current working directory (shown above).\n\n----\n\nSee all available CLI options by passing in `--help`:\n\n```console\n$ data-morph --help\n```\n\n### Python Usage\n\nThe `DataMorpher` class performs the morphing from a `Dataset` to a `Shape`. Any `pandas.DataFrame` with numeric columns `x` and `y` can be a `Dataset`. Use the `DataLoader` to create the `Dataset` from a file or use a built-in dataset:\n\n```python\nfrom data_morph.data.loader import DataLoader\n\ndataset = DataLoader.load_dataset('panda')\n```\n\nFor morphing purposes, all target shapes are placed/sized based on aspects of the `Dataset` class.\nAll shapes are accessible via the `ShapeFactory` class:\n\n```python\nfrom data_morph.shapes.factory import ShapeFactory\n\nshape_factory = ShapeFactory(dataset)\ntarget_shape = shape_factory.generate_shape('star')\n```\n\nWith the `Dataset` and `Shape` created, here is a minimal example of morphing:\n\n```python\nfrom data_morph.morpher import DataMorpher\n\nmorpher = DataMorpher(\n    decimals=2,\n    in_notebook=False,  # whether you are running in a Jupyter Notebook\n    output_dir='data_morph/output',\n)\n\nresult = morpher.morph(start_shape=dataset, target_shape=target_shape)\n```\n\nNote that the `result` variable in the above code block is a `pandas.DataFrame` of the data after completing the specified iterations of the simulated annealing process. The `DataMorpher.morph()` method is also saving plots to visualize the output periodically and make an animation; these end up in `data_morph/output`, which we set as `DataMorpher.output_dir`.\n\n\n----\n\nIn this example, we morphed the built-in panda `Dataset` into the star `Shape`. Be sure to try out the other built-in options:\n\n* The `DataLoader.AVAILABLE_DATASETS` attribute contains a list of available datasets, which are also visualized in the `DataLoader` documentation.\n\n* The `ShapeFactory.AVAILABLE_SHAPES` attribute contains a list of available shapes, which are also visualized in the `ShapeFactory` documentation.\n\n## Acknowledgements\n\nThis code has been altered by Stefanie Molin ([@stefmolin](https://github.com/stefmolin)) to work for other input datasets by parameterizing the target shapes with information from the input shape. The original code works for a specific dataset called the \"Datasaurus\" and was created for the paper *Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing* by Justin Matejka and George Fitzmaurice (ACM CHI 2017).\n\nThe paper and video can be found on the Autodesk Research website [here](https://www.research.autodesk.com/publications/same-stats-different-graphs-generating-datasets-with-varied-appearance-and-identical-statistics-through-simulated-annealing/). The version of the code placed on GitHub at [jmatejka/same-stats-different-graphs](https://github.com/jmatejka/same-stats-different-graphs), served as the starting point for the Data Morph code base, which is on GitHub at [stefmolin/data-morph](https://github.com/stefmolin/data-morph).\n\nRead more about the creation of Data Morph [here](https://medium.com/@stefaniemolin/data-morph-moving-beyond-the-datasaurus-dozen-156927b20f8c).\n\n## Citations\n\nIf you use this software, please cite both Data Morph (DOI: [10.5281/zenodo.7834197](https://doi.org/10.5281/zenodo.7834197)) and *[Same Stats, Different Graphs: Generating Datasets with Varied Appearance and Identical Statistics through Simulated Annealing](https://damassets.autodesk.net/content/dam/autodesk/research/publications-assets/pdf/same-stats-different-graphs.pdf)* by Justin Matejka and George Fitzmaurice (ACM CHI 2017).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2017 jmatejka Copyright (c) 2023 Stefanie Molin  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Teaching tool on the importance of data visualization.",
    "version": "0.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/stefmolin/data-morph/issues",
        "Documentation": "https://stefmolin.github.io/data-morph/stable/api.html",
        "Homepage": "https://stefmolin.github.io/data-morph",
        "Source": "https://github.com/stefmolin/data-morph"
    },
    "split_keywords": [
        "data visualization",
        "summary statistics",
        "data animation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a4a3da3109a373bcdd59cd80a74f2efab528649c459e2441b312f1f121024be",
                "md5": "9914c8e7b9f62c7e229b1e3da85d5a11",
                "sha256": "3b449eede1a0ee81c61defbf0799b6aaab5ffbcbe0d36cbfb47d684f273084dd"
            },
            "downloads": -1,
            "filename": "data_morph_ai-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9914c8e7b9f62c7e229b1e3da85d5a11",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 104115,
            "upload_time": "2023-09-24T16:52:26",
            "upload_time_iso_8601": "2023-09-24T16:52:26.568618Z",
            "url": "https://files.pythonhosted.org/packages/9a/4a/3da3109a373bcdd59cd80a74f2efab528649c459e2441b312f1f121024be/data_morph_ai-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "03de497891d62a7812986e908b58112a0f1a74fb5f215cfedc6189d7a3f3211a",
                "md5": "c727232bd8768a4908e10152ef3dab89",
                "sha256": "23b22a133b8fdf673ed47321dc74d8cfa4ea78178bb0dcd8169eeb7ce7583490"
            },
            "downloads": -1,
            "filename": "data-morph-ai-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c727232bd8768a4908e10152ef3dab89",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 10933028,
            "upload_time": "2023-09-24T16:52:28",
            "upload_time_iso_8601": "2023-09-24T16:52:28.443272Z",
            "url": "https://files.pythonhosted.org/packages/03/de/497891d62a7812986e908b58112a0f1a74fb5f215cfedc6189d7a3f3211a/data-morph-ai-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-24 16:52:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stefmolin",
    "github_project": "data-morph",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "data-morph-ai"
}
        
Elapsed time: 0.12892s