performancevalidationscikit-learn

disable internal scikit input validation checks


Under the hood Scikit-Learn does a lot of input validation checks defined here such as checking for (X,y) shapes, expected scalars/arrays, ensuring estimator is already fitted, etc. When designing models these checks are extremely useful to catch early bugs, but these become runtime overheads in large mature pipelines once in production.

Is there currently any way, maybe via a global setting, passing in keyword arguments, or similar to disable these internal checks within pipelines, estimators & transformers?


Solution

  • From this scikit discussion, turns out we can set global settings via:

    import sklearn
    sklearn.set_config(
       assume_finite=True,  # disable validation
    )