psiz-org / psiz

A python package for inferring psychological embeddings.
https://psiz.org
Apache License 2.0
29 stars 7 forks source link

Model Restarts #27

Open roads opened 2 years ago

roads commented 2 years ago

NOTE: An initial version of this text was originally displayed in the PsiZ documentation. It is being added here so that it can be permanently referenced.


Motivation

Unfortunately, many embeddings are susceptible to discovering local optima during inference. While the usual tricks help, such as stochastic gradient decent, one often requires multiple restarts with different initializations to be confident in the solution.

Current Solution

In an effort to shield users from the burden of writing restart logic, PsiZ includes a psiz.keras.Restarter object that implements a fit method similar to tf.keras.Model. The state of most TensorFlow objects can be reset using a serialization/deserialization strategy. However, tf.keras.callbacks.Callback does not implement this serialization strategy.

To patch this problem, PsiZ implements a subclass of tf.keras.callbacks.Callback, which adds a :py:meth:reset method.

Remaining Issues