|
43 | 43 | " table_from_dict,\n", |
44 | 44 | " check_mirrors,\n", |
45 | 45 | ")\n", |
46 | | - "from skcosmo.preprocessing import KernelFlexibleCenterer as KFC\n", |
| 46 | + "from skcosmo.preprocessing import KernelNormalizer as KFC\n", |
47 | 47 | "\n", |
48 | 48 | "cmaps = get_cmaps()\n", |
49 | 49 | "plt.style.use(\"../utilities/kernel_pcovr.mplstyle\")\n", |
|
682 | 682 | "plt.xlabel(\"n\")\n", |
683 | 683 | "plt.ylabel(r\"$v_n$\")\n", |
684 | 684 | "\n", |
685 | | - "np.linalg.norm(v_K[: v_C.shape[0]] - v_C)" |
| 685 | + "np.linalg.norm(v_K[: min(v_K.shape[0], v_C.shape[0])] - v_C[: min(v_K.shape[0], v_C.shape[0])])" |
686 | 686 | ] |
687 | 687 | }, |
688 | 688 | { |
|
1267 | 1267 | "source": [ |
1268 | 1268 | "## Download chemiscope from https://github.com/cosmo-epfl/chemiscope/\n", |
1269 | 1269 | "from chemiscope import write_input\n", |
1270 | | - "\n", |
1271 | | - "import ase\n", |
1272 | | - "from ase import io\n", |
1273 | 1270 | "import json" |
1274 | 1271 | ] |
1275 | 1272 | }, |
|
1279 | 1276 | "metadata": {}, |
1280 | 1277 | "outputs": [], |
1281 | 1278 | "source": [ |
1282 | | - "frames = ase.io.read(\"../datasets/CSD-1000R.xyz\", \":10\")\n", |
1283 | | - "\n", |
1284 | 1279 | "# We want to have prediction and projection for all the environments\n", |
1285 | 1280 | "lr = Ridge(alpha=best_regularization)\n", |
1286 | 1281 | "lr.fit(X_train, Y_train)\n", |
|
1295 | 1290 | ] |
1296 | 1291 | }, |
1297 | 1292 | { |
1298 | | - "cell_type": "code", |
1299 | | - "execution_count": null, |
| 1293 | + "cell_type": "markdown", |
1300 | 1294 | "metadata": {}, |
1301 | | - "outputs": [], |
1302 | 1295 | "source": [ |
| 1296 | + "``` python\n", |
| 1297 | + "\n", |
1303 | 1298 | "data = write_input(\n", |
1304 | 1299 | " # File to write \n", |
1305 | 1300 | " path=\"../CSD-1000R.json\",\n", |
1306 | | - " \n", |
| 1301 | + "\n", |
1307 | 1302 | " # Dataset name\n", |
1308 | 1303 | " meta={\"name\": \"CSD-1000R\"},\n", |
1309 | | - " \n", |
| 1304 | + "\n", |
1310 | 1305 | " # Structures in the dataset\n", |
1311 | | - " frames=frames,\n", |
1312 | | - " \n", |
| 1306 | + " frames=# corresponding ASE-type frames,\n", |
| 1307 | + "\n", |
1313 | 1308 | " # projection of the dataset, and properties predictions\n", |
1314 | 1309 | " properties={\n", |
1315 | 1310 | " **{f\"PCA_{i+1}\": {\"target\": \"atom\", \"values\": T[:, i]} for i in range(n_PC)},\n", |
|
1326 | 1321 | " \"values\": np.concatenate([frame.numbers for frame in frames])\n", |
1327 | 1322 | " },\n", |
1328 | 1323 | " },\n", |
1329 | | - " \n", |
| 1324 | + "\n", |
1330 | 1325 | " # This should be the same cutoff used to generate the features\n", |
1331 | 1326 | " cutoff=3.5,\n", |
1332 | | - ")" |
| 1327 | + ")\n", |
| 1328 | + "```" |
1333 | 1329 | ] |
1334 | 1330 | }, |
1335 | 1331 | { |
|
0 commit comments