crease_ga.Model

class crease_ga.Model(pop_number=5, generations=10, nloci=7, yaml_file='x')

The basic class that defines the model to be used to solve for a scattering profile.

See also

crease_ga.adaptaion_params.adaptation_params
Attributes:
pop_number: int.

Number of individuals within a generation.

generations: int.

Number of generations to run.

nloci: int.

Number of binary bits to represent each parameter in an individual. The decimal parameter value is converted to binary, with “all 0s” corresponding to the min value and “all 1s” corresponding to the max value. The larger the value, the finer the resultion for each parameter.

adaptation_params: crease_ga.adaptation_params.adaptation_params

Object of adaptation parameters used for this model.

load_shape(shape='vesicle', shape_params=None, minvalu=None, maxvalu=None)

Load a shape.

Parameters:
shape: str. name of the shape.

Currently supported builtin shapes are “vesicle” and “micelle”. Can also specify a shape developed in a crease_ga plugin.

shape_params: list.

Values of shape-specific descriptors. See the API of corresponding shape for details. If not specified, or an incorrect number of shape descriptor values are specified, the default values of the shape-specific descriptors will be loaded.

minvalu,maxvalu: list.

Values of the minimum and maximum boundaries of the parameters to be fit. If not specified, or an incorrect number of input parameter boundaries are specified, the default boundaries of the input parameters of the shape will be loaded.

solve(name='ga_job', verbose=True, backend='debye', fitness_metric='log_sse', output_dir='./', n_cores=1, converge=10, needs_postprocess=False)

Fit the loaded target I(q) for a set of input parameters that maximize the fitness or minimize the error metric (fitness_metric).

Parameters:
name: str.

Title of the current run. A folder of the name will be created under current working directory (output_dir), and all output files will be saved in that folder.

verbose: bool. Default=True.

If verbose is set to True, a figure will be produced at the end of each run, plotting the I(q) resulting from the best individual in the current generation and the target I(q).

Useful for pedagogical purpose on jupyter notebook.

fitness_metric: string. Default=’log_sse’.
The metric used to calculate fitness. Currently supported:

“log_sse”, sum of squared log10 difference at each q point.

output_dir: string. Default=”./”

Path to the working directory.

n_cores: int. Default=1

Number of cores to parallelize over

converge: int. Default=10

The generation countdown to stop optimization. If the minimum error does not improve after converge generations, the optimization ends.

needs_postprocess: bool. Default=False

Some CREASE versions require additional steps. Typically required for S(q) CREASE that outputs a 3D visualization.