code: def createReport(tm, options, sequenceString, numSegments, numSynapses):
    
    pac = tm.mmGetTracePredictedActiveColumns()
    pic = tm.mmGetTracePredictedInactiveColumns()
    upac = tm.mmGetTraceUnpredictedActiveColumns()
  
    resultsFilename = os.path.join("results", options.name+"_"+str(int(100*options.noise))+".csv")
  
    with open(resultsFilename,"wb") as resultsFile:
      csvWriter = csv.writer(resultsFile)
  
      accuracies = numpy.zeros(len(pac.data))
      smoothedAccuracies = []
      am = 0
      csvWriter.writerow(["time", "element", "pac", "pic", "upac", "a",
                          "am", "accuracy", "sum", "nSegs", "nSyns"])
      for i,j in enumerate(pac.data):
        if i>0:
          # Compute instantaneous and average accuracy.
          a = computePredictionAccuracy(len(j), len(pic.data[i]))
  
          #  Smooth the curve to get averaged results for the paper.
          am = 0.99*am + 0.01*a
          accuracies[i] = am
          i0 = max(0, i-60+1)
          accuracy = numpy.mean(accuracies[i0:i+1])
          smoothedAccuracies.append(accuracy)
  
          row=[i, sequenceString[i], len(j), len(pic.data[i]),
                  len(upac.data[i]), a, am,
                  accuracy,
                  numpy.sum(accuracies[i0:i+1]),
                  numSegments[i], numSynapses[i]]
          csvWriter.writerow(row)
  
    return smoothedAccuracies
docs: Create CSV file with detailed trace of predictions, missed predictions,
    accuracy, segment/synapse growth, etc.