GithubHelp home page GithubHelp logo

Comments (6)

pobonomo avatar pobonomo commented on June 7, 2024 1

Thinking a bit more about this, there is a documentation effort to make. In most cases those intermediate variables are stored but that part is not documented. This should definitely be done at some point. But it is tedious to go through all objects (and also make sure that names are somewhat consistent).

I'll try to start with neural networks but I won't promise a delivery date.

from gurobi-machinelearning.

pobonomo avatar pobonomo commented on June 7, 2024

This is not trivial to do but it can be done by inspecting the modeling object that is created when the neural network is added to the gurobipy model (the object returned by add_predictor_constr).

This object should contain the layers of the network and for each layer it's input and output.

It would take me a bit of time but I could make an example.

from gurobi-machinelearning.

g-poveda avatar g-poveda commented on June 7, 2024

Many thanks for the help and happy to get an example.
to update afterward the bounds after the add_predictor_constr, would you advise to use "setAttr("lb"/"ub",value)", add additional constraint or is there a better way ?

from gurobi-machinelearning.

pobonomo avatar pobonomo commented on June 7, 2024

Doing a very simple example is not so long.
What I did doesn't really make sense but I hope it shows how I would do it.

Here:
https://github.com/pobonomo/gurobi-machinelearning/blob/bound_layers_adversarial/docs/notebooks/ipynb/adversarial_mnist.ipynb

it's a variation of the adversarial example from the documentation were after solving the model I put bounds on the output of the first layer (you can search for "Add bounds")

to update afterward the bounds after the add_predictor_constr, would you advise to use "setAttr("lb"/"ub",value)", add additional constraint or is there a better way ?

Yes I would change directly the bounds of the variables as I did in the notebook.

from gurobi-machinelearning.

g-poveda avatar g-poveda commented on June 7, 2024

Excellent.
if you're interested i might fork and give a try to add some function that compute valid bounds and update the gurobi model (using interval arithmetic or this kind of method https://github.com/eth-sri/eran) ? or maybe you're interested to look at it yourself too :)

from gurobi-machinelearning.

pobonomo avatar pobonomo commented on June 7, 2024

Yes that would be nice. I am not sure how much I can do in this direction but it would definitely be interesting.

from gurobi-machinelearning.

Related Issues (20)

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.