TIL Octave Function Handle permalink

[optTheta, functionVal, exitFlag] = fminunc(@costFunction, initialTheta, options);

So, I learned today that Octave supports passing functions to another function as arguments. This is particularly helpful to build resuable, extensible cost functions and theta-determining algorithms. Simply prefix your function name with the at sign in the list of arguments like so: @costFunction.

I think this makes it easier to translate what I learn to a more modern, performant language. I’m looking forward to tranlating what I learn in this class to something like TensorFlow, scikit-learn, or Apache Spark MLlib.


© 2024