title: What type is a sklearn model?
body: <p>I'm writing some code which evaluates different sklearn models against some data. I am using type hints, both for my own education and to help other people who will eventually have to read my code. </p>
  
  <p>My question is how do I specify the type of a sklearn predictor (such as <code>LinearRegression()</code>)? </p>
  
  <p>For example:</p>
  
  <pre><code>def model_tester(model : Predictor,
                   parameter: int
                   ) -&gt; np.ndarray:
       """An example function with type hints."""
  
       # do stuff to model 
  
       return values
  </code></pre>
  
  <p>I see the <a href="https://docs.python.org/3/library/typing.html" rel="noreferrer">typing library</a> can make  new types or I can use <code>TypeVar</code> to do:</p>
  
  <pre><code>Predictor = TypeVar('Predictor') 
  </code></pre>
  
  <p>but I wouldn't want to use this if there was already a conventional type for an sklearn model.</p>
  
  <p>Checking the type of LinearRegression() yields:</p>
  
  <pre><code> sklearn.linear_model.base.LinearRegression
  </code></pre>
  
  <p>and this is clearly of use, but only if I am interested in the LinearRegression model. </p>