jekyll-theme-pca-cloud 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +193 -0
- data/_includes/footer.html +1 -0
- data/_includes/head.html +7 -0
- data/_includes/header.html +5 -0
- data/_includes/learning.html +54 -0
- data/_includes/studio.html +51 -0
- data/_layouts/default.html +18 -0
- data/_layouts/home.html +5 -0
- data/_layouts/page.html +9 -0
- data/_layouts/post.html +10 -0
- data/assets/cloud.png +0 -0
- data/assets/css/style.css +16 -0
- data/assets/js/app.js +267 -0
- data/assets/js/kaggle.js +56 -0
- data/assets/js/learn.js +248 -0
- data/assets/js/pca.js +91 -0
- data/assets/js/projection-worker.js +7 -0
- data/assets/js/tsne.js +78 -0
- metadata +70 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ce20a781a1a2332f1ae77929717e89b16563a56083fa5b70cece94dee0795db3
|
|
4
|
+
data.tar.gz: 92c1d6aa7f50be10256bb176a0c3ba1b2d35cb6550f1148bf647cc5e32bfbaf0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 63b90de442b1f02fbaf3444b2039bd0a3b7303140b544be197123a851907b33d9f36fef5d1c98cb4da09fff37f7324157c21962ff43f2048f2ad7e913d185d42
|
|
7
|
+
data.tar.gz: f580d99d33a2cb69080de51521f36d3e4193e4474e85eb6f5ea7c89a2cdf5d5efe08a0f6a399f1c0d0c5f7ce10bb76277bfd0764f637d788079b32761e4cc7da
|
data/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# PCA Cloud ☁️
|
|
4
|
+
|
|
5
|
+
### Turn your spreadsheet into clouds!
|
|
6
|
+
|
|
7
|
+
Discover patterns across your numeric features with interactive 3D clouds, PCA, and t-SNE.
|
|
8
|
+
|
|
9
|
+
**[Open PCA Cloud →](https://archipelagoing.github.io/PCACloud/)**
|
|
10
|
+
|
|
11
|
+
No sign-up · No installation · Your data stays in your browser
|
|
12
|
+
|
|
13
|
+
[](https://archipelagoing.github.io/PCACloud/)
|
|
14
|
+
|
|
15
|
+
*if you look up at the sky, i wonder, can you find your data there?*
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
## Your spreadsheet, with its head in the clouds.⋆。˚ ☁︎ ˚。⋆
|
|
20
|
+
|
|
21
|
+
A table gives you the numbers. PCA Cloud helps you explore how they fit together. Bring measurements from an experiment, a public dataset, or a CSV you've been curious about, and see their projected shape in three dimensions.
|
|
22
|
+
|
|
23
|
+
- **Look for patterns worth investigating!** Explore groups, spread, and unusual points from different angles.
|
|
24
|
+
- **Build intuition as you go...** Switch between PCA and t-SNE to see how different ways of simplifying the same data change the picture.
|
|
25
|
+
- **Make the view your own** Choose soft cloud particles or individual data points, adjust the atmosphere, and save an image for a slide, notebook, or conversation.
|
|
26
|
+
- **Keep your data on your device.** Uploaded CSVs are processed locally in your browser. No account or API key is needed.
|
|
27
|
+
|
|
28
|
+
## Try it today with a ready-made cloud! ⋆。˚ ☁︎ ˚。⋆
|
|
29
|
+
|
|
30
|
+
**[Open the app](https://archipelagoing.github.io/PCACloud/)** and the built-in atmospheric sample is ready to explore. You don't need a dataset to get started.
|
|
31
|
+
|
|
32
|
+
1. **Drag to orbit.** See the cloud from another angle. Scroll or use **+/−** to zoom.
|
|
33
|
+
2. **Choose Data points.** See the individual projected rows behind the cloud.
|
|
34
|
+
3. **Switch to t-SNE.** Explore local similarities, then switch back to PCA to compare the views.
|
|
35
|
+
4. **Save your favorite view.** Select **Save image** to download a PNG.
|
|
36
|
+
|
|
37
|
+
Use **Reset view** whenever you want to return to the starting camera position.
|
|
38
|
+
|
|
39
|
+
Select the **Learn PCA** tab on the right edge to slide out the learning drawer while keeping the sky interactive. **Variance** shows the complete scree plot; **Loadings** connects feature weights to a highlighted PCA axis. **Walkthrough** guides you through six steps using the assignment’s four-point example: change units, toggle standardization, orbit the scene, and click A–D to inspect a point. The main visualization highlights centering, component directions, projections, and reconstruction loss for the active step. Select **Studio** or press Escape to return to your dataset. Opening Learn PCA switches a t-SNE view to PCA.
|
|
40
|
+
|
|
41
|
+
## Bring your own data ⋆。˚ ☁︎ ˚。⋆
|
|
42
|
+
|
|
43
|
+
### Drop in a CSV
|
|
44
|
+
|
|
45
|
+
Drop a file onto **Bring your own data**, or click to browse. Include a header row and at least two numeric columns with two complete data rows.
|
|
46
|
+
|
|
47
|
+
You can explore files up to **5 MB** and **100 columns**. Text columns are excluded, and incomplete or malformed rows are skipped. Remove numeric IDs or other columns you don't want included before uploading.
|
|
48
|
+
|
|
49
|
+
### Explore a public Kaggle dataset
|
|
50
|
+
|
|
51
|
+
Open **Import from Kaggle** and select **Try Iris dataset**, or paste a public dataset link, choose **Find CSVs**, and select **Visualize dataset** for your chosen file.
|
|
52
|
+
|
|
53
|
+
If Kaggle can't serve the file directly to your browser, download the CSV yourself and drop it into the app. Private datasets, competition authentication, and ZIP extraction aren't supported.
|
|
54
|
+
|
|
55
|
+
## Two ways to see the same data ⋆。˚ ☁︎ ˚。⋆
|
|
56
|
+
|
|
57
|
+
| Choose | When you want to… | What to look at |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| **PCA** | Explore the main directions of variation across your features | Explained variance shows how much variation the first three components retain |
|
|
60
|
+
| **t-SNE** | Explore which rows have similar feature values locally | Nearby points can suggest neighborhoods to investigate; global distances and cluster sizes need care |
|
|
61
|
+
|
|
62
|
+
**Try toggling Standardize features**, especially when your columns use different units. It scales features to equal sample variance so their original measurement scales don't dominate the analysis.
|
|
63
|
+
|
|
64
|
+
PCA's two objective options produce the same point positions; they let you emphasize explained variance or reconstruction error. For t-SNE, changing perplexity lets you explore different neighborhood scales.
|
|
65
|
+
|
|
66
|
+
These views help you ask questions about your data. A visible group alone doesn't establish a meaningful category, and a 3D projection can leave information out. Cloud density and particle size change the appearance, not the analysis.
|
|
67
|
+
|
|
68
|
+
<details>
|
|
69
|
+
<summary><strong>More about sampling and projection metrics</strong></summary>
|
|
70
|
+
|
|
71
|
+
- CSVs with more than 2,500 valid rows are evenly sampled before analysis.
|
|
72
|
+
- t-SNE uses at most 500 rows, runs for 500 iterations, and uses a fixed seed. Identical inputs and settings give reproducible results; a fixed iteration count does not guarantee convergence.
|
|
73
|
+
- t-SNE's KL divergence is not comparable to PCA's explained variance or reconstruction error, and should not be compared directly across different datasets or perplexities.
|
|
74
|
+
- With two numeric features, PCA produces a flat projection. Constant data produces a validation message.
|
|
75
|
+
- The sample is synthetic atmospheric data. The cloud is an artistic rendering, not a weather simulation.
|
|
76
|
+
|
|
77
|
+
See [Projection methods](docs/PROJECTIONS.md) for the mathematics, implementation details, and interpretation limits.
|
|
78
|
+
|
|
79
|
+
</details>
|
|
80
|
+
|
|
81
|
+
## Your data stays with you ⋆。˚ ☁︎ ˚。⋆
|
|
82
|
+
|
|
83
|
+
CSV parsing and projection calculations happen on your device. The app does not upload your dataset.
|
|
84
|
+
|
|
85
|
+
The page loads fonts from Google Fonts, with system-font fallbacks. If you use the Kaggle importer, your browser also contacts Kaggle and its download host. Each import requests the current file; datasets aren't refreshed in the background.
|
|
86
|
+
|
|
87
|
+
**[Find the shape in your data →](https://archipelagoing.github.io/PCACloud/)** ⋆。˚ ☁︎ ˚。⋆
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## For contributors ⋆。˚ ☁︎ ˚。⋆
|
|
92
|
+
|
|
93
|
+
Built with vanilla JavaScript and Canvas 2D, packaged as a reusable Jekyll theme. The app has no JavaScript runtime package dependencies. See the [roadmap](docs/todo.md) for fixes, release checks, and ideas for future features.
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary><strong>Project structure</strong></summary>
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
PCACloud/
|
|
100
|
+
├── index.html # Home page front matter
|
|
101
|
+
├── _config.yml # Site URLs, branding, and intro text
|
|
102
|
+
├── _layouts/ # default, home, page, and post layouts
|
|
103
|
+
├── _includes/ # Head, header, footer, studio, and learning drawer
|
|
104
|
+
├── assets/ # JavaScript modules, stylesheet, image, and favicon
|
|
105
|
+
├── tests/ # Automated projection and importer tests
|
|
106
|
+
├── docs/ # Projection guide, roadmap, and screenshot
|
|
107
|
+
├── Gemfile # Jekyll development dependencies
|
|
108
|
+
├── jekyll-theme-pca-cloud.gemspec
|
|
109
|
+
└── .github/ # Jekyll GitHub Pages deployment workflow
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
<details>
|
|
115
|
+
<summary><strong>Run locally, test, and deploy</strong></summary>
|
|
116
|
+
|
|
117
|
+
### Run locally
|
|
118
|
+
|
|
119
|
+
With Ruby 3.1 or newer, Bundler, and Node.js/npm installed:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
bundle install
|
|
123
|
+
npm start
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Open [localhost:5173](http://localhost:5173). Jekyll renders the layouts and Liquid templates. `npm start` serves at the domain root for local development. Run `npm run build` to generate `_site/` using the configured `/PCACloud` base path. Any static web server can serve the generated `_site/` directory.
|
|
127
|
+
|
|
128
|
+
### Run tests
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
npm test
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Tests use Node's built-in test runner and cover PCA variance, component orthogonality, scale invariance, reconstruction error, CSV parsing and validation, mocked Kaggle responses, and t-SNE affinities, gradients, and reproducibility.
|
|
135
|
+
|
|
136
|
+
### Deploy to GitHub Pages
|
|
137
|
+
|
|
138
|
+
In [repository Settings → Pages](https://github.com/archipelagoing/PCACloud/settings/pages), select **GitHub Actions** as the deployment source.
|
|
139
|
+
|
|
140
|
+
The included [workflow](.github/workflows/pages.yml) runs tests, builds Jekyll, and publishes `_site/` on every push to `main`. You can also start it manually from the repository's **Actions** tab. Jekyll’s `relative_url` filter supports the `/PCACloud/` project path. Set `url` and `baseurl` in `_config.yml` for your own domain or repository (`baseurl: ""` for a domain root).
|
|
141
|
+
|
|
142
|
+
</details>
|
|
143
|
+
|
|
144
|
+
## Use as a Jekyll theme
|
|
145
|
+
|
|
146
|
+
The theme follows [Jekyll’s theme structure](https://jekyllrb.com/docs/themes/) and can be used from a checkout, as a gem, or as a remote theme.
|
|
147
|
+
|
|
148
|
+
To use this checkout directly, run the local commands above. Edit `_config.yml` to change branding, the header/footer notes, and the home page introduction. `headline` and `intro` accept HTML; other text settings are escaped. Per-page `headline`, `intro`, and `eyebrow` override the site settings. Keep the studio’s element IDs when customizing its HTML because the interactive app uses them.
|
|
149
|
+
|
|
150
|
+
To use it in another Jekyll site without publishing a gem, add this to that site’s Gemfile:
|
|
151
|
+
|
|
152
|
+
```ruby
|
|
153
|
+
gem "jekyll", "~> 4.4"
|
|
154
|
+
gem "jekyll-theme-pca-cloud", git: "https://github.com/archipelagoing/PCACloud", branch: "main"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
After these changes are pushed to that branch, run `bundle install` and set:
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
theme: jekyll-theme-pca-cloud
|
|
161
|
+
title: PCA Cloud
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Alternatively, add `gem "jekyll-remote-theme"` to the consuming site’s Gemfile and configure:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
remote_theme: archipelagoing/PCACloud
|
|
168
|
+
plugins:
|
|
169
|
+
- jekyll-remote-theme
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Remote theme usage also requires these files to be pushed first. When using either method, create your own `index.html`:
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
---
|
|
176
|
+
layout: home
|
|
177
|
+
title: Find the shape in your data
|
|
178
|
+
---
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Use `layout: page` for ordinary Markdown pages and `layout: post` for dated posts. Those layouts share the sky colors and glass cards; the interactive studio loads on `layout: home` pages. Theme installation supplies layouts and assets, so the consuming site provides its own content and `_config.yml`. Copy a file into your own `_includes/` or `_layouts/` directory to override it.
|
|
182
|
+
|
|
183
|
+
To package the theme locally:
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
gem build jekyll-theme-pca-cloud.gemspec
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
This creates `jekyll-theme-pca-cloud-0.1.0.gem`; publishing it to RubyGems is a separate step.
|
|
190
|
+
|
|
191
|
+
Licensed under [Apache License 2.0](LICENSE).
|
|
192
|
+
|
|
193
|
+
For Tyler.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<footer><span>{{ site.footer_note | default: "A different way to see the bigger picture." | escape }}</span>{% if page.layout == "home" %}<button id="about">How it works <span>↗</span></button>{% endif %}<span class="coordinates">PC1 / PC2 / PC3</span></footer>
|
data/_includes/head.html
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<meta charset="UTF-8">
|
|
2
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3
|
+
<meta name="theme-color" content="{{ site.theme_color | default: '#6395b8' | escape }}">
|
|
4
|
+
<title>{{ page.title | default: site.title | default: 'PCA Cloud' | escape }}{% if page.title and site.title %} — {{ site.title | escape }}{% endif %}</title>
|
|
5
|
+
<meta name="description" content="{{ page.description | default: site.description | default: 'Find the shape in your data.' | escape }}">
|
|
6
|
+
<link rel="icon" type="image/png" href="{{ '/assets/cloud.png' | relative_url }}">
|
|
7
|
+
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<header>
|
|
2
|
+
<a class="brand" href="{{ "/" | relative_url }}" aria-label="{{ site.title | default: 'PCA Cloud' | escape }} home"><svg viewBox="0 0 40 28" fill="none"><path d="M10 24a8 8 0 0 1-1-16 11 11 0 0 1 21 2 7 7 0 0 1 0 14Z" stroke="currentColor" stroke-width="1.7"/><path d="M13 17h14M17 12v10M23 14v8" stroke="currentColor" stroke-width="1.3"/></svg>{{ site.brand_primary | default: "PCA" | escape }}<span>{{ site.brand_secondary | default: "Cloud" | escape }}</span></a>
|
|
3
|
+
<div class="header-note"><span class="live-dot"></span>{{ site.header_note | default: "A little perspective changes everything." | escape }}</div>
|
|
4
|
+
{% if page.layout == "home" %}<button id="export" class="glass-button">Save image <span>↗</span></button>{% endif %}
|
|
5
|
+
</header>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<dialog id="about-dialog"><button id="close-about" aria-label="Close explanation">×</button><div class="eyebrow">FROM NUMBERS TO NEBULOUS</div><h2>Your data has a shape.</h2><p>Principal component analysis (PCA) finds the directions in which your data varies most. We center your numeric columns, optionally scale them to equal variance, and project each row onto the first three principal components.</p><p>Each row becomes a soft particle in the cloud. Switch to <strong>Data points</strong> to see the exact projected positions. Density and particle size change the rendering, not the PCA results.</p><p>The explained variance tells you how much of the original variation these three dimensions preserve. Non-numeric columns are excluded; rows with missing numeric values are skipped. Large datasets are evenly sampled to 2,500 rows before PCA.</p><p class="dialog-note">The sample is synthetic atmospheric data, created to demonstrate correlated measurements. The cloud is an artistic rendering, not a weather simulation.</p></dialog>
|
|
2
|
+
<nav class="workspace-tabs" aria-label="Workspace">
|
|
3
|
+
<button id="studio-tab" class="workspace-tab active" aria-controls="studio-panel" aria-pressed="true">Studio</button>
|
|
4
|
+
<button id="learn" class="workspace-tab" aria-controls="learn-drawer" aria-expanded="false">Learn PCA</button>
|
|
5
|
+
</nav>
|
|
6
|
+
<aside id="learn-drawer" class="learn-drawer" aria-labelledby="learn-title" inert>
|
|
7
|
+
<div class="drawer-content">
|
|
8
|
+
<button id="close-learn" class="close-dialog" aria-label="Return to Cloud studio">×</button>
|
|
9
|
+
<div class="eyebrow">LOOK INSIDE THE CLOUD</div>
|
|
10
|
+
<h2 id="learn-title">Learn with your cloud.</h2>
|
|
11
|
+
<p id="learn-dataset" class="learn-subtitle"></p>
|
|
12
|
+
<div class="learning-topics" role="tablist" aria-label="PCA learning topics">
|
|
13
|
+
<button id="topic-variance" role="tab" aria-selected="true" aria-controls="learning-variance" tabindex="0">Variance</button>
|
|
14
|
+
<button id="topic-loadings" role="tab" aria-selected="false" aria-controls="learning-loadings" tabindex="-1">Loadings</button>
|
|
15
|
+
<button id="topic-walkthrough" role="tab" aria-selected="false" aria-controls="learning-walkthrough" tabindex="-1">Walkthrough</button>
|
|
16
|
+
</div>
|
|
17
|
+
<p id="learning-scene-hint" class="math-insight" role="status"></p>
|
|
18
|
+
<section id="learning-variance" class="learn-section" role="tabpanel" aria-labelledby="topic-variance">
|
|
19
|
+
<h3>How much survives in three dimensions?</h3>
|
|
20
|
+
<p>Each bar is a component’s share of total variance. The line adds those shares together. The first three bars are the dimensions of your cloud.</p>
|
|
21
|
+
<div id="scree-chart"></div>
|
|
22
|
+
<p class="chart-key"><span>▥ Individual variance</span><span>― Cumulative variance</span><span>┄ 90% / 95%</span></p>
|
|
23
|
+
<p id="scree-summary" class="math-insight"></p>
|
|
24
|
+
<details><summary>The math behind the plot</summary><p class="math-formula">EVRⱼ = λⱼ / Σ λℓ</p><p>λⱼ is the variance along component j, ordered from largest to smallest. Retained variance is the sum of the retained components’ ratios.</p><p class="math-formula">Z = X̃Vₖ · X̂ = ZVₖᵀ<br>‖X̃ − X̂‖² / ‖X̃‖² = 1 − Σⱼ₌₁ᵏ EVRⱼ</p><p>X̃ is centered data, optionally standardized. Vₖ contains k orthonormal component directions. PCA maximizes retained variance and minimizes squared reconstruction error with the same projection. Error is measured in the preprocessed space.</p></details>
|
|
25
|
+
</section>
|
|
26
|
+
<section id="learning-loadings" class="learn-section" role="tabpanel" aria-labelledby="topic-loadings" hidden>
|
|
27
|
+
<h3>Which measurements shape the cloud?</h3>
|
|
28
|
+
<label class="projection-label" for="loading-component">Principal component</label>
|
|
29
|
+
<select id="loading-component" class="projection-select"></select>
|
|
30
|
+
<p>Loadings are the weights used to combine your features. The three largest absolute weights are highlighted; positive and negative weights point in opposite directions.</p>
|
|
31
|
+
<div id="loading-chart"></div>
|
|
32
|
+
<p class="math-formula">zᵢⱼ = Σℓ x̃ᵢℓ vℓⱼ</p>
|
|
33
|
+
<p>A point’s component coordinate is a weighted sum of its centered, optionally standardized measurements. Flipping all weights and scores for a component mirrors the axis without changing the PCA solution. These weights describe the projection, not causal importance.</p>
|
|
34
|
+
</section>
|
|
35
|
+
<section id="learning-walkthrough" class="learn-section" role="tabpanel" aria-labelledby="topic-walkthrough" hidden>
|
|
36
|
+
<h3>Try it with four points.</h3>
|
|
37
|
+
<p>From Assignment 2, Part 1.1: A = (1, 3), B = (3, 1), C = (5, 3), D = (7, 5). Change the units of the second feature and watch PC1 rotate.</p>
|
|
38
|
+
<label class="slider-label" for="lesson-scale">Multiply feature x₂ <output id="lesson-scale-value">×1</output></label>
|
|
39
|
+
<input id="lesson-scale" type="range" min="1" max="10" value="1" step="1">
|
|
40
|
+
<label class="lesson-toggle"><input id="lesson-standardize" type="checkbox"> Standardize this example</label>
|
|
41
|
+
<nav id="lesson-steps" class="lesson-steps" aria-label="Walkthrough steps"></nav>
|
|
42
|
+
<div class="step-navigation"><button id="lesson-previous">← Previous</button><span id="lesson-progress"></span><button id="lesson-next">Next →</button></div>
|
|
43
|
+
<label class="projection-label" for="lesson-point">Inspect a point · or click it in the sky</label>
|
|
44
|
+
<select id="lesson-point" class="projection-select"><option value="0">A</option><option value="1">B</option><option value="2">C</option><option value="3" selected>D</option></select>
|
|
45
|
+
<details><summary>See the flat projection</summary><div id="lesson-chart"></div></details>
|
|
46
|
+
<p class="chart-key">● Centered points ○ Reconstructed from PC1 ― PC1 ┄ Discarded distance</p>
|
|
47
|
+
<div id="lesson-calculation" aria-live="polite"></div>
|
|
48
|
+
<p class="math-insight">PCA follows variance, so changing units can change its answer. Standardizing removes that dependence on units. It is a modeling choice: shared scales and meaningful low variance may justify leaving it off.</p>
|
|
49
|
+
<details><summary>Why the covariance convention matters</summary><p>This lesson uses population covariance and population standard deviations, dividing by n = 4, to match the assignment. The main cloud uses sample covariance and sample standard deviations, dividing by n − 1. With consistent preprocessing, component directions and explained-variance ratios agree; eigenvalues and standardized scores depend on the convention.</p><p>For numerical stability, unstandardized cloud inputs are also divided by one shared scale. This preserves directions and variance ratios. Display coordinates are uniformly resized to fit the scene; the lesson reports its own calculation units.</p></details>
|
|
50
|
+
|
|
51
|
+
</section>
|
|
52
|
+
<p class="dialog-note">Variance measures information retained in this representation. It does not guarantee that groups or classes remain distinguishable. Soft particles and cloud density are visual effects, not statistical density estimates.</p>
|
|
53
|
+
</div>
|
|
54
|
+
</aside>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<main>
|
|
2
|
+
<section class="intro"><div class="eyebrow">{{ page.eyebrow | default: site.eyebrow | default: "DATA, WITH ROOM TO BREATHE" | escape }}</div><h1>{{ page.headline | default: site.headline | default: "Find the shape<br>in your data." }}</h1><p>{{ page.intro | default: site.intro | default: "Many dimensions. One sky.<br>Explore your data through principal component analysis." }}</p></section>
|
|
3
|
+
<aside id="studio-panel" class="panel" aria-label="Cloud controls">
|
|
4
|
+
<div class="panel-heading"><span>Cloud studio</span><span class="pill">LOCAL & PRIVATE</span></div>
|
|
5
|
+
<section class="control-section">
|
|
6
|
+
<div class="section-label"><span>01 / YOUR DATA</span><button id="sample" class="text-button">Use sample ↗</button></div>
|
|
7
|
+
<label class="upload" id="dropzone" for="file"><svg width="25" height="25" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M12 16V3m-5 5 5-5 5 5M4 15v5h16v-5"/></svg><strong>Bring your own data</strong><span>Drop a CSV here or <u>browse files</u></span><small>Numeric columns · up to 5 MB</small></label>
|
|
8
|
+
<input type="file" id="file" accept=".csv,text/csv" hidden>
|
|
9
|
+
<details class="kaggle-import">
|
|
10
|
+
<summary>Import from Kaggle <span>↗</span></summary>
|
|
11
|
+
<form id="kaggle-form">
|
|
12
|
+
<label for="kaggle-url">Public dataset link</label>
|
|
13
|
+
<input id="kaggle-url" type="text" placeholder="kaggle.com/datasets/owner/name" required>
|
|
14
|
+
<div class="kaggle-actions"><button type="submit" id="kaggle-find">Find CSVs</button><button type="button" id="kaggle-demo">Try Iris dataset</button></div>
|
|
15
|
+
</form>
|
|
16
|
+
<div id="kaggle-files" hidden><label for="kaggle-file">CSV file · up to 5 MB</label><select id="kaggle-file"></select><button type="button" id="kaggle-load">Visualize dataset</button></div>
|
|
17
|
+
<p id="kaggle-status" role="status" aria-live="polite">Load public CSVs directly from Kaggle. No API key needed.</p>
|
|
18
|
+
<a id="kaggle-source" hidden target="_blank" rel="noopener noreferrer">View source on Kaggle ↗</a>
|
|
19
|
+
</details>
|
|
20
|
+
<div class="dataset"><span class="file-icon">▤</span><div><strong id="dataset-name">Atmospheric observations</strong><small id="dataset-info">Preparing your sky…</small></div><span class="loaded-dot"></span></div>
|
|
21
|
+
<p id="message" role="status" aria-live="polite"></p>
|
|
22
|
+
</section>
|
|
23
|
+
<section class="control-section">
|
|
24
|
+
<div class="section-label"><span>02 / PROJECTION</span><span class="tiny">3 components</span></div>
|
|
25
|
+
<label class="projection-label" for="projection-method">Method</label>
|
|
26
|
+
<select id="projection-method" class="projection-select"><option value="pca">PCA · linear projection</option><option value="tsne">t-SNE · local neighborhoods</option></select>
|
|
27
|
+
<div id="pca-options"><label class="projection-label" for="pca-objective">PCA objective</label><select id="pca-objective" class="projection-select"><option value="variance">Maximize variance</option><option value="reconstruction">Minimize reconstruction error</option></select><p class="projection-note">Both objectives give the same PCA projection. Choose which metric to emphasize.</p></div>
|
|
28
|
+
<div id="tsne-options" hidden><label class="projection-label" for="perplexity">Perplexity</label><input id="perplexity" class="projection-select" type="number" min="1" max="50" value="30" step="1"><p class="projection-note">Balances smaller and larger neighborhoods. Uses up to 500 evenly sampled rows and a fixed seed.</p><button id="rerun-tsne" class="text-button">Run again ↻</button></div>
|
|
29
|
+
<label class="toggle-row" for="standardize"><span>Standardize features<small>Scale nonconstant features to unit variance</small></span><input type="checkbox" id="standardize" checked><span class="switch"></span></label>
|
|
30
|
+
<div id="pca-metrics">
|
|
31
|
+
<div class="variance-title"><span>Explained variance</span><strong id="total-variance">—</strong></div>
|
|
32
|
+
<div class="variance-bar" aria-label="Explained variance by component"><i id="bar-0"></i><i id="bar-1"></i><i id="bar-2"></i></div>
|
|
33
|
+
<div class="variance-legend"><span><i></i>PC1 <b id="pc-0">—</b></span><span><i></i>PC2 <b id="pc-1">—</b></span><span><i></i>PC3 <b id="pc-2">—</b></span></div>
|
|
34
|
+
<div id="reconstruction-metric" hidden><div class="variance-title"><span>Relative squared error</span><strong id="reconstruction-value">—</strong></div><p class="projection-note">Fraction of centered data energy lost in 3D; lower is better. Measured after optional standardization.</p></div>
|
|
35
|
+
</div>
|
|
36
|
+
<div id="tsne-metrics" hidden><div class="variance-title"><span>KL divergence</span><strong id="tsne-kl">—</strong></div><p class="projection-note">Preserves local similarities, not global distances or variance. Axes have no feature meaning.</p></div>
|
|
37
|
+
<p id="projection-status" class="projection-note" role="status" aria-live="polite"></p>
|
|
38
|
+
</section>
|
|
39
|
+
<section class="control-section appearance">
|
|
40
|
+
<div class="section-label"><span>03 / ATMOSPHERE</span><span>☼</span></div>
|
|
41
|
+
<div class="segmented" aria-label="Render mode"><button id="cloud-mode" class="active" aria-pressed="true">Cloud</button><button id="point-mode" aria-pressed="false">Data points</button></div>
|
|
42
|
+
<label class="slider-label" for="density">Cloud density<output id="density-value">65%</output></label><input id="density" type="range" min="10" max="100" value="65">
|
|
43
|
+
<label class="slider-label" for="softness">Particle size<output id="softness-value">50%</output></label><input id="softness" type="range" min="10" max="100" value="50">
|
|
44
|
+
<div class="motion-row"><label for="rotate"><input id="rotate" type="checkbox" checked>Slow rotation</label><button id="reset" class="text-button">Reset view ↺</button></div>
|
|
45
|
+
</section>
|
|
46
|
+
<div class="panel-footer"><span>⌁</span> Your data stays in your browser.</div>
|
|
47
|
+
</aside>
|
|
48
|
+
<div class="cloud-caption"><span class="caption-line"></span><span>EVERY POINT, A PART OF THE PICTURE</span></div>
|
|
49
|
+
<div class="view-tools"><button id="zoom-out" aria-label="Zoom out">−</button><span id="zoom-value">100%</span><button id="zoom-in" aria-label="Zoom in">+</button></div>
|
|
50
|
+
<div class="interaction-hint"><span>↔</span> Drag to orbit <i>·</i> Scroll to explore</div>
|
|
51
|
+
</main>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="{{ site.lang | default: 'en' | escape }}">
|
|
3
|
+
<head>
|
|
4
|
+
{% include head.html %}
|
|
5
|
+
</head>
|
|
6
|
+
<body{% unless page.layout == 'home' %} class="content-page"{% endunless %}>
|
|
7
|
+
{% if page.layout == 'home' %}
|
|
8
|
+
<canvas id="sky" aria-label="Interactive three-dimensional PCA cloud. Drag to rotate and scroll to zoom."></canvas>
|
|
9
|
+
{% endif %}
|
|
10
|
+
{% include header.html %}
|
|
11
|
+
{{ content }}
|
|
12
|
+
{% include footer.html %}
|
|
13
|
+
{% if page.layout == 'home' %}
|
|
14
|
+
{% include learning.html %}
|
|
15
|
+
<script type="module" src="{{ '/assets/js/app.js' | relative_url }}"></script>
|
|
16
|
+
{% endif %}
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
data/_layouts/home.html
ADDED
data/_layouts/page.html
ADDED
data/_layouts/post.html
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
---
|
|
4
|
+
<main class="content-shell">
|
|
5
|
+
<article class="content-card">
|
|
6
|
+
<h1>{{ page.title | escape }}</h1>
|
|
7
|
+
<p class="post-meta"><time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: '%B %-d, %Y' }}</time>{% if page.author %} · {{ page.author | escape }}{% endif %}</p>
|
|
8
|
+
{{ content }}
|
|
9
|
+
</article>
|
|
10
|
+
</main>
|
data/assets/cloud.png
ADDED
|
Binary file
|