Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2""" 

3@file 

4@brief Tiny helpers for scikit-learn exporters. 

5""" 

6 

7 

8def check_type(model, model_type): 

9 """ 

10 Raises an exception if the model is not of the expected type. 

11 

12 @param model *scikit-learn* model 

13 @param model_type expected type 

14 """ 

15 if not isinstance(model, model_type): 

16 raise TypeError( # pragma: no cover 

17 "Model type {0} is not of type {1}.".format( 

18 type(model), model_type))