Registers a model at the module package level for get_model_class() and :func`list_model`.
Parameters: |
|
---|---|
Raises KeyError: | |
If overwrite is False and a model already exists with the name provided. |
Example
>>> class MyFavoriteModel(FunctionModel1DAuto):
... def f(self,x,c=1):
... return x**2+c
>>> register_model(MyFavoriteModel)
>>> list_models(include=[MyFavoriteModel])
['myfavorite']
>>> class MyOtherFavoriteModel(MyFavoriteModel):
... pass
>>> register_model(MyOtherFavoriteModel,name='myotherBestest')
>>> list_models(include=[MyOtherFavoriteModel])
['myotherBestest']
>>> class MyMostFavoriteModel(MyFavoriteModel):
... pass
>>> register_model(MyMostFavoriteModel,name=None)
>>> list_models(include=[MyMostFavoriteModel])
['mymostfavorite']
>>> list_models(baseclass=MyFavoriteModel)
['myotherBestest', 'mymostfavorite', 'myfavorite']