Esempio n. 1
0
 def test_validate_GradientBoostingRegressor1(self):
     fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__")
     logger = getLogger('skl2onnx')
     logger.disabled = True
     verbose = 1 if __name__ == "__main__" else 0
     rows = list(enumerate_validated_operator_opsets(
         verbose, models={"GradientBoostingRegressor"}, opset_min=10, fLOG=fLOG,
         runtime='python', debug=False))
     self.assertGreater(len(rows), 1)
     max_diff = max(_.get('max_rel_diff_batch', 1e-11) for _ in rows)
     self.assertLesser(max_diff, 1e-2)
Esempio n. 2
0
    def test_validate_sklearn_store_models(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        logger = getLogger('skl2onnx')
        logger.disabled = True
        rows = list(
            enumerate_validated_operator_opsets(verbose=0,
                                                models={"LinearRegression"},
                                                opset_min=10,
                                                store_models=True,
                                                fLOG=fLOG))

        self.assertNotEmpty(rows)
        self.assertIn('MODEL', rows[0])
        self.assertIn('ONNX', rows[0])
        self.assertIsInstance(rows[0]['MODEL'], LinearRegression)
        oinf = OnnxInference(rows[0]['ONNX'])
        dot = oinf.to_dot()
        self.assertIn('LinearRegressor', dot)
    def test_rt_grid_search_cv(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        verbose = 1 if __name__ == "__main__" else 0

        buffer = []

        def myprint(*args, **kwargs):
            buffer.append(" ".join(map(str, args)))

        debug = True
        rows = list(
            enumerate_validated_operator_opsets(
                verbose,
                models={"GridSearchCV"},
                fLOG=myprint,
                runtime='python',
                debug=debug,
                filter_exp=lambda m, p: "64" not in p))
        self.assertGreater(len(rows), 1)
        self.assertGreater(len(buffer), 1 if debug else 0)
    def test_rt_isonotic_regression(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")
        logger = getLogger('skl2onnx')
        logger.disabled = True
        verbose = 1 if __name__ == "__main__" else 0

        buffer = []

        def myprint(*args, **kwargs):
            buffer.append(" ".join(map(str, args)))

        debug = False
        rows = list(
            enumerate_validated_operator_opsets(
                verbose,
                models={"IsotonicRegression"},
                fLOG=myprint,
                runtime='python',
                debug=debug,
                filter_exp=lambda m, p: "64" not in p))
        self.assertGreater(len(rows), 1)
        self.assertGreater(len(buffer), 1 if debug else 0)