Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Nd4 j slides.pptx

1,144 views

Published on

Gave a talk at:
www.meetup.com/SF-Bayarea-Machine-Learning/events/221739934/

Covers basic architecture of a scientific lib and my take on it with nd4j.

Published in: Engineering

Nd4 j slides.pptx

  1. 1. ND4J ND-ARRAYS FOR JAVA SCIENTIFIC COMPUTING ON THE JVM
  2. 2. Why another scientific library?
  3. 3. Different libraries: JVM: ● Jblas (not maintained) ● Breeze (scala) ● Spire (scala) ● Core.matrix(clojure) ● Netlib blas ● N + 1 pure java impls Real scientific environments (no fragmentation!): ● octave/matlab ● numpy ● R ● Theano
  4. 4. Blas and NDArrays BLAS - Basic Linear Algebra Sub programs. Underlies EVERY fast matrix lib out there. NDArrays - matrices, tensors, math is done on axes (eg: rows/cols)
  5. 5. Matlab/Octave a = ones(5,5) a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 octave:2> sum(a,1) ans = 5 5 5 5 5
  6. 6. Numpy >>> import numpy as np >>> a = np.ones((5,5)) >>> np.sum(a,axis=1) array([ 5., 5., 5., 5., 5.])
  7. 7. Nd4j java/scala import org.nd4j.api.linalg.DSL._ import org.nd4j.linalg.api.ndarray.INDArray import org.nd4j.linalg.factory.Nd4j val a = Nd4j.ones(5,5) println Nd4j.sum(a,1) [5.0, 5.0, 5.0, 5.0, 5.0]
  8. 8. Blas Implementations ● Cublas (cuda) ● Openblas ● Intel MKL(cpu) ● Nvblas(cuda) ● Clblas(opencl) ● ATLAS(CPU) ● LAPACK(CPU)
  9. 9. ND4J A DISTRIBUTED FRAMEWORK FOR MATRIX MANIPULATION NATIVE JBLAS GPU JCUDA ?? WITH SWAPPABLE BACKENDS…
  10. 10. Core Concepts ● DataBuffer - A DataBuffer is a storage abstraction. A raw buffer could be an nio buffer or a jcuda buffer. This allows for backend optimal storage. ● FFTInstance - An instantiation of FFT. Every hardware maker has their own impls. ● ConvolutionInstance - An instantiation of Convolution. Same as FFT ● Complex Numbers - (An abstraction over different libs) ● BlasWrapper - An interface to a blas backend (blas is a standard for cripe sakes!) ● Op - Some sort of a mathematical operation (dot product, element wise addition,negation,..) ● Garbage Collector (WIP) - Native resource handling where needed
  11. 11. Other Features ● Loss Functions ● Adaptive learning rates ● Solvers (LBFGS,Conjugate gradient,Hessian Free,SGD) ● RNG: (DIfferent distributions based on apache math)
  12. 12. ND4J ND4J IS PORTABLE & CROSS-PLATFORM DESKTOP CLOUD MOBILE
  13. 13. ND4J ND4J SUPPORTS JAVA SCAL A CLOJURE
  14. 14. ND4J FAMILIAR SEMANTICS NUMPY MATLA B SCIKIT- LEARN
  15. 15. ND4J ADAM GIBSON adam@skymind.io

×