Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: (feature) add anisotropic meshing to LearnerND #141

Open
wants to merge 30 commits into
base: master
from

Conversation

@basnijholt
Copy link
Member

@basnijholt basnijholt commented Dec 19, 2018

(original merge request on GitLab)

opened by Jorn Hoofwijk (@Jorn) at 2018-07-25T11:37:55.550Z

Closes gitlab:#74

Depends on gitlab:!86 and gitlab:#80 and therefore it has the corresponding branches included as well

Still has a few to-do's:

  • let LearnerND.ip() make use of our triangulation rather than building a new one
  • make it work in arbitrary dimensions
  • verify that it is beneficial
  • let the user configure the parameters (maximum stretch factor and number of points to take into account) Use one simplex and it's neighbours
  • make test pass
    • add rtree as install requirement No more RTree anymore :)
    • raise exception if anistropic=True and rtree not installed, pass if anisotropic=False
  • refactor code to be human-readable
  • let's make it fast :) gitlab:#80

As it seems it doesn't work that well with the ring, since this ring has a relative low average gradient and very high second derivative. So maybe this second derivative might be a more useful property to determine the

Sneak peek:
anisotropic

JornHoofwijk and others added 30 commits Jul 17, 2018
taking into account the output dimension of the function
this way you can import them into other files
it prunes some circumcircles faster
it results in:
~20% faster in 2d
~40% faster in 3d
@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T11:56:16.294Z on GitLab

I notice that you aren't using transform when adding a point to the subtriangulations; could that be of relevance?

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T12:00:43.335Z on GitLab

Shouldn't we rather get all neighbors from the triangulation?

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T12:05:07.599Z on GitLab

In my trial runs the triangulation stays isotropic in the ring, regardless of the resolution. It doesn't look like this is working as expected.

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T12:11:59.837Z on GitLab

I think the scale matrix should be applied first to the point coordinates instead; isn't that right?

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T12:18:22.404Z on GitLab

Um, are you sure that you want to normalize the gradient? That sounds like it could be the explanation for the weird behavior with the circle.

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T12:36:18.536Z on GitLab

...But this line I don't understand.

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-07-25T13:11:11.040Z on GitLab

Totally works with the ring:

image

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Jorn Hoofwijk (@Jorn) at 2018-08-03T16:00:05.473Z on GitLab

In hindsight, I do have a hard time to produce an example where the anisotropic learner does not produce good results.

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Jorn Hoofwijk (@Jorn) at 2018-08-20T12:13:33.135Z on GitLab

let LearnerND.ip() make use of our triangulation rather than building a new one

This point is going to be a lot harder than I thought. Scipy does not support this and I couldn't find a lib that does. Also when I would just use Triangulation.locate_point(p) it would be an O(N) operation per requested point.

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-08-20T12:40:11.106Z on GitLab

For plotting you could consider this approach:

  • precompute an array of values at each pixel
  • loop over all triangles, updating every pixel belonging to a triangle.

Otherwise you'd need an rtree and searching over point's neighbors.

@basnijholt
Copy link
Member Author

@basnijholt basnijholt commented Dec 19, 2018

originally posted by Jorn Hoofwijk (@Jorn) at 2018-09-21T11:07:18.805Z on GitLab

actually, @basnijholt pointed out yesterday that I was mistaken and that scipy does allow you to provide a triangulation to the linearNDinterpolator. However, I am not completely sure as to what methods must be implemented on the provided triangulation. Depending on what it is, we can either do it efficiently or it may be pretty inefficient.

@basnijholt basnijholt force-pushed the master branch 4 times, most recently from cb83625 to 7ccb583 Jan 25, 2019
@basnijholt basnijholt force-pushed the master branch 2 times, most recently from 91e38f1 to bc190a7 Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants