ur-whitelab / exmol Goto Github PK
View Code? Open in Web Editor NEWExplainer for black box models that predict molecule properties
Home Page: https://ur-whitelab.github.io/exmol/
License: MIT License
Explainer for black box models that predict molecule properties
Home Page: https://ur-whitelab.github.io/exmol/
License: MIT License
Refactor out so we don't have code duplication with skunk
While messing around with CODEX, I noticed it wants to compute ECFP4 fingerprints using a different method and this gives slightly different similarities. @geemi725 could you double-check the ECFP4 implementation we have is correct, or is the CODEX one correct?
@hgandhi2411 you need to follow the style of the other figures in README file to get them to render on pypi homepage.
Can we override print method in Example
to print nicer?
Would like to exclude ECFP substructures with 1 or 2 atoms, since they are not that useful.
@geemi725 can you add a pypi and github (link to repo) badge to top of markdown? Thanks!
Maybe we should have too functions:
all_exps = cs.explore(...)
exps = cs.explain(all_exps)
cs.plot_space(exps, all_exps)
cs.plot_exp(exps)
On this line of sample_space()
, chirality information of origin_smiles
is removed. The output is then unsuitable as input to a chirality-aware ML model, e.g. to distinguish L vs. D amino acids which are important in models of binding affinity. Could the option to skip this sanitization step be provided to the user?
PS: Great code base and beautiful visualizations! We're finding it very useful in explaining our Gaussian Process models. The future of SAR โโ ML looks exciting.
num_samples
is counter-intuitive because it is multiplied by number of mutations. Should change it to be what is expected.
plot_cf()
function errors out with the following error. This behavior is also consistent across all notebooks in paper/
.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-b6c8ed26216e> in <module>
1 fkw = {"figsize": (8, 6)}
2 mpl.rc("axes", titlesize=12)
----> 3 exmol.plot_cf(exps, figure_kwargs=fkw, mol_size=(450, 400), nrows=1)
4
5 plt.savefig("rf-simple.png", dpi=180)
/gpfs/fs2/scratch/hgandhi/exmol/exmol/exmol.py in plot_cf(exps, fig, figure_kwargs, mol_size, mol_fontsize, nrows, ncols)
682 title += f"\nf(x) = {e.yhat:.3f}"
683 axs[i].set_title(title)
--> 684 axs[i].imshow(np.asarray(img), gid=f"rdkit-img-{i}")
685 axs[i].axis("off")
686 for j in range(i, C * R):
~/.local/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1359 def inner(ax, *args, data=None, **kwargs):
1360 if data is None:
-> 1361 return func(ax, *map(sanitize_sequence, args), **kwargs)
1362
1363 bound = new_sig.bind(ax, *args, **kwargs)
~/.local/lib/python3.7/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, **kwargs)
5607 resample=resample, **kwargs)
5608
-> 5609 im.set_data(X)
5610 im.set_alpha(alpha)
5611 if im.get_clip_path() is None:
~/.local/lib/python3.7/site-packages/matplotlib/image.py in set_data(self, A)
699 not np.can_cast(self._A.dtype, float, "same_kind")):
700 raise TypeError("Image data of dtype {} cannot be converted to "
--> 701 "float".format(self._A.dtype))
702
703 if self._A.ndim == 3 and self._A.shape[-1] == 1:
TypeError: Image data of dtype <U14622 cannot be converted to float
Need to actually use mypy
to check type annotations.
Hi,
im trying to replicate existing notebooks on solubility.
----> 2 N = len(data)
3 split = int(0.1 * N)
4 test_data = data.take(split).batch(config.batch_size)
5 nontest = data.skip(split)
TypeError: object of type 'DatasetV1Adapter' has no len()
Can you please let me know how to rectify or address.
Thank you in advance.
Hi,
First at all, thank you for your work!. I am obtaining a problem installing your library, o better say when I do "import exmol", I obtaing one error:"No module named 'dataclasses'".
I have installed as: pip install exmol...
Thanks!
Some of the counterfactuals use metals, ions, carbocations. We should have a "basic" alphabet that has no radicals/metals.
Instead of making rdkit-pypi
a dependency, we could give start-up message on import fail?
We must have broken something in API sphinx config because argument descriptions aren't cooperating with types. See here
per terms in STONED license
Sometimes I do not want lots of progress bars.
Original stoned code uses np.random.randint(a,b) which excludes b.
random.randint(a,b) includes b.
Working through some examples, I've noted the following things:
classic
and Classic
and ecfp
are valid.Make padding token be consistent with Selfies. Also [Nop] is invalid in SELFIES(?)
Are you planning to release 0.5.0 on pypi? I am maintaining the conda package of exmol and I would like to bump it to 0.5.0. See https://github.com/conda-forge/exmol-feedstock
Thanks!
Currently molecules are padded with zeroth token which is not necessarily ['nop'] token
Hi @geemi725 I modified the plotting code a little to enable composing the plots into more complex figures (rather than having it always create a new figure). This broke some of the paper plotting functions where colorbars are. Can you take a look? See CI log
Wrap model functions in lambda x,y: model(x)
if we detect it only takes 1 argument.
In the notebook RF-lime.ipynb, the command
exmol.lime_explain(space, descriptor_type=descriptor_type)
gives a error module 'exmol' has no attribute 'lime_explain'
Please, let me know how to fix this error. Thanks.
Many of the structures are still a bit unreasonable. Can we use ZINC query with tanimoto similarity to replace when valid CFs are essential?
If the starting molecule is not in pubchem, it just dies.
Use insert_svg
to generate new figs.
@geemi725 Can you fix the CI errors with paper job? Check the output on main.
The blood-brain barrier notebook calls the dataset "tox" frequently, which can be confusing. Should change name to be BBB
In your example provided in the code, the target molecule is on the edge of the sampled distribution (in the PCA plot). I also find this happens very frequently with my experiments on my model. I think this suggests that the sampling produces molecules that are not evenly distributed around the target. I just want to verify that this is a property of the STONED sampling algorithm, and not an artifact of the visualization code (which it does not seem to be). I've attached an example of my own, for both "narrow" and "medium" presets.
preset="narrow", nmols=10
preset="medium", nmols=10
Use same approach as maxent
Maybe take in label and model function and category of model (e.g., classification or regression)
e = cs.class_evaluator(model_fxn)
cs.explain(model_fxn, x, e)
Current RF-simple figure has unwanted white space.
Can we enable custom surrogate model features? Just add descriptors? Add docs on this too - @hgandhi2411 thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.