According to ray tune documentation here, the function API is recommended over the class API. (“Both are valid ways of defining a trainable
, but the Function API is generally recommended”)
Why is that the recommendation?
(I can understand the function API is the recommended way to start (for some users) but I don’t understand how its the recommended way to develop a trainable logic)
As I see it, the class API is slightly better as it allows for more modular code where the user can use inheritance to define a hierarchy of classes that extend Trainable. (this cant be done with the function API as in this API all the user logic is encapsulated in a single function (that cant be break/modified))
For example using the class API I can define 2 classes such as:
class MyTrainable(ray.tune.Trainable)
# encapsulate some logic that I want
class MyMoreSpecificTrainable(MyTrainable)
# encapsulate more specific logic that I want