Skip to content

Commit

Permalink
First stab at porting region_est_hull to ConvexHull.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgranade committed Sep 8, 2016
1 parent ea90440 commit e86c6d9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/qinfer/smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

# from itertools import zip

from scipy.spatial import Delaunay
from scipy.spatial import ConvexHull
import scipy.linalg as la
import scipy.stats
import scipy.interpolate
Expand Down Expand Up @@ -879,17 +879,11 @@ def region_est_hull(self, level=0.95):
:meth:`SMCUpdater.est_credible_region`).
"""
# TODO: document return values.
points = self.est_credible_region(level = level)
tri = Delaunay(points)
faces = []
hull = tri.convex_hull

for ia, ib, ic in hull:
faces.append(points[[ia, ib, ic]])

points = self.est_credible_region(level=level)
hull = ConvexHull(points)
vertices = points[uniquify(hull.flatten())]

return faces, vertices
return points[uniquify(hull.vertices.flatten())], points[hull.simplices]

def region_est_ellipsoid(self, level=0.95, tol=0.0001):
"""
Expand Down

0 comments on commit e86c6d9

Please sign in to comment.