Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xenonpy embeddings #141

Merged
merged 10 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added baseline/test_dimension_2d_plotter_pca.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baseline/test_dimension_2d_plotter_tsne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 83 additions & 10 deletions examples/composition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.159344600Z",
"start_time": "2024-04-10T13:43:19.758896800Z"
}
},
"outputs": [],
"source": [
"import pandas as pd\n",
Expand Down Expand Up @@ -31,7 +36,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.215488400Z",
"start_time": "2024-04-10T13:43:50.156342800Z"
}
},
"outputs": [],
"source": [
"CsPbI3_magpie = CompositionalEmbedding(formula=\"CsPbI3\", embedding=\"magpie\")"
Expand All @@ -51,7 +61,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.296525Z",
"start_time": "2024-04-10T13:43:50.202493200Z"
}
},
"outputs": [],
"source": [
"# Print the individual element feature vectors\n",
Expand All @@ -69,7 +84,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.299527900Z",
"start_time": "2024-04-10T13:43:50.231493Z"
}
},
"outputs": [],
"source": [
"# Print the composition and the fractional composition\n",
Expand All @@ -88,7 +108,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.318038500Z",
"start_time": "2024-04-10T13:43:50.248490700Z"
}
},
"outputs": [],
"source": [
"# Print the list of elements\n",
Expand Down Expand Up @@ -134,17 +159,42 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.321038700Z",
"start_time": "2024-04-10T13:43:50.259499Z"
}
},
"outputs": [],
"source": [
"# Print the mean feature vector\n",
"print(CsPbI3_magpie.feature_vector(stats=\"mean\"))"
]
},
{
"cell_type": "code",
"outputs": [],
"source": [
"print(CompositionalEmbedding(formula=\"NaCl\", embedding=\"magpie\").feature_vector())"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-04-10T14:00:36.864604100Z",
"start_time": "2024-04-10T14:00:36.792600400Z"
}
},
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.484568800Z",
"start_time": "2024-04-10T13:43:50.273490Z"
}
},
"outputs": [],
"source": [
"# Print the feature vector for the mean, variance, minpool, maxpool, and sum\n",
Expand All @@ -171,7 +221,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.511108300Z",
"start_time": "2024-04-10T13:43:50.292507700Z"
}
},
"outputs": [],
"source": [
"formulas = [\"CsPbI3\", \"Fe2O3\", \"NaCl\"]\n",
Expand All @@ -182,7 +237,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.640635200Z",
"start_time": "2024-04-10T13:43:50.336039400Z"
}
},
"outputs": [],
"source": [
"df = pd.DataFrame({\"formula\": formulas})\n",
Expand All @@ -196,10 +256,23 @@
"We can also calculate the \"distance\" between two compositions using their feature vectors. This can be used to determine which compositions are more similar to each other."
]
},
{
"cell_type": "code",
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-04-10T13:43:50.642632100Z",
"start_time": "2024-04-10T13:43:50.429571500Z"
}
},
"outputs": [],
"source": [
"print(\n",
Expand Down
2 changes: 2 additions & 0 deletions src/elementembeddings/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def load_data(embedding_name: Optional[str] = None):
| Random (200 dimensions) | random_200 |
| SkipAtom | skipatom |
| Atomic Number | atomic |
| Crystallm | crystallm |
| XenonPy | xenonpy |


Args:
Expand Down
4 changes: 4 additions & 0 deletions src/elementembeddings/data/element_representations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,7 @@ The following paper describes the details:
### CrystaLLM

The following paper describes the details behind the crystal structure generation model which uses large language modelling: [Crystal Structure Generation with Autoregressive Large Language Modeling](https://arxiv.org/abs/2307.04340)

### XenonPy

The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a complete URL for the XenonPy package to enhance the documentation.

- The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](.
+ The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](https://example.com/xenonpy).

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### XenonPy
The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](.
### XenonPy
The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](https://example.com/xenonpy).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the file ends with a newline character for consistency and to adhere to POSIX standards.

+ 

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](.
The XenonPy embedding uses the 58 features which are commonly used in publications that use the [XenonPy package](.

Loading
Loading