title: Why Do I get: TypeError: choice() takes 2 positional arguments but 4 were given?
body: <p>I have a problem with random.choice which I can't understand. I pass 3 arguments to the function which is allowed to have 4 (<a href="http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.random.choice.html" rel="nofollow">http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.random.choice.html</a>), but it writes I am allowed to give only 2 and 4 were given. </p>
  
  <pre><code>def load_data():
      dataset = load_boston()
      num_samples = size(dataset.data, 0)
      test_set_sz = int(1.0 * num_samples / 10)
      tst_sub_inds = random.choice(range(num_samples), test_set_sz, False)
      data_test, label_test = dataset.data[tst_sub_inds, :], dataset.target[tst_sub_inds]
      trn_sub_inds = list(set(range(num_samples)) - set(tst_sub_inds)) 
      data_train, label_train = dataset.data[trn_sub_inds, :], dataset.target[trn_sub_inds]
      return ((data_train, label_train), (data_test, label_test))
  </code></pre>
  
  <p>The Error: </p>
  
  <blockquote>
    <p>tst_sub_inds = random.choice(range(num_samples), test_set_sz, False)
    TypeError: choice() takes 2 positional arguments but 4 were given
    Blockquote</p>
  </blockquote>
  
  <p>What is the problem? Maybe it due to an old version of python?</p>
  
  <p>Thanks, 
  Eli</p>