title: ValueError: continuous format is not supported
body: <p>I have written a simple function where I am using the <a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html" rel="noreferrer">average_precision_score</a> from <code>scikit-learn</code> to compute average precision.</p>
  
  <p>My Code:</p>
  
  <pre><code>def compute_average_precision(predictions, gold):
      gold_predictions = np.zeros(predictions.size, dtype=np.int)
      for idx in range(gold):
          gold_predictions[idx] = 1
      return average_precision_score(predictions, gold_predictions)
  </code></pre>
  
  <p>When the function is executed, it produces the following error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 91, in &lt;module&gt;
      total_avg_precision += compute_average_precision(np.asarray(probs), len(gold_candidates))
    File "test.py", line 29, in compute_average_precision
      return average_precision_score(predictions, gold_predictions)
    File "/if5/wua4nw/anaconda3/lib/python3.5/site-packages/sklearn/metrics/ranking.py", line 184, in average_precision_score
      average, sample_weight=sample_weight)
    File "/if5/wua4nw/anaconda3/lib/python3.5/site-packages/sklearn/metrics/base.py", line 81, in _average_binary_score
      raise ValueError("{0} format is not supported".format(y_type))
  ValueError: continuous format is not supported
  </code></pre>
  
  <p>If I print the two numpy arrays <code>predictions</code> and <code>gold_predictions</code>, say for one example, it looks alright. [One example is provided below.]</p>
  
  <pre><code>[ 0.40865014  0.26047812  0.07588802  0.26604077  0.10586583  0.17118802
    0.26797949  0.34618672  0.33659923  0.22075308  0.42288553  0.24908153
    0.26506338  0.28224747  0.32942101  0.19986877  0.39831917  0.23635269
    0.34715138  0.39831917  0.23635269  0.35822859  0.12110706]
  [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
  </code></pre>
  
  <p>What I am doing wrong here? What is the meaning of the error?</p>