avishart / CatLearn

A machine learning environment for atomic-scale modeling in surface science and catalysis.
http://catlearn.readthedocs.io/
GNU General Public License v3.0
1 stars 3 forks source link

DOC: Using inverse distances #3

Closed HaoZeke closed 2 months ago

HaoZeke commented 11 months ago

Hi @avishart.

I'm setting up the eon interface to the restructuring branch again, and I noticed that the default_model class:


def get_default_model(model='tp',prior='median',use_derivatives=True,use_fingerprint=False,parallel=False,**kwargs):
    """
    Get the default ML model from the simple given arguments.

    Parameters:
        model : str
            Either the tp that gives the Studen T process or gp that gives the Gaussian process.
        prior : str
            Specify what prior mean should be used.
        use_derivatives : bool
            Whether to use derivatives of the targets.
        use_fingerprint : bool
            Whether to use fingerprints for the features.
            This has to be the same as for the database!
        parallel : bool
            Whether to optimize the hyperparameters in parallel.

    Returns:
        model : Model
            The Machine Learning Model with kernel and prior that are optimized.
    """

Doesn't specify how to use the inverse distances. I was previously constructing the model by hand but that's rather error prone.

avishart commented 11 months ago

Hi @HaoZeke, The default_model function is for the Gaussian or Student T process construction itself.
You can use get_default_mlmodel and give the Inverse distance fingerprint as an argument. Like this:

from catlearn.regression.gaussianprocess.fingerprint.invdistances import Inv_distances
from catlearn.regression.gaussianprocess.calculator.mlcalc import MLCalculator
fp=Inv_distances(mic=False,sorting=False)
mlmodel=get_default_mlmodel(fp=fp)
mlcalc=MLCalculator(mlmodel=mlmodel)

Best regards, Andreas