From the course: Testing Python Data Science Code
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Performance regression testing - Python Tutorial
From the course: Testing Python Data Science Code
Performance regression testing
- [Instructor] Let's take a look at performance regression testing. I have two fixtures, one for regression data that returns the regression data with the version, X and y. And second one, which loads a model. Again, probably from a model store, and again, loading the data and returning a model with version and the classifier. And I'm going to have two tests. One is for memory testing. And to measure memory, I'm going to use the third-party package called psutil that works on most platforms and provide a lot of information about processes. So I'm creating a process, without process ID, this is the current process. And I'm getting the RSS. Then I'm calling predict, and then I'm getting the RSS after, and generating a report with the model version, data version, and the memory usage. And finally, print out in JSON format. For performance testing, I'm going to use the built-in timeit library. I'm going to run…