OreillyのDl4J exampleは、コマンドラインからMavenでコンパイルしてシェルスクリプトから動かそうとしても、そのままではClass Pathの問題か、57個のexamplesのうち、MLPClassifierSaturnなんかは、以下のように、どうしてもテcsvキストファイル読み込みで失敗してしまう。ちょっとした設定のバグだろうけど。。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
MacBook-Pro-5:oreilly-book-dl4j-examples-master $ ./runexamples.sh [ 1] org.deeplearning4j.examples.misc.customlayers.CustomLayerExample [ 2] org.deeplearning4j.examples.misc.externalerrors.MultiLayerNetworkExternalErrors [ 3] org.deeplearning4j.examples.misc.activationfunctions.CustomActivationExample [ 4] org.deeplearning4j.examples.misc.modelsaving.SaveLoadComputationGraph [ 5] org.deeplearning4j.examples.misc.modelsaving.SaveLoadMultiLayerNetwork [ 6] org.deeplearning4j.examples.misc.lossfunctions.CustomLossExample [ 7] org.deeplearning4j.examples.misc.presave.PreSave [ 8] org.deeplearning4j.examples.misc.presave.LoadPreSavedLenetMnistExample [ 9] org.deeplearning4j.examples.misc.earlystopping.EarlyStoppingMNIST [10] org.deeplearning4j.examples.unsupervised.variational.VariationalAutoEncoderExample [11] org.deeplearning4j.examples.unsupervised.deepbelief.DeepAutoEncoderExample [12] org.deeplearning4j.examples.feedforward.mnist.MLPMnistTwoLayerExample [13] org.deeplearning4j.examples.feedforward.mnist.MLPMnistSingleLayerExample [14] org.deeplearning4j.examples.feedforward.classification.MLPClassifierLinear [15] org.deeplearning4j.examples.feedforward.classification.detectgender.PredictGenderTest [16] org.deeplearning4j.examples.feedforward.classification.detectgender.PredictGenderTrain [17] org.deeplearning4j.examples.feedforward.classification.MLPClassifierSaturn [18] org.deeplearning4j.examples.feedforward.classification.MLPClassifierMoon [19] org.deeplearning4j.examples.feedforward.xor.XorExample [20] org.deeplearning4j.examples.feedforward.anomalydetection.MNISTAnomalyExample [21] org.deeplearning4j.examples.feedforward.regression.RegressionMathFunctions [22] org.deeplearning4j.examples.feedforward.regression.RegressionSum [23] org.deeplearning4j.examples.dataExamples.BasicCSVClassifier [24] org.deeplearning4j.examples.dataExamples.CSVExampleEvaluationMetaData [25] org.deeplearning4j.examples.dataExamples.ImageDrawer [26] org.deeplearning4j.examples.dataExamples.CSVExample [27] org.deeplearning4j.examples.dataExamples.MnistImagePipelineExampleLoad [28] org.deeplearning4j.examples.dataExamples.MnistImagePipelineExampleAddNeuralNet [29] org.deeplearning4j.examples.dataExamples.CSVPlotter [30] org.deeplearning4j.examples.dataExamples.MnistImagePipelineExample [31] org.deeplearning4j.examples.dataExamples.MnistImagePipelineLoadChooser [32] org.deeplearning4j.examples.dataExamples.MnistImagePipelineExampleSave [33] org.deeplearning4j.examples.dataExamples.PreprocessNormalizerExample [34] org.deeplearning4j.examples.dataExamples.ImagePipelineExample [35] org.deeplearning4j.examples.recurrent.video.VideoClassificationExample [36] org.deeplearning4j.examples.recurrent.character.GravesLSTMCharModellingExample [37] org.deeplearning4j.examples.recurrent.character.CompGraphLSTMExample [38] org.deeplearning4j.examples.recurrent.basic.BasicRNNExample [39] org.deeplearning4j.examples.recurrent.word2vecsentiment.Word2VecSentimentRNN [40] org.deeplearning4j.examples.recurrent.seqClassification.UCISequenceClassificationExample [41] org.deeplearning4j.examples.recurrent.seq2seq.AdditionRNN [42] org.deeplearning4j.examples.recurrent.regression.SingleTimestepRegressionExample [43] org.deeplearning4j.examples.recurrent.regression.MultiTimestepRegressionExample [44] org.deeplearning4j.examples.nlp.word2vec.Word2VecUptrainingExample [45] org.deeplearning4j.examples.nlp.word2vec.Word2VecRawTextExample [46] org.deeplearning4j.examples.nlp.sequencevectors.SequenceVectorsTextExample [47] org.deeplearning4j.examples.nlp.tsne.TSNEStandardExample [48] org.deeplearning4j.examples.nlp.glove.GloVeExample [49] org.deeplearning4j.examples.nlp.paragraphvectors.ParagraphVectorsClassifierExample [50] org.deeplearning4j.examples.nlp.paragraphvectors.ParagraphVectorsInferenceExample [51] org.deeplearning4j.examples.nlp.paragraphvectors.ParagraphVectorsTextExample [52] org.deeplearning4j.examples.userInterface.UIStorageExample_Java7 [53] org.deeplearning4j.examples.userInterface.UIStorageExample [54] org.deeplearning4j.examples.userInterface.RemoteUIExample [55] org.deeplearning4j.examples.userInterface.UIExample [56] org.deeplearning4j.examples.convolution.AnimalsClassification [57] org.deeplearning4j.examples.convolution.LenetMnistExample Enter a number for the example to run: 17 ====== org.deeplearning4j.examples.feedforward.classification.MLPClassifierSaturn o.n.l.f.Nd4jBackend - Loaded [CpuBackend] backend o.n.n.NativeOpsHolder - Number of threads used for NativeOps: 4 Exception in thread "main" java.io.FileNotFoundException: class path resource [classification/saturn_data_train.csv] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/Users/****/oreilly-book-dl4j-examples-master/dl4j-examples/target/dl4j-examples-0.7-SNAPSHOT-bin.jar!/classification/saturn_data_train.csv at org.nd4j.linalg.io.ResourceUtils.getFile(ResourceUtils.java:93) at org.nd4j.linalg.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:18) at org.deeplearning4j.examples.feedforward.classification.MLPClassifierSaturn.main(MLPClassifierSaturn.java:52) |
一方、IntelliJ IDEAでは問題なく作動する。
では、Dl4Jサイトのexampleで、Mavenコンパイルで動くかどうか確かめてみると、106のexamplesが作動しそう。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
MacBook-Pro-5:dl4j-examples $ ./runexamples.sh [ 1] org.deeplearning4j.examples.misc.customlayers.CustomLayerExample [ 2] org.deeplearning4j.examples.misc.WeightedLossFunctionExample [ 3] org.deeplearning4j.examples.misc.externalerrors.MultiLayerNetworkExternalErrors [ 4] org.deeplearning4j.examples.misc.activationfunctions.CustomActivationExample [ 5] org.deeplearning4j.examples.misc.embedding.RNNEmbedding [ 6] org.deeplearning4j.examples.misc.modelsaving.SaveLoadComputationGraph [ 7] org.deeplearning4j.examples.misc.modelsaving.SaveLoadMultiLayerNetwork [ 8] org.deeplearning4j.examples.misc.lossfunctions.GaussianMixtureIterator [ 9] org.deeplearning4j.examples.misc.lossfunctions.MixtureDensityNetwork [10] org.deeplearning4j.examples.misc.lossfunctions.CustomLossExample [11] org.deeplearning4j.examples.misc.presave.PreSave [12] org.deeplearning4j.examples.misc.presave.LoadPreSavedLenetMnistExample [13] org.deeplearning4j.examples.misc.centerloss.CenterLossLenetMnistExample [14] org.deeplearning4j.examples.misc.earlystopping.EarlyStoppingMNIST [15] org.deeplearning4j.examples.samediff.Ex2LambdaLayer [16] org.deeplearning4j.examples.samediff.Ex1BasicSameDiffLayerExample [17] org.deeplearning4j.examples.samediff.Ex3LambdaVertex [18] org.deeplearning4j.examples.unsupervised.anomalydetection.AEMNISTAnomalyDectection [19] org.deeplearning4j.examples.unsupervised.anomalydetection.ImageWithByteUtil [20] org.deeplearning4j.examples.unsupervised.sequenceanomalydetection.SequenceAnomalyDetection [21] org.deeplearning4j.examples.unsupervised.variational.VariationalAutoEncoderExample [22] org.deeplearning4j.examples.styletransfer.NeuralStyleTransfer [23] org.deeplearning4j.examples.feedforward.mnist.MLPMnistTwoLayerExample [24] org.deeplearning4j.examples.feedforward.mnist.MLPMnistSingleLayerExample [25] org.deeplearning4j.examples.feedforward.classification.MLPClassifierLinear [26] org.deeplearning4j.examples.feedforward.classification.detectgender.PredictGenderTest [27] org.deeplearning4j.examples.feedforward.classification.detectgender.PredictGenderTrain [28] org.deeplearning4j.examples.feedforward.classification.MLPClassifierSaturn [29] org.deeplearning4j.examples.feedforward.classification.MLPClassifierMoon [30] org.deeplearning4j.examples.feedforward.xor.XorExample [31] org.deeplearning4j.examples.feedforward.anomalydetection.MNISTAnomalyExample [32] org.deeplearning4j.examples.feedforward.anomalydetection.VaeMNISTAnomaly [33] org.deeplearning4j.examples.feedforward.regression.RegressionMathFunctions [34] org.deeplearning4j.examples.feedforward.regression.RegressionSum [35] org.deeplearning4j.examples.dataexamples.MapFileConversion [36] org.deeplearning4j.examples.dataexamples.BasicCSVClassifier [37] org.deeplearning4j.examples.dataexamples.CSVExampleEvaluationMetaData [38] org.deeplearning4j.examples.dataexamples.MultiClassLogit [39] org.deeplearning4j.examples.dataexamples.ImageDrawer [40] org.deeplearning4j.examples.dataexamples.CSVExample [41] org.deeplearning4j.examples.dataexamples.MnistImagePipelineExampleLoad [42] org.deeplearning4j.examples.dataexamples.SVMLightExample [43] org.deeplearning4j.examples.dataexamples.MnistImagePipelineExampleAddNeuralNet [44] org.deeplearning4j.examples.dataexamples.CSVPlotter [45] org.deeplearning4j.examples.dataexamples.MnistImagePipelineExample [46] org.deeplearning4j.examples.dataexamples.MnistImagePipelineLoadChooser [47] org.deeplearning4j.examples.dataexamples.MnistImagePipelineExampleSave [48] org.deeplearning4j.examples.dataexamples.PreprocessNormalizerExample [49] org.deeplearning4j.examples.dataexamples.ImagePipelineExample [50] org.deeplearning4j.examples.tictactoe.TicTacToeGameTrainer [51] org.deeplearning4j.examples.tictactoe.TicTacToeData [52] org.deeplearning4j.examples.tictactoe.PlayTicTacToe [53] org.deeplearning4j.examples.recurrent.video.VideoClassificationExample [54] org.deeplearning4j.examples.recurrent.processnews.TestNews [55] org.deeplearning4j.examples.recurrent.processnews.PrepareWordVector [56] org.deeplearning4j.examples.recurrent.processnews.TrainNews [57] org.deeplearning4j.examples.recurrent.character.LSTMCharModellingExample [58] org.deeplearning4j.examples.recurrent.character.CompGraphLSTMExample [59] org.deeplearning4j.examples.recurrent.character.melodl4j.MidiMelodyExtractor [60] org.deeplearning4j.examples.recurrent.character.melodl4j.PlayMelodyStrings [61] org.deeplearning4j.examples.recurrent.character.melodl4j.MelodyModelingExample [62] org.deeplearning4j.examples.recurrent.character.harmonies.Midi2WavRenderer [63] org.deeplearning4j.examples.recurrent.character.harmonies.DeepHarmony [64] org.deeplearning4j.examples.recurrent.character.harmonies.MidiMusicExtractor [65] org.deeplearning4j.examples.recurrent.character.harmonies.PermuteLines [66] org.deeplearning4j.examples.recurrent.character.harmonies.GravesLSTMForTwoPartHarmonies [67] org.deeplearning4j.examples.recurrent.character.harmonies.PlayMusic [68] org.deeplearning4j.examples.recurrent.character.harmonies.PlayTwoPartHarmonies [69] org.deeplearning4j.examples.recurrent.encdec.EncoderDecoderLSTM [70] org.deeplearning4j.examples.recurrent.basic.BasicRNNExample [71] org.deeplearning4j.examples.recurrent.processlottery.TrainLotteryModel [72] org.deeplearning4j.examples.recurrent.word2vecsentiment.Word2VecSentimentRNN [73] org.deeplearning4j.examples.recurrent.seqclassification.UCISequenceClassificationExample [74] org.deeplearning4j.examples.recurrent.seq2seq.AdditionRNN [75] org.deeplearning4j.examples.modelimport.keras.basic.SimpleFunctionalMlpImport [76] org.deeplearning4j.examples.modelimport.keras.basic.SimpleSequentialMlpImport [77] org.deeplearning4j.examples.modelimport.tensorflow.LoadTensorFlowMNISTMLP [78] org.deeplearning4j.examples.arbiter.BasicHyperparameterOptimizationExample [79] org.deeplearning4j.examples.nlp.word2vec.Word2VecUptrainingExample [80] org.deeplearning4j.examples.nlp.word2vec.Word2VecRawTextExample [81] org.deeplearning4j.examples.nlp.sequencevectors.SequenceVectorsTextExample [82] org.deeplearning4j.examples.nlp.tsne.TSNEStandardExample [83] org.deeplearning4j.examples.nlp.glove.GloVeExample [84] org.deeplearning4j.examples.nlp.paragraphvectors.ParagraphVectorsClassifierExample [85] org.deeplearning4j.examples.nlp.paragraphvectors.ParagraphVectorsInferenceExample [86] org.deeplearning4j.examples.nlp.paragraphvectors.ParagraphVectorsTextExample [87] org.deeplearning4j.examples.inference.ParallelInferenceExample [88] org.deeplearning4j.examples.userInterface.UIStorageExample_Java7 [89] org.deeplearning4j.examples.userInterface.UIStorageExample [90] org.deeplearning4j.examples.userInterface.RemoteUIExample [91] org.deeplearning4j.examples.userInterface.GradientsAndParamsListenerExample [92] org.deeplearning4j.examples.userInterface.ActivationsListenerExample [93] org.deeplearning4j.examples.userInterface.UIExample [94] org.deeplearning4j.examples.convolution.mnist.MnistClassifierUI [95] org.deeplearning4j.examples.convolution.mnist.MnistClassifier [96] org.deeplearning4j.examples.convolution.sentenceclassification.CnnSentenceClassificationExample [97] org.deeplearning4j.examples.convolution.captcharecognition.MultiDigitNumberRecognition [98] org.deeplearning4j.examples.convolution.AnimalsClassification [99] org.deeplearning4j.examples.convolution.objectdetection.HouseNumberDetection [100] org.deeplearning4j.examples.convolution.Cifar [101] org.deeplearning4j.examples.convolution.LenetMnistExample [102] org.deeplearning4j.examples.transferlearning.vgg16.dataHelpers.FeaturizedPreSave [103] org.deeplearning4j.examples.transferlearning.vgg16.EditLastLayerOthersFrozen [104] org.deeplearning4j.examples.transferlearning.vgg16.EditAtBottleneckOthersFrozen [105] org.deeplearning4j.examples.transferlearning.vgg16.FitFromFeaturized [106] org.deeplearning4j.examples.transferlearning.vgg16.FineTuneFromBlockFour Enter a number for the example to run (q to quit): 28 ====== org.deeplearning4j.examples.feedforward.classification.MLPClassifierSaturn o.n.l.f.Nd4jBackend - Loaded [CpuBackend] backend o.n.n.NativeOpsHolder - Number of threads used for NativeOps: 2 o.n.n.Nd4jBlas - Number of threads used for BLAS: 2 o.n.l.a.o.e.DefaultOpExecutioner - Backend used: [CPU]; OS: [Mac OS X] o.n.l.a.o.e.DefaultOpExecutioner - Cores: [4]; Memory: [3.6GB]; o.n.l.a.o.e.DefaultOpExecutioner - Blas vendor: [MKL] o.d.n.m.MultiLayerNetwork - Starting MultiLayerNetwork with WorkspaceModes set to [training: ENABLED; inference: ENABLED], cacheMode set to [NONE] o.d.o.l.ScoreIterationListener - Score at iteration 0 is 1.9500187683105468 o.d.o.l.ScoreIterationListener - Score at iteration 10 is 0.47902397155761717 o.d.o.l.ScoreIterationListener - Score at iteration 20 is 0.4332705307006836 o.d.o.l.ScoreIterationListener - Score at iteration 30 is 0.35533203125 o.d.o.l.ScoreIterationListener - Score at iteration 40 is 0.33340709686279296 o.d.o.l.ScoreIterationListener - Score at iteration 50 is 0.28069318771362306 o.d.o.l.ScoreIterationListener - Score at iteration 60 is 0.2507776260375977 o.d.o.l.ScoreIterationListener - Score at iteration 70 is 0.22958843231201173 o.d.o.l.ScoreIterationListener - Score at iteration 80 is 0.20769371032714845 o.d.o.l.ScoreIterationListener - Score at iteration 90 is 0.18703662872314453 o.d.o.l.ScoreIterationListener - Score at iteration 100 is 0.1702655792236328 o.d.o.l.ScoreIterationListener - Score at iteration 110 is 0.15359703063964844 o.d.o.l.ScoreIterationListener - Score at iteration 120 is 0.1393386936187744 o.d.o.l.ScoreIterationListener - Score at iteration 130 is 0.1273832130432129 o.d.o.l.ScoreIterationListener - Score at iteration 140 is 0.11750238418579101 o.d.o.l.ScoreIterationListener - Score at iteration 150 is 0.10899881362915038 o.d.o.l.ScoreIterationListener - Score at iteration 160 is 0.10126865386962891 o.d.o.l.ScoreIterationListener - Score at iteration 170 is 0.09462858200073242 o.d.o.l.ScoreIterationListener - Score at iteration 180 is 0.08949141502380371 o.d.o.l.ScoreIterationListener - Score at iteration 190 is 0.0847533416748047 o.d.o.l.ScoreIterationListener - Score at iteration 200 is 0.08022193908691407 o.d.o.l.ScoreIterationListener - Score at iteration 210 is 0.07611659049987793 o.d.o.l.ScoreIterationListener - Score at iteration 220 is 0.07241389751434327 o.d.o.l.ScoreIterationListener - Score at iteration 230 is 0.06901486396789551 o.d.o.l.ScoreIterationListener - Score at iteration 240 is 0.06586883068084717 o.d.o.l.ScoreIterationListener - Score at iteration 250 is 0.06298436164855957 o.d.o.l.ScoreIterationListener - Score at iteration 260 is 0.06032959938049316 o.d.o.l.ScoreIterationListener - Score at iteration 270 is 0.057864933013916015 o.d.o.l.ScoreIterationListener - Score at iteration 280 is 0.05555350303649902 o.d.o.l.ScoreIterationListener - Score at iteration 290 is 0.05335599899291992 Evaluate model.... ========================Evaluation Metrics======================== # of classes: 2 Accuracy: 1.0000 Precision: 1.0000 Recall: 1.0000 F1 Score: 1.0000 Precision, recall & F1: reported for positive class (class 1 - "1") only =========================Confusion Matrix========================= 0 1 ------- 48 0 | 0 = 0 0 52 | 1 = 1 Confusion matrix format: Actual (rowClass) predicted as (columnClass) N times ================================================================== ****************Example finished******************** |