Questions tagged [nd4j]

ND4J and ND4S are scientific computing libraries for the JVM.

These Java libraries provide implementations of n-dimensional arrays and linear algebra algorithms with emphasis on performance for large arrays. Arrays are stored off heap with operations on arrays performed outside the JVM employing BLAS or Cuda and the system's GPU. Numpy and MATLAB were the inspiration according to the authors.

Useful Links:

120 questions
2
votes
0 answers

OpenBLAS preset in the DL4J library for Android

I am trying to run OpenBLAS preset in the DL4J library but i am having a problem in SetNumThreads.allocate() the library implementation in build.gradle: implementation group: 'org.bytedeco.javacpp-presets', name: 'openblas', version:…
Jay
  • 21
  • 3
2
votes
1 answer

Lag a value with Datavec transform

I'm trying to figure out how to get a lagged value of a field as part of a datavec transform step. Here is a little example built off the dl4j examples: import org.datavec.api.records.reader.RecordReader; import…
andrewm4894
  • 1,451
  • 4
  • 17
  • 37
2
votes
0 answers

Deeplearning4J slow on Word2Vec

I want to try word2vec with this configuration: compile "org.deeplearning4j:deeplearning4j-core:1.0.0-beta2" compile "org.nd4j:nd4j-native-platform:1.0.0-beta2" //compile "org.nd4j:nd4j-cuda-9.2-platform:1.0.0-beta2" compile group:…
praetorianer777
  • 309
  • 3
  • 12
2
votes
0 answers

ND4J getRows not working on a vector

Using N4DJ in java nd4j-native-platform version 0.9.1 I am trying to create a subset of an array by only selecting certain rows. I do this using the getRows method. This works fine for matrices, however when my matrix comprises of a single row…
AvdB
  • 65
  • 7
2
votes
1 answer

DeepLearning4j k-means very slow

I'm trying to use DL4J's K-Means implementation. I set it up as follows: int CLUSTERS = 5; int MAX_ITERATIONS = 300; String DISTANCE_METRIC = "cosinesimilarity"; KMeansClustering KMEANS = KMeansClustering.setup(CLUSTERS, MAX_ITERATIONS,…
KidCrippler
  • 1,633
  • 2
  • 19
  • 34
2
votes
2 answers

Deeplearning4j example does not work with gradle

I am trying to run CnnSentenceClassification from deeplearning4j example. I moved this file to my Gradle project. When I run the class from the eclipse it works fine. However when I run it from ./gradlew run I get following error: Exception in…
2
votes
1 answer

Simple convolution in nd4j

I can't get a simple convolution to work in nd4j and documentation regarding this specific topic is scarse. What I'm trying to do: INDArray values = Nd4j.create(new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); INDArray kernel = Nd4j.create(new…
Anthony De Smet
  • 2,265
  • 3
  • 17
  • 24
2
votes
1 answer

Nd4j: using multiple threads is slower than single-thread

This is my processor: 2.3 GHz Intel Core i7 (so 4 cores with hyper threading) on MacOs Sierra This is my program: package nn import org.nd4j.linalg.api.ndarray.INDArray import org.nd4j.linalg.factory.Nd4j.randn import…
botkop
  • 934
  • 1
  • 8
  • 17
2
votes
1 answer

Using broadcast in ND4J

I recently switched from numpy to ND4J but had a hard time understanding how broadcasting in ND4J works. Say I have two ndarray, a of shape [3,2,4,5] and b of shape [2,4,5]. I would like to element-wise add them up and broadcast b to each a[i] for…
Harper
  • 1,794
  • 14
  • 31
2
votes
1 answer

Workaround for chained indexing Scala compiler error?

Chained indexing in ND4S and Breeze produces a Scala compiler error: var m = Nd4j.create(2, 3) var a = m(0, ->) var b = a(0) var c = m(0, ->)(0) The first two work but the third produces: not enough arguments for method apply: (implicit ev:…
Sam
  • 385
  • 1
  • 10
2
votes
1 answer

How does ND4J reference native libraries?

I am currently working on Deeplearning4J for creating neural networks, what continues to perplex me is that how it references native libraries like OpenBLAS for its operations ? What does it use ? Does it use jniLoader or some other API ? What is…
Machina333
  • 602
  • 5
  • 15
1
vote
2 answers

Calculating the principal axis/eigenvalues and -vectors of large dataset in Java

I have a large dataset (>500.000 elements) that contains the stress values (σ_xx, σ_yy, σ_zz, τ_xy, τ_yz, τ_xz) of FEM-Elements. These stress values are given in the global xyz-coordinate space of the model. I want to calculate the main axis stress…
PebNischl
  • 163
  • 5
1
vote
0 answers

Boolean indexing with ND4J

What I want to achieve: With NumPy, we have boolean indexing which operates like this: import numpy as np a = np.arange(10) mask = a < 5 a[mask] # array([0, 1, 2, 3, 4]) What I tried: I've been trying to make similar functionality work with nd4j: …
rocksNwaves
  • 5,331
  • 4
  • 38
  • 77
1
vote
1 answer

how to exclude specific jars from a dependency in a maven repository

I want to use the project from nd4j-cuda-10.2. it has jar files for two Operating Systems, Linux and Windows. than How can I exclude the jar from Linux when using a windows system and vice versa?. [Maven Repository][1] [1]:…
1
vote
0 answers

Android apk too big using OpenCV and Nd4j

I have an android application that needs the OpenCV and Nd4j libraries. The problem is, the app is too big (almost 700MB), and i have no idea how to slim it down. build.gradle: implementation fileTree(dir: 'libs', include: ['*.jar']) //…