Created
November 2, 2017 00:37
-
-
Save andycasey/a65e9da155c5760d3afcb74dd67bc687 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy.spatial import Delaunay | |
| training_set_labels = #.... from somewhere else | |
| test_set_labels = np.atleast_2d(test_set_labels) | |
| # construct convex hull of the training set using all labels | |
| hull = Delaunay(training_set_labels) | |
| # in_convex_hull will give true/false as to whether the test | |
| # set labels fall within the multidimensional convex hull of | |
| # the training set labels. | |
| in_convex_hull = hull.find_simplex(test_set_labels) >= 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment