title: LogisticRegression object has no attributes
body: <p>I'm a noob at both Django and scikit-learn trying to create a simple REST server using these technologies to perform classification. So far I'm just trying to get some sort of result to test that the controllers work, but the program doesn't seem to detect any of my LogisticRegression object's attributes. </p>
  
  <p>My code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>from rest_framework.views import APIView
  from .mixins import JSONResponseMixin
  from django.http import HttpResponse
  import numpy as np
  from sklearn import svm
  from sklearn.linear_model import LogisticRegression
  import json
  import pickle
  
  
  class LogisticRegression(APIView):
  
      def get(self, request):
        
          return HttpResponse("Stub")
  
  
      def post(self, request):
          logreg = LogisticRegression()
  
          array =  '{"data":' + request.body + '}'
          #print array
          jobj= json.loads(array)
     
          jarray = jobj['data']
          matrix = np.asarray([[j['GravityX'], j['GravityY'], j['GravityZ'], j['true']] for j in jarray])
  
          X = matrix[:, :3]
          y = matrix[:, 3]
  
          logreg.fit(X, y)       
          
          return HttpResponse("test")</code></pre>
  </div>
  </div>
  </p>
  
  <p>And the result (created using Postman with a dummy data JSON in the request body):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Request Method: POST
  Request URL: http://localhost:8000/classify/logistic_regression
  Django Version: 1.8.4
  Exception Type: AttributeError
  Exception Value: 
  'LogisticRegression' object has no attribute 'fit'
  Exception Location: /Users/mart/myclassifier/classifierapi/views.py in post, line 31
  Python Executable: /Users/mart/myclassifier/myclassifiervenv/bin/python
  Python Version: 2.7.10
  Python Path: 
  ['/Users/mart/myclassifier',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python27.zip',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/plat-darwin',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/plat-mac',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/plat-mac/lib-scriptpackages',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/lib-tk',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/lib-old',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/lib-dynload',
   '/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
   '/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
   '/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
   '/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
   '/usr/local/Cellar/python/2.7.10/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
   '/Users/mart/myclassifier/myclassifiervenv/lib/python2.7/site-packages']
  Server time: Wed, 14 Oct 2015 02:54:32 +0000</code></pre>
  </div>
  </div>
  </p>
  
  <p>I tried other attributes, and the corresponding no attribute error results. Any ideas?</p>