Code Monkey home page Code Monkey logo

pypolycontain's Introduction

Setup

Our package is now available on pip!

pip install pypolycontain

Documentation:

We are working on the documentation. Please regularly check for updates.

Publications

  • A preprint of the paper on the theoretical background of this package is available here.
  • A version of this work is going to be presented in CDC 2019

Necessary Dependencies:

  • Numpy

Optional Dependencies (for some features, including optimization-based features)

You also have the option to clone the repo and manually add it to your pythonpath.

pypolycontain's People

Contributors

kasraghasemi avatar sadraddini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pypolycontain's Issues

zonotope_distance_point returns values larger than distance to centroid

When given a query point q and zonotope z=zonotope(x,G), zonotope_distance_point(z,x) may return something larger than distance(x,q). Example code:

import numpy as np
from pypolycontain.lib.zonotope import zonotope,zonotope_distance_point

iterations = 100
for i in range(iterations):
    centroid_range = iterations
    generator_range = 3
    dimension = 2
    m = np.random.random_integers(dimension, 10)
    G = (np.random.rand(dimension, m) - 0.5) * generator_range
    x = (np.random.rand(dimension, 1) - 0.5) * centroid_range
    z1=zonotope(x,G,color="red")
    query_point = (np.random.rand(1, dimension) - 0.5) * centroid_range
    query_point = query_point.reshape(-1, 1)
    d_centroid_query_point = np.subtract(np.ndarray.flatten(x), \
                              np.ndarray.flatten(query_point))
    d_zonotope_query_point = zonotope_distance_point(z1,query_point)
    print('x: ',x, 'query_point: ', query_point)
    print('dist(x,q): %d, dist(zonotope, q): %d' %(np.linalg.norm(d_centroid_query_point),d_zonotope_query_point))
    assert(d_zonotope_query_point <= np.linalg.norm(d_centroid_query_point))

Example output:

...
('x: ', array([[-11.8958544 ],
       [-15.76381685]]), 'query_point: ', array([[-27.91779239],
       [ 37.10888876]]))
dist(x,q): 55, dist(zonotope, q): 72
Traceback (most recent call last):
  File ".../bounding_box_closest_polytope/pypolycontain/tests/test_zonotope_distance_2.py", line 27, in <module>
    assert(d_zonotope_query_point <= np.linalg.norm(d_centroid_query_point))
AssertionError

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.