The ModelBuilder class

Objects of this class act as Model factories

Initialization and methods

class clusterx.model.ModelBuilder(*args, **kwargs)

Model class

Objects of this class represent a cluster expansion model.

Parameters:

basis: string (Default: "trigonometric")

Basis set used to calculate the matrix of cluster correlations. For a detailed description and possible values of this parameter, look at the documentation for parameter basis in CorrelationsCalculator

selector_type: string

Cluster selector type. For the possible values, look at the documentation for the parameter selector_type in the ClustersSelector class.

selector_opts: dictionary

Cluster selector options. For the possible values, look at the documentation for the parameter selector_opts in the ClustersSelector class.

estimator_type: string

Estimator type. For the possible values, look at the documentation for the parameter estimator_type in the EstimatorFactory class.

estimator_opts: dictionary

Estimator options. For the possible values, look at the documentation for the parameter estimator_opts in the EstimatorFactory class.

filepath: string (default: None)

If not None, it must be the path to a pickle file generated with ModelBuilder.serialize(). All other parameters are overriden

standardize: Boolean (defaut:False)

Whether to standardize the input. Uses StandardScaler of scikit-learn.

build(sset, cpool, prop, corrc=None, verbose=False)

Build optimal cluster expansion model

Acts as a Model factory.

Parameters:

sset: StructuresSet object

structures set used for model training.

cpool: ClustersPool object

clusters pool from which to select the best model using the method indicated in selector_type.

prop: String

Property name. Must be a valid name as stored in sset. The list of names can be obtained using sset.get_property_names().

corrc: CorrelationsCalculator object (default: None)

If not None, cpool and basis are overriden

get_estimator()

Return estimator object used to create the optimal model

get_initial_comat()

Return initial correlation matrix

Return the initial correlation matrix, i.e. the full correlation matrix before cluster selection is performed.

get_opt_cpool()

Return optimal clusters pool found in build.

When the build method is called, a ClustersSelector object is created to perform the cluster selection task. The selected clusters pool can be obtained by calling this function.

get_selector()

Return selector used in build.

When the build method is called, a ClustersSelector object is created to perform the cluster selection task. This selector can be obtained by calling this function.

serialize(filepath='MODELBDR.pickle')

Serialize model into pickle file

Only pickle format is supported.

Parameters:

filepath: string (default: “MODELBDR.pickle”)

file path of the pickle file to serialize the model builder object