Skip to content

FCD

FCD model

FCDTransformer

Bases: PretrainedMolTransformer

FCD transformer based on the ChemNet pretrained model

Attributes:

Name Type Description
featurizer FCD

FCD featurizer object

dtype type

Data type. Use call instead

Source code in molfeat/trans/pretrained/fcd.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class FCDTransformer(PretrainedMolTransformer):
    r"""
    FCD transformer based on the ChemNet pretrained model

    Attributes:
        featurizer (FCD): FCD featurizer object
        dtype (type, optional): Data type. Use call instead
    """

    def __init__(self, n_jobs=1, dtype=np.float32, **params):
        super().__init__(dtype=dtype, **params)
        if not requires.check("fcd_torch"):
            raise ImportError(
                "`fcd_torch` is not available, please install it `conda install -c conda-forge fcd_torch'`"
            )

        self.n_jobs = n_jobs
        self.featurizer = FCD(n_jobs=n_jobs)

    def _embed(self, smiles, **kwargs):
        """Compute embedding"""
        return self.featurizer.get_predictions(smiles)

    def _update_params(self):
        super()._update_params()
        self.featurizer = FCD(n_jobs=self.n_jobs)