rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
https://docs.rs/ndarray/
Apache License 2.0
3.53k stars 296 forks source link

Example repository #674

Open LukeMathWalker opened 5 years ago

LukeMathWalker commented 5 years ago

In https://github.com/rust-ndarray/ndarray-linalg/pull/166 @munckymagik advanced the idea of adding a new repository to rust-ndarray to host more complex standalone examples.

It could be a good place to showcase what is possible using the different pieces of the ecosystem, in a sort of cookbook format.

I love the idea and I think it could provide a lot of value. What are your thoughts?

max-sixty commented 5 years ago

Yes agree! Personally I'd also find a side-by-side example of numpy / scipy v helpful, furthering the existing docs there. Even without that, I think it's a great idea.

jturner314 commented 5 years ago

That sounds like a good idea to me. We do have a few examples in modules linked at the bottom of ndarray_for_numpy_users, but they're pretty minimal and focus more on ndarray than the ecosystem as a whole. We should also review the files in the examples directory to see if we need to update/remove any of them.

LukeMathWalker commented 5 years ago

I have been going through the files in the examples directory and I have to admit that it's not obvious what we are trying to show in some of them. When I'm back I'll do a second pass and ask for help on those that remain obscure.

LukeMathWalker commented 5 years ago

First sketch is out: https://github.com/rust-ndarray/ndarray-examples

I still need to add a CI pipeline (mirroring @termoshtt's work on ndarray-linalg) - suggestions are welcome :+1:

P.S. The linear regression example is currently using a hard-coded openblas feature for ndarray-linalg (even though the README says it's selectable). Still some work to do there to figure out how to actually make it selectable when running the example :eyes:

LukeMathWalker commented 5 years ago

Backend selection is now working as expected. Unfortunately, it seems we can't provide a top-level backend selection mechanism due to https://github.com/rust-lang/cargo/issues/5015 - it has to be done in the Cargo.toml of each example. (Tracking issue for the feature request on cargo: https://github.com/rust-lang/cargo/issues/4753)

LukeMathWalker commented 4 years ago

I have another PR up, with a simple implementation of K-Means clustering: https://github.com/rust-ndarray/ndarray-examples/pull/2

Looking for :eyes: