MachineLearningLifeScience / poli

A library of discrete objectives
MIT License
13 stars 1 forks source link

Custom function API addition #160

Open RMichae1 opened 8 months ago

RMichae1 commented 8 months ago

Currently we do not provide capabilities to load a custom user-defined function with poli.

We require the user to add any function as an objective to the objective repository. However that may be a large hurdle for initial users of the poli library.

We could consider adding an empty black-box objective/ dummy objective on any available data assets and let the user specify a custom function for f.

This way benchmarking and dev can be done quicker if a callable function object is available for the user without the requirement to make substantial contributions to poli.

miguelgondu commented 8 months ago

I like it, were you imagining something like this?:

from poli.objective_repository import DummyBlackBox

f = DummyBlackBox(black_box=lambda x: 0.0)

# then f(whatever) == 0.0, and the logging and other functionalities of black boxes can still be attached and measured? 
RMichae1 commented 8 months ago

Exactly like that. +1

miguelgondu commented 8 months ago

to preserve shapes, we would need something like lambda x: np.zeros(len(x)).reshape(1, -1), but these are minor details.

miguelgondu commented 6 months ago

We could implement a lambda black box registration for isolation.

The way to do it would be by asking the user to implement a subclass of AbstractIsolatedFunction.