Questions for Time Series LSTM

Question

Hello, I wanted to ask a couple of questions. I retrieve my data from the database. And I did not find in the examples the correct way to convert Java arrays to DataSetIterators. Below is an example of a code with toy data (my data is also an integer format, so the example is correct).

  1. How do I normalize my data? Below in the code there is a commented-out code, it converts only the input data, but the labels remain not converted.
  2. I added a listener to the model but it does not work, tell me what could be the problem.
  3. why can’t I evaluate test data without an iterator?
  4. How can I set the batch size if I do not use a DataSeIterator?
  5. Did I set the array shape for a recurrent neural network correctly? (split_sequence() method)

thanks.

public class Forecast {

    public final static int BATCH_SIZE = 2; 
    public final static int RNG_SEED = 123; 
    public final static int TIME_STEPS = 3;
    public final static int nEpoch = 10;

    public static void main(String[] args) throws IOException, InterruptedException {

        int[] train = {10, 20, 30, 40, 50, 60, 70, 80, 90};
        int[] test = {70, 80, 90};

        DataSet dataSet = split_sequence(train, TIME_STEPS);
        DataSetIterator train_iterator = new ListDataSetIterator(Collections.singletonList(dataSet), BATCH_SIZE);

//        NormalizerMinMaxScaler normalizer = new NormalizerMinMaxScaler(0, 1);
//        normalizer.fit(dataSet);
//        normalizer.transform(dataSet);

        MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
                .seed(RNG_SEED)
                .weightInit(WeightInit.XAVIER)
                .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
                .updater(new Adam())
                .l2(1e-4)
                .list()
                .layer(0,new LSTM.Builder()
                        .nIn(TIME_STEPS)
                        .nOut(10)
                        .activation(Activation.SOFTSIGN)
                        .gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
                        .gradientNormalizationThreshold(10)
                        .build())
                .layer(1, new RnnOutputLayer.Builder(LossFunctions.LossFunction.MSE)
                        .activation(Activation.IDENTITY)
                        .nIn(10)
                        .nOut(1)
                        .gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
                        .gradientNormalizationThreshold(10)
                        .build())
                .build();


        MultiLayerNetwork model = new MultiLayerNetwork(conf);
        model.init();

        System.out.println("Train model...");
        long startTime = System.currentTimeMillis();
        model.setListeners(new ScoreIterationListener(1)); // doesn't work

        for (int i=0; i < nEpoch; i++)
            model.fit(train_iterator);

        long endTime = System.currentTimeMillis();
        System.out.println("=============run time===================== " + (endTime - startTime));

        var eval = model.evaluateRegression(); // how i can evaluate model without iterator?
        System.out.println(eval.stats());

    }

//split a given univariate sequence into multiple samples where each sample has a specified number of time steps and the output is a single time step
    public static DataSet split_sequence(int[] sequence, int n_steps) {

        int arr_size = sequence.length - n_steps;
        var input =  new double[arr_size][n_steps];
        var label =  new double[arr_size];

        for (int i = 0; i < sequence.length; i++){
            int seq_end = i + n_steps;
            if (seq_end > sequence.length-1) break;
            input[i] = copyFromIntArray(Arrays.copyOfRange(sequence, i, seq_end)); // copyFromIntArray method converting int[] -> double[]
            label[i] = sequence[seq_end];
        }
        INDArray x = Nd4j.create(input).reshape(new int[]{arr_size, n_steps, 1});
        INDArray y = Nd4j.create(label).reshape(new int[]{arr_size, 1, 1});

        return new DataSet(x,y);
    }

Version Information

  • DL4J 1.0.0-beta6
  • Mac OS

You might be interested in using JDBCRecordReader instead of manually turning your data into arrays.

If you want to also normalize your labels, you just call normalizer.fitLabel(true). It will then learn about both features and labels and normalize both of them when it transforms a dataset.

In order for your Normalizer to learn about your data set you pass in a DataSetIterator to its .fit method.

Afterwards, you would usually set the normalizer as a dataset preprocessor on the DataSetIterator. That way it will always be used when a DataSet is requested from the DataSetIterator.

You likely haven’t configured logging properly. The ScoreIterationListener uses a logger to output the scores.

Check out https://github.com/eclipse/deeplearning4j-examples/tree/master/standalone-sample-project for an example project where it is configured sanely. The two files of most interest for logging in this case are:
https://github.com/eclipse/deeplearning4j-examples/blob/master/standalone-sample-project/pom.xml#L76-L80 which adds an actual logger to the project and
https://github.com/eclipse/deeplearning4j-examples/blob/master/standalone-sample-project/src/main/resources/logback.xml which contains the actual configuration

You can: Eclipse Deeplearning4j · GitHub

You just can’t use the convenience methods on the model directly.

You will have to do it manually. Each DataSet object is a single batch.

The correct shape for a recurrent neural network is [batchSize, featureSize, timeSteps].
If I understand your code correctly, then no, you didn’t do it correctly.

@treo thanks for the reply. unfortunately I can’t use the JDBCRecordReader, because I pre-process the data received from the database (interpolate, etc.), in the end I had to create files for iterators.
I have one more question:
I added classifier for nd4j but but the warning messages did not disappear (p.s cpu support avx2 - i7 6700hq)

       <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-native-platform</artifactId>
            <version>1.0.0-beta6</version>
            <classifier>macosx-x86_64-avx2</classifier>
        </dependency>
[main] INFO org.nd4j.linalg.factory.Nd4jBackend - Loaded [CpuBackend] backend
[main] INFO org.nd4j.nativeblas.NativeOpsHolder - Number of threads used for linear algebra: 1
[main] WARN org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory - *********************************** CPU Feature Check Warning ***********************************
[main] WARN org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory - Warning: Initializing ND4J with Generic x86 binary on a CPU with AVX/AVX2 support
[main] WARN org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory - Using ND4J with AVX/AVX2 will improve performance. See deeplearning4j.org/cpu for more details
[main] WARN org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory - Or set environment variable ND4J_IGNORE_AVX=true to suppress this warning
[main] WARN org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory - *************************************************************************************************
[main] INFO org.nd4j.nativeblas.Nd4jBlas - Number of threads used for OpenMP BLAS: 4
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Backend used: [CPU]; OS: [Mac OS X]
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Cores: [8]; Memory: [4,0GB];
[main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Blas vendor: [OPENBLAS]

and
for time series predictions (regression) i should use (early stopping)

DataSetLossCalculator

or

RegressionScoreCalculator

I found one more problem, ui server is not starting, or rather, I can’t access it

 // ----- UI interface  ----------------------
        //Initialize the user interface backend
        UIServer uiServer = UIServer.getInstance();

        //Configure where the network information (gradients, score vs. time etc) is to be stored. Here: store in memory.
        StatsStorage statsStorage = new InMemoryStatsStorage();

        //Attach the StatsStorage instance to the UI: this allows the contents of the StatsStorage to be visualized
        uiServer.attach(statsStorage);

        //Then add the StatsListener to collect this information from the network, as it trains
        model.setListeners(new StatsListener(statsStorage));
        //Finally: open your browser and go to http://localhost:9000/train
        // -----------------------------------------------

[main] INFO org.deeplearning4j.ui.VertxUIServer - StatsStorage instance attached to UI: InMemoryStatsStorage(uid=90040e6b)

I tried to get the address, but got an exception

  System.out.println(uiServer.getAddress());
  System.out.println(uiServer.getPort());
Exception in thread "main" java.lang.NullPointerException
	at org.deeplearning4j.ui.VertxUIServer.getAddress(VertxUIServer.java:323)
	at ml.Trainer.main(Trainer.java:150)

        <dependency>
            <groupId>org.deeplearning4j</groupId>
            <artifactId>deeplearning4j-ui</artifactId>
            <version>1.0.0-beta6</version>
        </dependency>

thanks

You can also create a RecordReader of your own. Many of the methods on the interface are actually optional and using a RecordReaderDataSetIterator will save you some headaches later on.

In beta6 the avx2 message doesn’t go away even if you use the proper dependency. It is a known bug, and will go away in beta7.

It depends what you are optimizing for. If you want the lowest loss, then you go for DataSetLossCalculator, if you have a specific Regression Metric that you want to optimize for (which is different from the loss function that you are directly training on), then you go with RegressionScoreCalculator.

That happens because the server is started asynchronously. You should be able to access the server at http://localhost:9000/train/overview after a few seconds

I tried now but could not log into the server. maybe it’s because of an early stopping?

What do you see? There is no login page there.

there is no interface. I can not access the server screenshot

Can you step through VertxUIServer.start? Something appears to hinder it from actually starting up, but I can’t reproduce it on any of my machines.

i tried and got that:

Exception in thread "main" java.lang.IllegalArgumentException: The FreeMarker version requested by "incompatibleImprovements" was 2.3.29, but the installed FreeMarker version is only 2.3.23. You may need to upgrade FreeMarker in your project.
	at freemarker.template._TemplateAPI.checkVersionNotNullAndSupported(_TemplateAPI.java:49)
	at freemarker.core.Configurable.<init>(Configurable.java:309)
	at freemarker.template.Configuration.<init>(Configuration.java:634)
	at org.deeplearning4j.ui.module.train.TrainModule.<init>(TrainModule.java:140)
	at org.deeplearning4j.ui.VertxUIServer.start(VertxUIServer.java:197)
	at ml.Trainer.main(Trainer.java:120)

should I add a new version of Freemaker to pom.xml manually?

Interesting.
Before doing the suggestions below, can you please run mvn dependency:tree and post the results here.

And afterwards can you add the following to your pom.xml and try again (without explicity calling VertxUIServer.start):

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>2.3.29</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

a few lines of package downloading and below

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  46.751 s
[INFO] Finished at: 2020-02-27T01:30:20+06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Forecast: Could not resolve dependencies for project groudId:Forecast:jar:1.0-SNAPSHOT: Could not find artifact org.nd4j:nd4j-native-platform:jar:macosx-x86_64-avx2:1.0.0-beta6 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Oh, I overlooked that earlier. Too many questions at once :sweat_smile:

For that you should be using just ndj4-native for the artifactId. But that is unrelated to the UI not starting. But maybe the AVX2 message will go away now :slight_smile:

I should delete classifier right?

<dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-native-platform</artifactId>
            <version>1.0.0-beta6</version>
            <classifier>macosx-x86_64-avx2</classifier>
        </dependency>

i delete classifier (mac os)
and this mvn dependency:tree results
(p.s here it seems a few unnecessary imports (apparently in vain I turned on auto import in intellij)

[INFO] groudId:Forecast:jar:1.0-SNAPSHOT
[INFO] +- org.nd4j:nd4j-native-platform:jar:1.0.0-beta6:compile
[INFO] |  +- org.bytedeco:openblas-platform:jar:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:android-arm:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:android-arm64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:android-x86:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:android-x86_64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:ios-arm64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:ios-x86_64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:linux-x86:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:linux-x86_64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:linux-armhf:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:linux-arm64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:linux-ppc64le:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:macosx-x86_64:0.3.7-1.5.2:compile
[INFO] |  |  +- org.bytedeco:openblas:jar:windows-x86:0.3.7-1.5.2:compile
[INFO] |  |  \- org.bytedeco:openblas:jar:windows-x86_64:0.3.7-1.5.2:compile
[INFO] |  +- org.bytedeco:mkl-platform:jar:2019.5-1.5.2:compile
[INFO] |  |  +- org.bytedeco:mkl:jar:2019.5-1.5.2:compile
[INFO] |  |  +- org.bytedeco:mkl:jar:linux-x86:2019.5-1.5.2:compile
[INFO] |  |  +- org.bytedeco:mkl:jar:linux-x86_64:2019.5-1.5.2:compile
[INFO] |  |  +- org.bytedeco:mkl:jar:macosx-x86_64:2019.5-1.5.2:compile
[INFO] |  |  +- org.bytedeco:mkl:jar:windows-x86:2019.5-1.5.2:compile
[INFO] |  |  \- org.bytedeco:mkl:jar:windows-x86_64:2019.5-1.5.2:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:1.0.0-beta6:compile
[INFO] |  |  +- org.bytedeco:javacpp:jar:1.5.2:compile
[INFO] |  |  \- org.nd4j:nd4j-native-api:jar:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:android-arm:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:android-arm64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:android-x86:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:android-x86_64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:ios-arm64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:ios-x86_64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:linux-x86_64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:macosx-x86_64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:windows-x86_64:1.0.0-beta6:compile
[INFO] |  +- org.nd4j:nd4j-native:jar:linux-ppc64le:1.0.0-beta6:compile
[INFO] |  \- org.nd4j:nd4j-native:jar:linux-armhf:1.0.0-beta6:compile
[INFO] +- org.deeplearning4j:deeplearning4j-core:jar:1.0.0-beta6:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-tsne:jar:1.0.0-beta6:compile
[INFO] |  |  \- org.deeplearning4j:nearestneighbor-core:jar:1.0.0-beta6:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-datasets:jar:1.0.0-beta6:compile
[INFO] |  |  \- org.deeplearning4j:deeplearning4j-common:jar:1.0.0-beta6:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-datavec-iterators:jar:1.0.0-beta6:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-modelimport:jar:1.0.0-beta6:compile
[INFO] |  |  \- org.bytedeco:hdf5-platform:jar:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:linux-x86:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:linux-x86_64:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:linux-armhf:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:linux-arm64:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:linux-ppc64le:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:macosx-x86_64:1.10.5-1.5.2:compile
[INFO] |  |     +- org.bytedeco:hdf5:jar:windows-x86:1.10.5-1.5.2:compile
[INFO] |  |     \- org.bytedeco:hdf5:jar:windows-x86_64:1.10.5-1.5.2:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-nn:jar:1.0.0-beta6:compile
[INFO] |  |  +- org.deeplearning4j:deeplearning4j-utility-iterators:jar:1.0.0-beta6:compile
[INFO] |  |  |  \- org.deeplearning4j:deeplearning4j-util:jar:1.0.0-beta6:compile
[INFO] |  |  +- org.lucee:oswego-concurrent:jar:1.3.4:compile
[INFO] |  |  +- org.nd4j:nd4j-common:jar:1.0.0-beta6:compile
[INFO] |  |  |  \- org.nd4j:guava:jar:1.0.0-beta6:compile
[INFO] |  |  +- com.github.oshi:oshi-core:jar:3.4.2:compile
[INFO] |  |  |  +- net.java.dev.jna:jna-platform:jar:4.3.0:compile
[INFO] |  |  |  |  \- net.java.dev.jna:jna:jar:4.3.0:compile
[INFO] |  |  |  \- org.threeten:threetenbp:jar:1.3.3:compile
[INFO] |  |  \- it.unimi.dsi:fastutil:jar:6.5.7:compile
[INFO] |  +- org.apache.commons:commons-math3:jar:3.5:compile
[INFO] |  +- commons-io:commons-io:jar:2.5:compile
[INFO] |  +- org.apache.commons:commons-compress:jar:1.18:compile
[INFO] |  +- org.nd4j:nd4j-api:jar:1.0.0-beta6:compile
[INFO] |  |  +- com.jakewharton.byteunits:byteunits:jar:0.9.1:compile
[INFO] |  |  +- com.google.flatbuffers:flatbuffers-java:jar:1.10.0:compile
[INFO] |  |  +- org.nd4j:protobuf:jar:1.0.0-beta6:compile
[INFO] |  |  +- commons-net:commons-net:jar:3.1:compile
[INFO] |  |  +- org.nd4j:nd4j-buffer:jar:1.0.0-beta6:compile
[INFO] |  |  +- org.nd4j:nd4j-context:jar:1.0.0-beta6:compile
[INFO] |  |  \- net.ericaro:neoitertools:jar:1.0.0:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.6:compile
[INFO] |  +- org.nd4j:jackson:jar:1.0.0-beta6:compile
[INFO] |  +- org.datavec:datavec-api:jar:1.0.0-beta6:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  |  +- joda-time:joda-time:jar:2.2:compile
[INFO] |  |  +- org.freemarker:freemarker:jar:2.3.23:compile
[INFO] |  |  +- com.clearspring.analytics:stream:jar:2.7.0:compile
[INFO] |  |  +- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] |  |  \- com.tdunning:t-digest:jar:3.2:compile
[INFO] |  +- org.datavec:datavec-data-image:jar:1.0.0-beta6:compile
[INFO] |  |  +- com.github.jai-imageio:jai-imageio-core:jar:1.3.0:compile
[INFO] |  |  +- com.twelvemonkeys.imageio:imageio-jpeg:jar:3.1.1:compile
[INFO] |  |  |  +- com.twelvemonkeys.imageio:imageio-core:jar:3.1.1:compile
[INFO] |  |  |  +- com.twelvemonkeys.imageio:imageio-metadata:jar:3.1.1:compile
[INFO] |  |  |  +- com.twelvemonkeys.common:common-lang:jar:3.1.1:compile
[INFO] |  |  |  +- com.twelvemonkeys.common:common-io:jar:3.1.1:compile
[INFO] |  |  |  \- com.twelvemonkeys.common:common-image:jar:3.1.1:compile
[INFO] |  |  +- com.twelvemonkeys.imageio:imageio-tiff:jar:3.1.1:compile
[INFO] |  |  +- com.twelvemonkeys.imageio:imageio-psd:jar:3.1.1:compile
[INFO] |  |  +- com.twelvemonkeys.imageio:imageio-bmp:jar:3.1.1:compile
[INFO] |  |  +- org.bytedeco:javacv:jar:1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:ffmpeg:jar:4.2.1-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:flycapture:jar:2.13.3.31-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:libdc1394:jar:2.2.6-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:libfreenect:jar:0.5.7-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:libfreenect2:jar:0.2.0-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:librealsense:jar:1.12.4-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:librealsense2:jar:2.29.0-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:videoinput:jar:0.200-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:artoolkitplus:jar:2.3.1-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:flandmark:jar:1.07-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:leptonica:jar:1.78.0-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:tesseract:jar:4.1.0-1.5.2:compile
[INFO] |  |  |  \- org.openjfx:javafx-graphics:jar:11:compile
[INFO] |  |  |     +- org.openjfx:javafx-graphics:jar:mac:11:compile
[INFO] |  |  |     \- org.openjfx:javafx-base:jar:11:compile
[INFO] |  |  |        \- org.openjfx:javafx-base:jar:mac:11:compile
[INFO] |  |  +- org.bytedeco:opencv-platform:jar:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:android-arm:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:android-arm64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:android-x86:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:android-x86_64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:ios-arm64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:ios-x86_64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:linux-x86:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:linux-x86_64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:linux-armhf:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:linux-arm64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:linux-ppc64le:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:macosx-x86_64:4.1.2-1.5.2:compile
[INFO] |  |  |  +- org.bytedeco:opencv:jar:windows-x86:4.1.2-1.5.2:compile
[INFO] |  |  |  \- org.bytedeco:opencv:jar:windows-x86_64:4.1.2-1.5.2:compile
[INFO] |  |  \- org.bytedeco:leptonica-platform:jar:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:android-arm:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:android-arm64:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:android-x86:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:android-x86_64:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:linux-x86:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:linux-x86_64:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:linux-armhf:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:linux-arm64:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:linux-ppc64le:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:macosx-x86_64:1.78.0-1.5.2:compile
[INFO] |  |     +- org.bytedeco:leptonica:jar:windows-x86:1.78.0-1.5.2:compile
[INFO] |  |     \- org.bytedeco:leptonica:jar:windows-x86_64:1.78.0-1.5.2:compile
[INFO] |  \- org.deeplearning4j:deeplearning4j-ui-components:jar:1.0.0-beta6:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.21:compile
[INFO] +- commons-cli:commons-cli:jar:1.2:compile
[INFO] +- org.deeplearning4j:arbiter-deeplearning4j:jar:1.0.0-beta6:compile
[INFO] |  +- org.deeplearning4j:arbiter-core:jar:1.0.0-beta6:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.8.0:compile
[INFO] +- org.deeplearning4j:arbiter-ui:jar:1.0.0-beta6:compile
[INFO] +- org.deeplearning4j:deeplearning4j-ui:jar:1.0.0-beta6:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-vertx:jar:1.0.0-beta6:compile
[INFO] |  |  +- io.vertx:vertx-core:jar:3.8.3:compile
[INFO] |  |  |  +- io.netty:netty-common:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-buffer:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-transport:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-handler:jar:4.1.42.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-codec:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-handler-proxy:jar:4.1.42.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-codec-socks:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-codec-http:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-codec-http2:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-resolver:jar:4.1.42.Final:compile
[INFO] |  |  |  +- io.netty:netty-resolver-dns:jar:4.1.42.Final:compile
[INFO] |  |  |  |  \- io.netty:netty-codec-dns:jar:4.1.42.Final:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.9.1:compile
[INFO] |  |  |     \- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  |  +- io.vertx:vertx-web:jar:3.8.3:compile
[INFO] |  |  |  +- io.vertx:vertx-web-common:jar:3.8.3:compile
[INFO] |  |  |  +- io.vertx:vertx-auth-common:jar:3.8.3:compile
[INFO] |  |  |  \- io.vertx:vertx-bridge-common:jar:3.8.3:compile
[INFO] |  |  +- com.beust:jcommander:jar:1.27:compile
[INFO] |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] |  |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] |  |  +- org.webjars.npm:babel__polyfill:jar:7.4.4:compile
[INFO] |  |  |  +- org.webjars.npm:core-js:jar:3.0.0-beta.9:compile (version selected from constraint [2.6.5,3))
[INFO] |  |  |  \- org.webjars.npm:regenerator-runtime:jar:0.13.4:compile (version selected from constraint [0.13.2,0.14))
[INFO] |  |  +- org.webjars.npm:coreui__coreui:jar:2.1.9:compile
[INFO] |  |  +- org.webjars.npm:coreui__icons:jar:0.3.0:compile
[INFO] |  |  +- org.webjars.npm:jquery:jar:3.4.1:compile
[INFO] |  |  +- org.webjars.bower:popper.js:jar:1.12.9:compile
[INFO] |  |  +- org.webjars.npm:bootstrap:jar:4.3.1:compile
[INFO] |  |  +- org.webjars:jquery:jar:2.2.0:compile
[INFO] |  |  +- org.webjars:jquery-migrate:jar:1.2.1:compile
[INFO] |  |  +- org.webjars:jquery-ui:jar:1.10.2:compile
[INFO] |  |  +- org.webjars:modernizr:jar:2.8.3-1:compile
[INFO] |  |  +- org.webjars:jquery-cookie:jar:1.4.1-1:compile
[INFO] |  |  +- org.webjars:fullcalendar:jar:1.6.4:compile
[INFO] |  |  +- org.webjars:excanvas:jar:3:compile
[INFO] |  |  +- org.webjars.npm:cytoscape:jar:3.3.3:compile
[INFO] |  |  |  +- org.webjars.npm:heap:jar:0.2.6:compile (version selected from constraint [0.2.6,0.3))
[INFO] |  |  |  \- org.webjars.npm:lodash.debounce:jar:4.0.8:compile (version selected from constraint [4.0.8,5))
[INFO] |  |  +- org.webjars.bower:cytoscape-dagre:jar:2.1.0:compile
[INFO] |  |  |  +- org.webjars.bower:cytoscape:jar:3.2.5:compile (version selected from constraint [3.2.0,4))
[INFO] |  |  |  \- org.webjars.bower:dagre:jar:0.7.4:compile (version selected from constraint [0.7.4,0.8))
[INFO] |  |  |     +- org.webjars.bower:graphlib:jar:1.0.7:compile (version selected from constraint [1.0.5,2))
[INFO] |  |  |     \- org.webjars.bower:lodash:jar:3.10.1-amd:compile (version selected from constraint [3.10.0,4))
[INFO] |  |  +- org.webjars.npm:dagre:jar:0.8.4:compile
[INFO] |  |  |  +- org.webjars.npm:graphlib:jar:2.1.8:compile (version selected from constraint [2.1.7,3))
[INFO] |  |  |  \- org.webjars.npm:lodash:jar:4.17.15:compile (version selected from constraint [4.17.4,5))
[INFO] |  |  +- org.webjars.npm:cytoscape-cola:jar:2.3.0:compile
[INFO] |  |  |  \- org.webjars.npm:webcola:jar:3.3.8:compile (version selected from constraint [3.3.6,4))
[INFO] |  |  |     +- org.webjars.npm:d3-dispatch:jar:1.0.6:compile (version selected from constraint [1.0.3,2))
[INFO] |  |  |     +- org.webjars.npm:d3-drag:jar:1.2.5:compile (version selected from constraint [1.0.4,2))
[INFO] |  |  |     |  \- org.webjars.npm:d3-selection:jar:2.0.0-rc.2:compile (version selected from constraint [1,2))
[INFO] |  |  |     \- org.webjars.npm:d3-timer:jar:1.0.10:compile (version selected from constraint [1.0.5,2))
[INFO] |  |  +- org.webjars.npm:cytoscape-cose-bilkent:jar:4.0.0:compile
[INFO] |  |  +- org.webjars.npm:cytoscape-euler:jar:1.2.1:compile
[INFO] |  |  +- org.webjars.npm:cytoscape-klay:jar:3.1.2:compile
[INFO] |  |  +- org.webjars.npm:klayjs:jar:0.4.1:compile
[INFO] |  |  +- org.webjars.npm:cytoscape-spread:jar:3.0.0:compile
[INFO] |  |  +- org.webjars.npm:weaverjs:jar:1.2.0:compile
[INFO] |  |  +- org.webjars:retinajs:jar:0.0.2:compile
[INFO] |  |  +- org.webjars:flot:jar:0.8.3:compile
[INFO] |  |  |  \- org.webjars:explorercanvas:jar:r3-1:compile
[INFO] |  |  +- org.webjars:chosen:jar:0.9.8:compile
[INFO] |  |  +- org.webjars:uniform:jar:2.1.2-1:compile
[INFO] |  |  +- org.webjars:noty:jar:2.2.2:compile
[INFO] |  |  +- org.webjars:jquery-raty:jar:2.5.2:compile
[INFO] |  |  +- org.webjars:imagesloaded:jar:2.1.1:compile
[INFO] |  |  +- org.webjars:masonry:jar:3.1.5:compile
[INFO] |  |  +- org.webjars:jquery.sparkline:jar:2.1.2:compile
[INFO] |  |  +- org.webjars:jquery-knob:jar:1.2.2:compile
[INFO] |  |  +- org.webjars:datatables:jar:1.9.4:compile
[INFO] |  |  +- org.webjars:jquery-ui-touch-punch:jar:0.2.2:compile
[INFO] |  |  +- org.webjars:d3js:jar:3.3.5:compile
[INFO] |  |  +- org.webjars:bootstrap-notify:jar:3.1.3-1:compile
[INFO] |  |  +- org.webjars.npm:github-com-jboesch-Gritter:jar:1.7.4:compile
[INFO] |  |  +- org.webjars.bowergithub.stenin-nikita:open-sans:jar:0.1.3:compile
[INFO] |  |  +- org.webjars:font-awesome:jar:3.0.2:compile
[INFO] |  |  |  \- org.webjars:bootstrap:jar:2.2.2-1:compile
[INFO] |  |  +- org.webjars:bootstrap-glyphicons:jar:bdd2cbfba0:compile
[INFO] |  |  \- org.webjars.npm:flatbuffers:jar:1.9.0:compile
[INFO] |  +- org.deeplearning4j:deeplearning4j-nlp:jar:1.0.0-beta6:compile
[INFO] |  |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |  +- org.threadly:threadly:jar:4.10.0:compile
[INFO] |  |  \- com.github.vinhkhuc:jfasttext:jar:0.4:compile
[INFO] |  +- org.nd4j:nd4j-jackson:jar:1.0.0-beta6:compile
[INFO] |  \- org.deeplearning4j:deeplearning4j-ui-model:jar:1.0.0-beta6:compile
[INFO] |     +- org.agrona:Agrona:jar:0.5.4:compile
[INFO] |     +- org.mapdb:mapdb:jar:3.0.5:compile
[INFO] |     |  +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.0.7:compile
[INFO] |     |  |  \- org.jetbrains.kotlin:kotlin-runtime:jar:1.0.7:compile
[INFO] |     |  +- org.eclipse.collections:eclipse-collections-api:jar:7.1.2:compile (version selected from constraint [7.0.0,7.20.0))
[INFO] |     |  |  \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] |     |  +- org.eclipse.collections:eclipse-collections:jar:7.1.2:compile (version selected from constraint [7.0.0,7.20.0))
[INFO] |     |  +- org.eclipse.collections:eclipse-collections-forkjoin:jar:7.1.2:compile (version selected from constraint [7.0.0,7.20.0))
[INFO] |     |  +- com.google.guava:guava:jar:19.0:compile (version selected from constraint [15.0,19.20))
[INFO] |     |  +- net.jpountz.lz4:lz4:jar:1.3.0:compile
[INFO] |     |  \- org.mapdb:elsa:jar:3.0.0-M5:compile
[INFO] |     \- org.xerial:sqlite-jdbc:jar:3.15.1:compile
[INFO] +- org.apache.commons:commons-csv:jar:1.8:compile
[INFO] +- org.jfree:jfreechart:jar:1.0.19:compile
[INFO] |  \- org.jfree:jcommon:jar:1.0.23:compile
[INFO] \- org.postgresql:postgresql:jar:42.2.10:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.764 s
[INFO] Finished at: 2020-02-27T01:39:52+06:00
[INFO] ------------------------------------------------------------------------

No, this dependency should instead look like this:

<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>1.0.0-beta6</version>
  <classifier>macosx-x86_64-avx2</classifier>
</dependency>

That is what the -platform artifacts will add so it runs on all the supported platforms.

Anyway, does it work now with the dependencyManagement section added?

What have I done wrong?)

Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.deeplearning4j.nn.conf.MultiLayerConfiguration$Builder.build(MultiLayerConfiguration.java:719)
	at org.deeplearning4j.nn.conf.NeuralNetConfiguration$ListBuilder.build(NeuralNetConfiguration.java:258)
	at ml.Trainer.main(Trainer.java:97)
Caused by: java.lang.RuntimeException: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
	at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5131)
	at org.nd4j.linalg.factory.Nd4j.<clinit>(Nd4j.java:226)
	... 3 more
Caused by: org.nd4j.linalg.factory.Nd4jBackend$NoAvailableBackendException: Please ensure that you have an nd4j backend on your classpath. Please see: http://nd4j.org/getstarted.html
	at org.nd4j.linalg.factory.Nd4jBackend.load(Nd4jBackend.java:218)
	at org.nd4j.linalg.factory.Nd4j.initContext(Nd4j.java:5128)
	... 4 more

I think we are getting ahead of ourselves now. Let’s fix one problem at a time.

Let’s work on the AVX2 classifier thing after we solved your UI problem. So please leave your pom.xml just as it was when it worked and only add the <dependencyManagement> section as I’ve indicated in the previous post (at the same level as the <dependencies> section is).

I returned the previous dependency and now UI server is working

Great :+1:. Now for your AVX2 problem:

If you want to deploy your application on a server and use AVX2 on your mac, you should have both of those dependencies:

<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>1.0.0-beta6</version>
  <classifier>macosx-x86_64-avx2</classifier>
</dependency>
<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native-platform</artifactId>
  <version>1.0.0-beta6</version>
</dependency>

thanks a lot. when I deploy the application to the server I can use native-platform dependency right