Code Monkey home page Code Monkey logo

mixedprecisionsvm's Introduction

Mixed Precision SVM

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. image

Project Structure

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)

Requirements to run the project

  • Matlab & Matlab Optimization Toolbox
  • cpp_posit library (external library needed to support the project)

How to use our solution

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.

mixedprecisionsvm's People

Contributors

terranovafr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.