autofit.ModelInstance#
- class autofit.ModelInstance(child_items: Optional[Union[List, Dict]] = None, id_=None)[source]#
Bases:
AbstractModel
An 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_type
Tuples describing the name and instance for attributes in the model with a given type, recursively.
copy
Create a copy of the model.
direct_tuples_with_type
freeze
Freeze this object.
from_dict
Recursively parse a dictionary returning the model, collection or instance that is represents.
has
Does this instance have an attribute which is of type cls?
items
model_tuples_with_type
All models of the class in this model which have at least one free parameter, recursively.
models_with_type
Return all models of a given type in the model tree.
next_id
object_for_path
Get the object at a given path.
path_instance_tuples_for_class
Tuples containing the path tuple and instance for every instance of the class in the model tree.
replacing_for_path
Create 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
unfreeze
Unfreeze this object.
values
Attributes
child_items
component_number
A dictionary representation of this object
identifier
label
- property dict#
A dictionary representation of this object