I have a ML algorithm that I want to train. I am not yet satisfied with the results and would like to optimize it. For this I would like to build a loop around the algorithm and vary different parameters so that the error is minimal. Does anyone have an idea how such a loop could look like.? In principle I would like to "find the value x for which y is minimal".