{ "info": { "author": "Timothy Moore", "author_email": "mtimothy984@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Utilities" ], "description": "# PCA 3D Visualizations\n\nThis module produces informative visualizations of atleast 3-dimensional data,\noptionally using principal component analysis and automatic clustering.\n\n## Features\n\n- *Animated*: high-quality videos with multi-processed video production using\n[pympanim](https://github.com/Tjstretchalot/pympanim).\n- (Pdf) *snapshots* that can be used in research papers or where the full video\ncannot be used.\n- Supports automatic *clustering* for informative zooms\n- Supports *trajectories* of data, for example for visualizing data through\ntime for a recurrent network or through layers of a feedforward network.\n- Supports using different markers, in any combination of style and color\n\n## Installation\n\nThis package requires [ffmpeg](https://ffmpeg.org/) to be installed.\n\n`pip install pca3dvis`\n\n## Example Videos\n\n`examples/gaus_balls.py`\n\nhttps://youtu.be/n9rpWhuN6LA\n\n`examples/all_rand.py`\n\nhttps://www.youtube.com/watch?v=YnIRqSQ8lAU\n\n## Usage\n\nVideo introduction at https://youtu.be/JqfVY9pdxY8\n\n### Projecting to 3D from higher dimensions\n\nThere are many approaches for projecting to 3-dimensions. Once you have used\nany of these projections, you can use this library to visualize the resulting\n3d scatter plot.\n\nThis library provides one linear projection that depends on the eigenvectors\nof the covariance matrix, called principal component analysis. For more\ninformation see\n[Wold, Esbensen, and Geladi, 1987](https://www.sciencedirect.com/science/article/pii/0169743987800849)\n\nTo quickly generate a `pca3dvis.trajectory.ProjectedTrajectory` using this\ntechnique for an arbitrary `ndarray[samples, features]` where `features > 3`,\nthe following snippet will work:\n\n```py\nimport numpy as np\nimport pca3dvis.pcs as pcs\n\ndata: np.ndarray # must have shape [samples > 3, features > 3]\nlbls: np.ndarray # must have shape [samples = data.shape[0], ...]\ntraj = pcs.get_pc_trajectory([data], lbls)\n```\n\nThis creates a trajectory with a single snapshot; for multiple snapshots, just\nhave `[data]` instead be a list of ndarrays which each have the same number of\nsamples but possibly different numbers of features.\n\n### Converting 3D data to trajectories\n\nA trajectory is a sequence of one or more snapshots which have the same labels.\nThey include the projection matrix that created them from the original data.\nFor quickly plotting already projected data, the labels can be swapped with all\nzeros of the appropriate shape and the projection matrix with the identity map.\n\n```py\nimport numpy as np\nimport pca3dvis.snapshot\nimport pca3dvis.trajectory\n\nraw_data: np.ndarray # must have shape [samples > 3, og_features]\nproj_matrices: np.ndarray # must have shape [og_features, 3]\nlbls: np.ndarray # must have shape [samples = data.shape[0], ...]\nsnap = pca3dvis.snapshot.project_with_matrix(raw_data, lbls, proj_matrices)\n\ntraj = pca3dvis.trajectory.ProjectedTrajectory([snap]) # trajectory of one snap\n```\n\n### Plotting trajectories\n\nPlotting trajectories, the main feature of this module, requires only that you\ngive a name to each snapshot and give markers to each label.\n\nMarkers are described as follows: Suppose there are N samples and M distinct\nstyles. Then for each style m, you will create a bool numpy array with shape\n(N,) mask where `mask[i]` is `True` if `sample[i]` should be rendered with\nstyle `m`. The style is described with a `dict` which are the keyword arguments\nto [scatter](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.scatter.html#matplotlib.axes.Axes.scatter).\nIt should at least specifiy the size and color (`s` and `c` respectively), and\nit may use a [colormap](https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html)\nto do so, but if it does it must specify the [norm](https://matplotlib.org/3.1.1/tutorials/colors/colormapnorms.html)\nexactly, i.e., with vmin and vmax not None.\n\nFor a more complete example of styling, see `examples/gaus_balls.py`.\n\n```py\nimport numpy as np\nimport pca3dvis.trajectory\nimport pca3dvis.worker\n\ntraj: pca3dvis.trajectory.ProjectedTrajectory\ntitles = [f'Snapshot {i+1}' for i in range(traj.num_snapshots)]\nmarkers = [(\n np.ones(traj.num_samples, 'bool'),\n {'s': 20, 'c': 'tab:red'}\n)]\npca3dvis.worker.generate(traj, markers, titles, 'out/my_out_folder',\n draft=True, clusters=True)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tjstretchalot/pca3dvis", "keywords": "pca3dvis animations video mp4 3d", "license": "CC0", "maintainer": "", "maintainer_email": "", "name": "pca3dvis", "package_url": "https://pypi.org/project/pca3dvis/", "platform": "", "project_url": "https://pypi.org/project/pca3dvis/", "project_urls": { "Homepage": "https://github.com/tjstretchalot/pca3dvis" }, "release_url": "https://pypi.org/project/pca3dvis/0.0.3/", "requires_dist": [ "pympanim", "pytypeutils", "numpy", "matplotlib", "hdbscan", "pytweening" ], "requires_python": ">=3.6", "summary": "Visualize 3d matrices or their 3d projections easily", "version": "0.0.3" }, "last_serial": 5615269, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d9c79a46bbdbdb962b3912a0063bfbae", "sha256": "4cb4791814ee900f1127f8ea573989c70f689edf47d35a303137992f78e3ed43" }, "downloads": -1, "filename": "pca3dvis-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d9c79a46bbdbdb962b3912a0063bfbae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 20444, "upload_time": "2019-07-30T20:18:15", "url": "https://files.pythonhosted.org/packages/d2/08/e496b4fdf1084fcfeff0adfba1bb27a381127c124ab0fae8e58569bef1eb/pca3dvis-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5bcdbaea04ff05164004d9e27d78b759", "sha256": "4da91464406c88572fa3955dcf8186e427a015684853b5deffc88085f027f94a" }, "downloads": -1, "filename": "pca3dvis-0.0.1.tar.gz", "has_sig": false, "md5_digest": "5bcdbaea04ff05164004d9e27d78b759", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 15892, "upload_time": "2019-07-30T20:18:17", "url": "https://files.pythonhosted.org/packages/37/ca/f486440fd4a3ca7056034cb8137245379029435ebedf799a05151d1e0209/pca3dvis-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "cac9b9cb5be990ca0d3b945331fe8613", "sha256": "2f1b80fa481527acaefbf39991247c5442f19f233819964b31bbfc93ed5b5e0a" }, "downloads": -1, "filename": "pca3dvis-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "cac9b9cb5be990ca0d3b945331fe8613", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 20508, "upload_time": "2019-07-31T15:54:04", "url": "https://files.pythonhosted.org/packages/3f/0c/d37cbad19006cbfe4b1d1c47192e26dc29d72edc05bdae4a9cda1236d085/pca3dvis-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d89ce173c3befc0931c7d9d8f60f0185", "sha256": "c2ff19d3042b1353231dfef27b0e3a36cade13fde1dfc28379ecfc0ff7f8019d" }, "downloads": -1, "filename": "pca3dvis-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d89ce173c3befc0931c7d9d8f60f0185", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 16035, "upload_time": "2019-07-31T15:54:05", "url": "https://files.pythonhosted.org/packages/97/9a/d61d8ac1f8a800963a5e7e8c4302078db15d1992445798b2541c084d804b/pca3dvis-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "2efdfb36e39d40466fc37a9d56accd20", "sha256": "c5b75866a62c9ed588e4a2fbd13b81b0dcd163fe5bdbccf3047d7930a0ce1515" }, "downloads": -1, "filename": "pca3dvis-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "2efdfb36e39d40466fc37a9d56accd20", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 20521, "upload_time": "2019-07-31T19:37:40", "url": "https://files.pythonhosted.org/packages/01/f0/9dbb1f1e41d261550042d3205f0b390a01a6f050cbb75cfed12fc8eb1c14/pca3dvis-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3f49e8331932105dcca41cafa7fc5ff", "sha256": "1c4e0a65156af7aa0bc672e50d3655128dc42c8f45a156ddb5f3a6b90d6da6d5" }, "downloads": -1, "filename": "pca3dvis-0.0.3.tar.gz", "has_sig": false, "md5_digest": "d3f49e8331932105dcca41cafa7fc5ff", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 16039, "upload_time": "2019-07-31T19:37:42", "url": "https://files.pythonhosted.org/packages/d2/b7/3a906b6493af4e594f280827197ee25b65dc74ba1466b0880e58c4e270d1/pca3dvis-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2efdfb36e39d40466fc37a9d56accd20", "sha256": "c5b75866a62c9ed588e4a2fbd13b81b0dcd163fe5bdbccf3047d7930a0ce1515" }, "downloads": -1, "filename": "pca3dvis-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "2efdfb36e39d40466fc37a9d56accd20", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 20521, "upload_time": "2019-07-31T19:37:40", "url": "https://files.pythonhosted.org/packages/01/f0/9dbb1f1e41d261550042d3205f0b390a01a6f050cbb75cfed12fc8eb1c14/pca3dvis-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3f49e8331932105dcca41cafa7fc5ff", "sha256": "1c4e0a65156af7aa0bc672e50d3655128dc42c8f45a156ddb5f3a6b90d6da6d5" }, "downloads": -1, "filename": "pca3dvis-0.0.3.tar.gz", "has_sig": false, "md5_digest": "d3f49e8331932105dcca41cafa7fc5ff", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 16039, "upload_time": "2019-07-31T19:37:42", "url": "https://files.pythonhosted.org/packages/d2/b7/3a906b6493af4e594f280827197ee25b65dc74ba1466b0880e58c4e270d1/pca3dvis-0.0.3.tar.gz" } ] }