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

Implementing Python preprocessing modules in Rust for ML/AI applications #23

Closed
kaushiksk opened this issue Jun 24, 2017 · 1 comment
Closed

Comments

@kaushiksk
Copy link

kaushiksk commented Jun 24, 2017

I'd like to know of the developments that have been made in this regard. What are the available modules? Which aspects can be contributed on? Also does Rust provide support for Numpy objects?

@kaushiksk kaushiksk changed the title Implementing Python preprocessing modulesin Rust for ML/AI applications Implementing Python preprocessing modules in Rust for ML/AI applications Jun 24, 2017
@dvigneshwer
Copy link
Collaborator

dvigneshwer commented Jul 15, 2017

Q1. Rust provide support for Numpy objects?

You can create N-dimensional array using the nd-array crate.

Sample code snippet:

  1. Create a new Rust project:
cargo new --bin sample_matrix
cd  sample_matrix
cargo add ndarray
  1. Modifications in src/main.rs
#[macro_use(array)]
extern crate ndarray;

fn main() {
	let sample_matrix = array![[1, 2],[3, 4]];
    println!("The Zero matrix {}", sample_matrix);
}

Output for above snippet:

image

Q2. Which aspects can be contributed on?

This is a very interesting area for contribution you can try to incorporate the below code example which basically parallelizes reading of images in a directory to the python rust module recipe in the kit,

extern crate rayon;
extern crate Image;

fn load_images(paths: &[PathBuf]) -> Vec<Image> {
    // loads images in parallel thread using par_iter method of rayon crate
    path.par_iter().map(|path| {Image::load(path)}).collect()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants