autofit.ModelInstance#
- class autofit.ModelInstance(child_items: List | Dict | None = None, id_=None)[source]#
Bases:
AbstractModelAn instance of a Collection or Model. This is created by optimisers and correspond to a point in the parameter space.
@DynamicAttrs
An instance of a Collection or Model. This is created by optimisers and correspond to a point in the parameter space.
- Parameters:
child_items –
The child items of the instance. This can be a list or dict.
If a list, the items are assigned to the instance in order. If a dict, the items are assigned to the instance by key and accessed by attribute.
Methods
Convert this instance to a model
attribute_tuples_with_typeTuples describing the name and instance for attributes in the model with a given type, recursively.
copyCreate a copy of the model.
direct_tuples_with_typefreezeFreeze this object.
from_dictRecursively parse a dictionary returning the model, collection or instance that is represents.
hasDoes this instance have an attribute which is of type cls?
itemsmodel_tuples_with_typeAll models of the class in this model which have at least one free parameter, recursively.
models_with_typeReturn all models of a given type in the model tree.
next_idobject_for_pathGet the object at a given path.
path_instance_tuples_for_classTuples containing the path tuple and instance for every instance of the class in the model tree.
replacing_for_pathCreate a new model replacing the value for a given path with a new value
Flatten the instance into a PyTree
Create an instance from a flattened PyTree
unfreezeUnfreeze this object.
valuesAttributes
child_itemscomponent_numberA dictionary representation of this object
identifierlabel- property dict#
A dictionary representation of this object