In this notebook, I demo why I spent the time to write Cython and C++ code.
In [3]:
# import custom modules
import py_video_segment as pvs
import numpy as np
In [6]:
# Define python function to get the number of false positives
def PyNumberFalsePositives(truth, predicted):
count = 0;
for i in predicted:
if not((i in truth)):
count = count + 1;
return count
truth = np.array([1, 2, 3, 9, 10, 11]);
predicted = np.array([4, 5, 6, 7, 8]);
length = 100;
In [7]:
%timeit PyNumberFalsePositives(truth, predicted)
In [8]:
ma = pvs.PyMethodAccuracy(truth, predicted, 10)
%timeit ma.NumFalsePositives()