Real-time or power-constrained applications employ smaller number formats
(posits) to result in smaller memory footprints, higher performance, and lower
power consumption.
The key task of every efficient implementation is to identify the lowest working precision acceptable to achieve a classification accuracy
comparable to a reference implementation in double-precision floating-point
arithmetic.
The focus of this project is to realize a modified version of the Support Vector
Machine optimization problem, that takes into account the fact that during the
inference phase, the model will be executed on devices that use low precision
posits.
In particular, the idea of this project is to modify the underlying optimization method during the training phase, modifying the constraints in the dual problem, in order to have better results at inference time with posits.
The project is organized as follows:
- matlab/ contains the matlab scripts used to load datasets and find the optimal solutions to the optimization problems
- datasets/ contains the datasets used for evaluating our solution
- main_lambdas.cpp contains the code used to perform inference starting from the dual optimal solutions (Scenarios 1,2,3)
- main_wb.cpp contains the code used to perform inference starting from the primal optimal solutions (Scenarios 4,5)
- Matlab & Matlab Optimization Toolbox
- cpp_posit library (external library needed to support the project)
The Matlab scripts in the Matlab folder can be used in order to generate the primal/dual variables that can be used to simulate the different scenarios investigated in our project.
The scripts involving a model without constraints will output w and b and the dual variable lambdas in csv files.
The scripts involving a model with constraints will output w and b and the dual variables mu and eta in csv files.
The path of the files generated by the scripts can be set in the cpp scripts that will perform inference using posits.
- main_lambdas.cpp will start from the values of lambda generated from a model without constraints or the values of mu and eta generated from a model with constraints, compute the decision functions and perform inference.
- main_wb.cpp will start from the values of w and b generated from a model without constraints or with constraints and will perform inference. The value of b should be specified in the code, and the same holds for the file containing the weight vector w.