title: Plot every nth element in an array
body: <p>I'm coding a simple neural network from scratch. The neural network is implemented in a method <code>simple_1_layer_classification_NN</code>. For every Epoch (training run of the neural net) as you can see from the <code>for loop</code> (in the code below), I append the cost (error margin) value to an array <code>costs</code>. The thing is when the training runs can be as many as thousands or even millions. Meaning the <code>costs</code> array can have so many <code>cost</code> elements appended it. </p>
  
  <p>As I don't want to plot thousands or millions of data-points on a graph, what I want to do is, no matter how many elements are in the <code>costs</code> array, I only want to plot 100 data points from it, spread-out as equally as possible. E.g. if there are 10 elements, then plot all 10 elements. If there are 100 elements, plot all 100 elements. Anything above a 100, plot only 100 data points equally spaced out. E.g. with 200 plot every other data point. With 500, plot every 5th element. Even if it's 102 elements, then plot only 100 data-points, as spaced out as possible. I hope this makes sense. Is this possible to do? Note, I'm only include part of the code that's most relevant to the question. Where there are comments with dots <code># ......</code> I'm just indicating that there's code here, but I didn't include it, as it's not relevant to the question.</p>
  
  <p>Many thanks in advance for any help. </p>
  
  <pre class="lang-py prettyprint-override"><code>
   def simple_1_layer_classification_NN(self, dataset_input_matrix, output_data_labels, input_dimension, epochs, activation_func='sigmoid', learning_rate=0.2, cost_func='squared_error'):
          # ...............
          cost = float()
          costs = []
          # ................
  
          # We perform the training based on the number of epochs specified
          for i in range(epochs):
  
                   #....................
                   # Cost: the cost function to calculate the prediction error margin
                   cost = chosen_cost_func(pred, output_data_labels[ri])
  
                  costs.append(cost)
          #.....................
  
      plt.plot(costs)
      plt.show()
  </code></pre>