Training and test error

Hello, I was wondering how we calculate the error when we use other type of scoring, for example r2.
Thank you!

The cross_validate function accept a parameter scoring. You can refer to the documentation to have all details regarding this parameter: sklearn.model_selection.cross_validate — scikit-learn 1.0.2 documentation

In short, you can usually pass a string that is a predefined score or a callable in case you want to define your own metric.