Re: How to add an if statement in an objective function in scipy.optimize

"Zeina Abu-Aisheh" <[email protected]> Wed, 23 Nov 2022 00:28:11 -0000
Newsgroups gmane.comp.python.scientific.user
Message-ID <[email protected]>
Thanks a lot for your answer, your solution makes sense in case we only need to find the threshold, but our problem is more complex than that, as we want to optimise more than just one parameter, we are looking for something like this

def objective(x, a, b):
	k =  a * x + b
        if x > threshold:
           return 1
        else:
            return 0
and so ideally we would like to optimise a, b and threshold.
Is this possible in Scipy?
_______________________________________________
SciPy-User mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-user.python.org/
Member address: [email protected]