You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This workflow will upload a Python Package to PyPI when a release is created
2
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+
# This workflow uses actions that are not certified by GitHub.
5
+
# They are provided by a third-party and are governed by
6
+
# separate terms of service, privacy policy, and support
7
+
# documentation.
8
+
9
+
name: Upload Python Package
10
+
11
+
on:
12
+
release:
13
+
types: [published]
14
+
15
+
permissions:
16
+
contents: read
17
+
18
+
jobs:
19
+
release-build:
20
+
runs-on: ubuntu-latest
21
+
22
+
steps:
23
+
- uses: actions/checkout@v4
24
+
25
+
- uses: actions/setup-python@v5
26
+
with:
27
+
python-version: "3.12"
28
+
29
+
- name: Build release distributions
30
+
run: |
31
+
python -m pip install build
32
+
python -m build
33
+
34
+
- name: Upload distributions
35
+
uses: actions/upload-artifact@v4
36
+
with:
37
+
name: release-dists
38
+
path: dist/
39
+
40
+
pypi-publish:
41
+
runs-on: ubuntu-latest
42
+
needs:
43
+
- release-build
44
+
permissions:
45
+
# IMPORTANT: this permission is mandatory for trusted publishing
46
+
id-token: write
47
+
48
+
# Dedicated environments with protections for publishing are strongly recommended.
49
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
50
+
environment:
51
+
name: pypi
52
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
53
+
# url: https://pypi.org/p/YOURPROJECT
54
+
#
55
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
56
+
# ALTERNATIVE: exactly, uncomment the following line instead:
Here, confidence is the model's (self-reported) confidence in its prediction, calculated as
87
+
$$
88
+
\text{confidence}_c^{m_i} = 2|p_c^{m_i} - 0.5|
89
+
$$
90
+
For example, if a model makes a positive prediction with $p_c^{m_i} = 0.55$, the confidence is $2|0.55 - 0.5| = 0.1$.
91
+
One could say that the model is not very confident in its prediction and very close to switching to a negative prediction.
92
+
If another model is very sure about its negative prediction with $p_c^{m_j} = 0.1$, the confidence is $2|0.1 - 0.5| = 0.8$.
93
+
Therefore, if in doubt, we are more confident in the negative prediction.
94
+
95
+
Confidence can be disabled by the `use_confidence` parameter of the predict method (default: True).
96
+
97
+
The model_weight can be set for each model in the configuration file (default: 1). This is used to favor a certain
98
+
model independently of a given class.
99
+
Trust is based on the model's performance on a validation set. After training, we evaluate the Machine Learning models
100
+
on a validation set for each class. If the `ensemble_type` is set to `wmv-f1`, the trust is calculated as 1 + the F1 score.
101
+
If the `ensemble_type` is set to `mv` (the default), the trust is set to 1 for all models.
102
+
103
+
3. After a decision has been made for each class independently, the consistency of the predictions with regard to the ChEBI hierarchy
104
+
and disjointness axioms is checked. This is
105
+
done in 3 steps:
106
+
- (1) First, the hierarchy is corrected. For each pair of classes $A$ and $B$ where $A$ is a subclass of $B$ (following
107
+
the is-a relation in ChEBI), we set the ensemble prediction of $B$ to 1 if the prediction of $A$ is 1. Intuitively
108
+
speaking, if we have determined that a molecule belongs to a specific class (e.g., aromatic primary alcohol), it also
109
+
belongs to the direct and indirect superclasses (e.g., primary alcohol, aromatic alcohol, alcohol).
110
+
- (2) Next, we check for disjointness. This is not specified directly in ChEBI, but in an additional ChEBI module ([chebi-disjoints.owl](https://ftp.ebi.ac.uk/pub/databases/chebi/ontology/)).
111
+
We have extracted these disjointness axioms into a CSV file and added some more disjointness axioms ourselves (see
112
+
`data>disjoint_chebi.csv` and `data>disjoint_additional.csv`). If two classes $A$ and $B$ are disjoint and we predict
113
+
both, we select one of them randomly and set the other to 0.
114
+
- (3) Since the second step might have introduced new inconsistencies into the hierarchy, we repeat the first step, but
115
+
with a small change. For a pair of classes $A \subseteq B$ with predictions $1$ and $0$, instead of setting $B$ to $1$,
116
+
we now set $A$ to $0$. This has the advantage that we cannot introduce new disjointness-inconsistencies and don't have
@click.option('--smiles', '-s', multiple=True, help='SMILES strings to predict')
23
+
@click.option('--smiles-file', '-f', type=click.Path(exists=True), help='File containing SMILES strings (one per line)')
24
+
@click.option('--output', '-o', type=click.Path(), help='Output file to save predictions (optional)')
25
+
@click.option('--ensemble-type', '-e', type=click.Choice(ENSEMBLES.keys()), default='mv', help='Type of ensemble to use (default: Majority Voting)')
26
+
@click.option("--chebi-version", "-v", type=int, default=241, help="ChEBI version to use for checking consistency (default: 241)")
27
+
@click.option("--use-confidence", "-c", is_flag=True, default=True, help="Weight predictions based on how 'confident' a model is in its prediction (default: True)")
0 commit comments