Optimize Code with ActiveClassification

Considering two programs implementing the same function, construct a classifier able to predict which program is the fastest for a given input. The classifier has access to features of the program input (matrix sizes here), and is obtained using ActiveClassification, a function to learn from a "teacher" (a benchmarking function here) instead of a labeled dataset.

Consider two implementations of the same function.

Create an input sampler and benchmarking function.

Create a logistic classifier that imitates the benchmarking function.

Extract the classifier and analyze its performances.

Use the classifier to create an optimized function.

Obtain a simple function from the classifier to simplify the optimized function.

Related Examples

de es fr ja ko pt-br zh