Skip to content

Commit ba87938

Browse files
authored
Merge pull request #84 from WMD-group/doc_updates
Doc updates
2 parents 1698aed + 858d10f commit ba87938

13 files changed

Lines changed: 229 additions & 307 deletions

File tree

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# ElementEmbeddings
22

3-
43
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
54
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
65
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
@@ -143,21 +142,19 @@ The `composition_featuriser` function can be used to featurise the data. The com
143142
```python
144143
from elementembeddings.composition import composition_featuriser
145144

146-
df_featurised = composition_featuriser(df, embedding="magpie", stats="mean")
145+
df_featurised = composition_featuriser(df, embedding="magpie", stats=["mean","sum"])
147146

148147
df_featurised
149148
```
150149

151-
| formula | mean_Number | mean_MendeleevNumber | mean_AtomicWeight | mean_MeltingT | ... | mean_SpaceGroupNumber |
152-
|---------|-------------|----------------------|--------------------|-------------------|-----|-----------------------|
153-
| CsPbI3 | 59.2 | 74.8 | 144.16377238 | 412.55 | ... | 129.20000000000002 |
154-
| Fe2O3 | 15.2 | 74.19999999999999 | 31.937640000000002 | 757.2800000000001 | ... | 98.80000000000001 |
155-
| NaCl | 14.0 | 48.0 | 29.221384640000004 | 271.235 | ... | 146.5 |
156-
| ZnS | 23.0 | 78.5 | 48.7225 | 540.52 | ... | 132.0 |
157-
158-
(The columns of the resulting dataframe have been truncated for clarity.)
150+
| formula | mean_Number | mean_MendeleevNumber | mean_AtomicWeight | mean_MeltingT | mean_Column | mean_Row | mean_CovalentRadius | mean_Electronegativity | mean_NsValence | mean_NpValence | mean_NdValence | mean_NfValence | mean_NValence | mean_NsUnfilled | mean_NpUnfilled | mean_NdUnfilled | mean_NfUnfilled | mean_NUnfilled | mean_GSvolume_pa | mean_GSbandgap | mean_GSmagmom | mean_SpaceGroupNumber | sum_Number | sum_MendeleevNumber | sum_AtomicWeight | sum_MeltingT | sum_Column | sum_Row | sum_CovalentRadius | sum_Electronegativity | sum_NsValence | sum_NpValence | sum_NdValence | sum_NfValence | sum_NValence | sum_NsUnfilled | sum_NpUnfilled | sum_NdUnfilled | sum_NfUnfilled | sum_NUnfilled | sum_GSvolume_pa | sum_GSbandgap | sum_GSmagmom | sum_SpaceGroupNumber |
151+
|---------|-------------|----------------------|--------------------|-------------------|-------------|----------|---------------------|------------------------|----------------|----------------|--------------------|--------------------|---------------|-----------------|-----------------|-----------------|-----------------|----------------|------------------|----------------|--------------------|-----------------------|------------|---------------------|-------------------|--------------|------------|---------|--------------------|-----------------------|---------------|---------------|---------------|---------------|--------------|----------------|----------------|----------------|----------------|---------------|--------------------|---------------|--------------|----------------------|
152+
| CsPbI3 | 59.2 | 74.8 | 144.16377238 | 412.55 | 13.2 | 5.4 | 161.39999999999998 | 2.22 | 1.8 | 3.4 | 8.0 | 2.8000000000000003 | 16.0 | 0.2 | 1.4 | 0.0 | 0.0 | 1.6 | 54.584 | 0.6372 | 0.0 | 129.20000000000002 | 296.0 | 374.0 | 720.8188619 | 2062.75 | 66.0 | 27.0 | 807.0 | 11.100000000000001 | 9.0 | 17.0 | 40.0 | 14.0 | 80.0 | 1.0 | 7.0 | 0.0 | 0.0 | 8.0 | 272.92 | 3.186 | 0.0 | 646.0 |
153+
| Fe2O3 | 15.2 | 74.19999999999999 | 31.937640000000002 | 757.2800000000001 | 12.8 | 2.8 | 92.4 | 2.7960000000000003 | 2.0 | 2.4 | 2.4000000000000004 | 0.0 | 6.8 | 0.0 | 1.2 | 1.6 | 0.0 | 2.8 | 9.755 | 0.0 | 0.8442651200000001 | 98.80000000000001 | 76.0 | 371.0 | 159.6882 | 3786.4 | 64.0 | 14.0 | 462.0 | 13.98 | 10.0 | 12.0 | 12.0 | 0.0 | 34.0 | 0.0 | 6.0 | 8.0 | 0.0 | 14.0 | 48.775000000000006 | 0.0 | 4.2213256 | 494.0 |
154+
| NaCl | 14.0 | 48.0 | 29.221384640000004 | 271.235 | 9.0 | 3.0 | 134.0 | 2.045 | 1.5 | 2.5 | 0.0 | 0.0 | 4.0 | 0.5 | 0.5 | 0.0 | 0.0 | 1.0 | 26.87041666665 | 1.2465 | 0.0 | 146.5 | 28.0 | 96.0 | 58.44276928000001 | 542.47 | 18.0 | 6.0 | 268.0 | 4.09 | 3.0 | 5.0 | 0.0 | 0.0 | 8.0 | 1.0 | 1.0 | 0.0 | 0.0 | 2.0 | 53.7408333333 | 2.493 | 0.0 | 293.0 |
155+
| ZnS | 23.0 | 78.5 | 48.7225 | 540.52 | 14.0 | 3.5 | 113.5 | 2.115 | 2.0 | 2.0 | 5.0 | 0.0 | 9.0 | 0.0 | 1.0 | 0.0 | 0.0 | 1.0 | 19.8734375 | 1.101 | 0.0 | 132.0 | 46.0 | 157.0 | 97.445 | 1081.04 | 28.0 | 7.0 | 227.0 | 4.23 | 4.0 | 4.0 | 10.0 | 0.0 | 18.0 | 0.0 | 2.0 | 0.0 | 0.0 | 2.0 | 39.746875 | 2.202 | 0.0 | 264.0 |
159156

160-
The returned dataframe contains the mean-pooled features of the magpie representation for the four formulas.
157+
The returned dataframe contains the mean-pooled and sum-pooled features of the magpie representation for the four formulas.
161158

162159
## Development notes
163160

docs/about.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
[![GitHub issues](https://img.shields.io/github/issues-raw/WMD-Group/ElementEmbeddings)](https://github.com/WMD-group/ElementEmbeddings/issues)
88
[![CI Status](https://github.com/WMD-group/ElementEmbeddings/actions/workflows/ci.yml/badge.svg)](https://github.com/WMD-group/ElementEmbeddings/actions/workflows/ci.yml)
99
[![codecov](https://codecov.io/gh/WMD-group/ElementEmbeddings/branch/main/graph/badge.svg?token=OCMIM5SHL0)](https://codecov.io/gh/WMD-group/ElementEmbeddings)
10+
[![DOI](https://zenodo.org/badge/493285385.svg)](https://zenodo.org/badge/latestdoi/493285385)
11+
[![PyPI](https://img.shields.io/pypi/v/ElementEmbeddings)](https://pypi.org/project/ElementEmbeddings/)
12+
[![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)](https://wmd-group.github.io/ElementEmbeddings/)
13+
![python version](https://img.shields.io/pypi/pyversions/elementembeddings)
1014

11-
The **ElementEmbeddings** package provides high-level tools for analysing elemental
15+
The **Element Embeddings** package provides high-level tools for analysing elemental
1216
embeddings data. This primarily involves visualising the correlation between
1317
embedding schemes using different statistical measures.
1418

15-
Motivation
16-
--------
19+
* **Documentation:** <https://wmd-group.github.io/ElementEmbeddings/>
20+
* **Examples:** <https://github.com/WMD-group/ElementEmbeddings/tree/main/examples>
21+
22+
## Motivation
1723

1824
Machine learning approaches for materials informatics have become increasingly
1925
widespread. Some of these involve the use of deep learning
@@ -22,4 +28,4 @@ rather than specified by the user of the model. While an important goal of
2228
machine learning training is to minimise the chosen error function to make more
2329
accurate predictions, it is also important for us material scientists to be able
2430
to interpret these models. As such, we aim to evaluate and compare different atomic embedding
25-
schemes in a consistent framework.
31+
schemes in a consistent framework.

docs/contribution.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,63 @@
1-
## Bug reports, feature requests and questions
1+
# Contributing
22

3-
Please use the [Issue Tracker](https://github.com/WMD-group/ElementEmbeddings/issues) to report bugs or request features in the first instance. Contributions are always welcome.
3+
This is a quick guide on how to follow best practice and contribute smoothly to `ElementEmbeddings`.
44

55
## Code contributions
66

77
We are always looking for ways to make `ElementEmbeddings` better and a more useful to a wider community. For making contributions, use the ["Fork and Pull"](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) workflow to make contributions and stick as closely as possible to the following:
88

99
* Code style should comply with [PEP8](https://peps.python.org/pep-0008/) where possible. [Google's house style](https://google.github.io/styleguide/pyguide.html) is also helpful, including a good model for docstrings.
1010
* Please use comments liberally when adding nontrivial features, and take the chance to clean up other people's code while looking at it.
11-
* Add tests wherever possible, and use the test suite to check if you broke anything.
11+
* Add tests wherever possible, and use the test suite to check if you broke anything.
12+
13+
## Workflow
14+
15+
We follow the [GitHub flow]
16+
(<https://guides.github.com/introduction/flow/index.html>), using
17+
branches for new work and pull requests for verifying the work.
18+
19+
The steps for a new piece of work can be summarised as follows:
20+
21+
1. Push up or create [an issue](https://guides.github.com/features/issues).
22+
2. Create a branch from main, with a sensible name that relates to the issue.
23+
3. Do the work and commit changes to the branch. Push the branch
24+
regularly to GitHub to make sure no work is accidentally lost.
25+
4. Write or update unit tests for the code you work on.
26+
5. When you are finished with the work, ensure that all of the unit
27+
tests pass on your own machine.
28+
6. Open a pull request [on the pull request page](https://github.com/WMD-group/ElementEmbeddings/pulls).
29+
7. If nobody acknowledges your pull request promptly, feel free to poke one of the main developers into action.
30+
31+
## Pull requests
32+
33+
For a general overview of using pull requests on GitHub look [in the GitHub docs](https://help.github.com/en/articles/about-pull-requests).
34+
35+
When creating a pull request you should:
36+
37+
* Ensure that the title succinctly describes the changes so it is easy to read on the overview page
38+
* Reference the issue which the pull request is closing
39+
40+
Recommended reading: [How to Write the Perfect Pull Request](https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/)
41+
42+
## Dev requirements
43+
44+
When developing locally, it is recommended to install the python packages in `requirements-dev.txt`.
45+
46+
```bash
47+
pip install -r requirements-dev.txt
48+
```
49+
50+
This will allow you to run the tests locally with pytest as described in the main README,
51+
as well as run pre-commit hooks to automatically format python files with isort and black.
52+
To install the pre-commit hooks (only needs to be done once):
53+
54+
```bash
55+
pre-commit install
56+
pre-commit run --all-files # optionally run hooks on all files
57+
```
58+
59+
Pre-commit hooks will check all files when you commit changes, automatically fixing any files which are not formatted correctly. Those files will need to be staged again before re-attempting the commit.
60+
61+
## Bug reports, feature requests and questions
62+
63+
Please use the [Issue Tracker](https://github.com/WMD-group/ElementEmbeddings/issues) to report bugs or request features in the first instance. Contributions are always welcome.
162 KB
Loading

docs/images/magpie_umap.png

709 KB
Loading

docs/installation.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1+
# Getting Started
12

2-
The latest version of the package can be installed using:
3+
The latest stable release can be installed via pip using:
34

4-
```
5-
pip install git+git://github.com/WMD-group/ElementEmbeddings.git
5+
```bash
6+
pip install ElementEmbeddings
67
```
78

89
## Developer's installation (optional)
10+
911
For development work, `ElementEmbeddings` can eb installed from a copy of the [source repository](https://github.com/WMD-group/ElementEmbeddings.git); this is preferred if using experimental code branches.
1012

1113
To clone the project from Github and make a local installation:
1214

13-
```
15+
```bash
1416
git clone https://github.com/WMD-group/ElementEmbeddings.git
1517
cd ElementEmbeddings
1618
pip install -e .
1719
```
18-
With `-e`, pip will create links to the source folder so that the changes to the code will be reflected on the PATH.
20+
21+
With `-e`, pip will create links to the source folder so that the changes to the code will be reflected on the PATH.

docs/reference.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,39 @@
11
# Elemental Embeddings
22

3-
The data contained in this folder is a collection of various elemental representation/embedding schemes
3+
The data contained in this repository are a collection of various elemental representation/embedding schemes. We provide the literature source for these representations as well as the data source for which the files were obtained. A majority of these representations have been obtained from the following repositories:
4+
5+
* [lrcfmd/ElMD](https://github.com/lrcfmd/ElMD/tree/master)
6+
* [Kaaiian/CBFV](https://github.com/Kaaiian/CBFV/tree/master)
7+
8+
## Linear representations
9+
10+
For the linear/scalar representations, the `Embedding` class will load these representations as one-hot vectors where the vector components are ordered following the scale (i.e. the `atomic` representation is ordered by atomic numbers).
11+
12+
### Modified Pettifor scale
13+
14+
The following paper describes the details of the modified Pettifor chemical scale:
15+
[The optimal one-dimensional periodic table: a modified Pettifor chemical scale from data mining](https://iopscience.iop.org/article/10.1088/1367-2630/18/9/093011/meta)
16+
17+
[Data source](https://github.com/lrcfmd/ElMD/blob/master/ElMD/el_lookup/mod_petti.json)
18+
19+
### Atomic numbers
20+
21+
We included `atomic` as a linear representation to generate one-hot vectors corresponding to the atomic numbers
22+
23+
## Vector representations
24+
25+
The following representations are all vector representations (some are local, some are distributed) and the `Embedding` class will load these representations as they are.
26+
27+
### Magpie
428

5-
## Magpie
629
The following paper describes the details of the Materials Agnostic Platform for Informatics and Exploration (Magpie) framework:
730
[A general-purpose machine learning framework for predicting properties of inorganic materials](https://www.nature.com/articles/npjcompumats201628)
831

932
The source code for Magpie can be found
1033
[here](https://bitbucket.org/wolverton/magpie/src/master/)
1134

35+
[Data source](https://github.com/Kaaiian/CBFV/blob/master/cbfv/element_properties/magpie.csv)
36+
1237
The 22 dimensional embedding vector includes the following elemental properties:
1338

1439
<details>
@@ -32,30 +57,36 @@ The 22 dimensional embedding vector includes the following elemental properties:
3257
* Space Group Number
3358
</details>
3459

35-
* `magpie_sc` is scaled version of the magpie embeddings
60+
* `magpie_sc` is a scaled version of the magpie embeddings. [Data source](https://github.com/lrcfmd/ElMD/blob/master/ElMD/el_lookup/magpie_sc.json)
3661

37-
## mat2vec
62+
### mat2vec
3863

3964
The following paper describes the implementation of mat2vec:
4065
[Unsupervised word embeddings capture latent knowledge from materials science literature](https://www.nature.com/articles/s41586-019-1335-8)
4166

42-
## MatScholar
67+
[Data source](https://github.com/Kaaiian/CBFV/blob/master/cbfv/element_properties/mat2vec.csv)
68+
69+
### MatScholar
4370

4471
The following paper describes the natural language processing implementation of Materials Scholar (matscholar):
4572
[Named Entity Recognition and Normalization Applied to Large-Scale Information Extraction from the Materials Science Literature](https://pubs.acs.org/doi/abs/10.1021/acs.jcim.9b00470)
4673

47-
## MEGnet
74+
[Data source](https://github.com/lrcfmd/ElMD/blob/master/ElMD/el_lookup/matscholar.json)
75+
76+
### MEGnet
77+
4878
The following paper describes the details of the construction of the MatErials Graph Network (MEGNet):
4979
[Graph Networks as a Universal Machine Learning Framework for Molecules and Crystals](https://doi.org/10.1021/acs.chemmater.9b01294)
5080

51-
## Modified Pettifor scale
52-
The following paper describes the details of the modified Pettifor chemical scale:
53-
[The optimal one dimensional periodic table: a modified Pettifor chemical scale from data mining](https://iopscience.iop.org/article/10.1088/1367-2630/18/9/093011/meta)
81+
[Data source](https://github.com/lrcfmd/ElMD/blob/master/ElMD/el_lookup/megnet16.json)
82+
83+
### Oliynyk
5484

55-
## Oliynkyk
5685
The following paper describes the details:
5786
[High-Throughput Machine-Learning-Driven Synthesis of Full-Heusler Compounds](https://pubs.acs.org/doi/full/10.1021/acs.chemmater.6b02724)
5887

88+
[Data source](https://github.com/Kaaiian/CBFV/blob/master/cbfv/element_properties/oliynyk.csv)
89+
5990
The 44 features of the embedding vector are formed of the following properties:
6091
<details>
6192
<summary> Click to see the 44 features!</summary>
@@ -106,21 +137,24 @@ The 44 features of the embedding vector are formed of the following properties:
106137
* Cohesive_energy
107138
</details>
108139

109-
* `oliynyk_sc` is scaled version of the oliynyk embeddings
140+
* `oliynyk_sc` is a scaled version of the oliynyk embeddings: [Data source](https://github.com/lrcfmd/ElMD/blob/master/ElMD/el_lookup/oliynyk_sc.json)
110141

111-
## Random
142+
### Random
112143

113144
This is a set of 200-dimensional vectors in which the components are randomly generated
114145

115-
The 118 200-dimensional vectors in `random_200_new` was generated using the following code:
146+
The 118 200-dimensional vectors in `random_200_new` were generated using the following code:
116147

117148
```python
118149
import numpy as np
119150

120-
mu , sigma = 0 , 0.1 # mean and standard deviation s = np.random.normal(mu, sigma, 1000)
151+
mu , sigma = 0 , 1 # mean and standard deviation s = np.random.normal(mu, sigma, 1000)
121152
s = np.random.default_rng(seed=42).normal(mu, sigma, (118,200))
122153
```
123-
## SkipAtom
154+
155+
### SkipAtom
124156

125157
The following paper describes the details:
126158
[Distributed representations of atoms and materials for machine learning](https://www.nature.com/articles/s41524-022-00729-3)
159+
160+
[Data source](https://github.com/lantunes/skipatom/blob/main/data/skipatom_20201009_induced.csv)

0 commit comments

Comments
 (0)