update versions

This commit is contained in:
franzi
2022-08-13 18:02:20 +02:00
parent dd5ced1028
commit 2ba3a610d5
11 changed files with 112 additions and 95 deletions

View File

@@ -223,15 +223,14 @@
"metadata": {},
"outputs": [],
"source": [
"# lambdas = eigenvalues\n",
"print(kpca.lambdas_[:10])\n",
"print(kpca.eigenvalues_[:10])\n",
"# check how much \"information\" we would keep if we were to reduce the dimensionality to 20\n",
"# (this is not 100% accurate, since we only computed the first 100 kPCA components, i.e.,\n",
"# normally lambda_ should contain all eigenvalues - but this should be close enough)\n",
"print(\"Percentage of variance retained with 20 components:\", 100*(sum(kpca.lambdas_[:20])/sum(kpca.lambdas_)))\n",
"# normally kpca.eigenvalues_ should contain all eigenvalues - but this should be close enough)\n",
"print(\"Percentage of variance retained with 20 components:\", 100*(sum(kpca.eigenvalues_[:20])/sum(kpca.eigenvalues_)))\n",
"# plot eigenvalue spectrum\n",
"plt.figure()\n",
"plt.plot(range(1, len(kpca.lambdas_)+1), kpca.lambdas_)\n",
"plt.plot(range(1, len(kpca.eigenvalues_)+1), kpca.eigenvalues_)\n",
"plt.xlabel(\"PCs\")\n",
"plt.ylabel(\"Eigenvalue\");\n",
"# observe how the first value is extremely large"
@@ -359,7 +358,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -373,7 +372,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.10.2"
}
},
"nbformat": 4,