title: Python 3: NameError: name 'sklearn' is not defined
body: <p>I am trying to run an Elastic Net regression but get the following error:  NameError: name 'sklearn' is not defined... any help is greatly appreciated!</p>
  
  <p><a href="https://i.stack.imgur.com/eN80B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eN80B.png" alt="enter image description here"></a></p>
  
  <pre><code>    # ElasticNet Regression 
  
      from sklearn import linear_model
      import statsmodels.api as sm
  
      ElasticNet = sklearn.linear_model.ElasticNet() # create a lasso instance
      ElasticNet.fit(X_train, y_train) # fit data
  
      # print(lasso.coef_)
      # print (lasso.intercept_) # print out the coefficients
  
      print ("R^2 for training set:"),
      print (ElasticNet.score(X_train, y_train))
  
      print ('-'*50)
  
      print ("R^2 for test set:"),
      print (ElasticNet.score(X_test, y_test))
  </code></pre>