{"id":557,"date":"2018-09-17T21:31:32","date_gmt":"2018-09-17T19:31:32","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=557"},"modified":"2020-11-21T22:22:51","modified_gmt":"2020-11-21T21:22:51","slug":"deeplearing4j-iris-classification-example","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/","title":{"rendered":"Deeplearning4j &#8211; Iris Classification Example"},"content":{"rendered":"<p>I am a big fan of <a href=\"https:\/\/keras.io\/)\">Keras<\/a> &#8211; Fortunately we also have a similar framework available when we need to implement a solution which works in the JVM: <a href=\"https:\/\/deeplearning4j.org\/\">DeepLearning4J<\/a>. In this Blog I give a quick introduction of some of the key concepts which are needed to get started. I am using the Iris dataset to demonstrate the classification of data with the help of a neural network.<\/p>\n<p>This demo has been implemented in Scala using Jupyter (<a href=\"http:\/\/beakerx.com\/\">http:\/\/beakerx.com\/<\/a>).<\/p>\n<h3>Maven Dependencies<\/h3>\n<p>In order to use the functionality we need the<br \/>\n&#8211; deeplearning4j-core<br \/>\n&#8211; nd4j (which is used for the underlying data model)<\/p>\n<pre><code class=\"Scala\">%%classpath add mvn \norg.deeplearning4j:deeplearning4j-core:1.0.0-beta2\norg.nd4j:nd4j-native-platform:1.0.0-beta2\n\n<\/code><\/pre>\n<h3>Imports<\/h3>\n<p>I am importing all the classes which are used in the subsequent example:<\/p>\n<pre><code class=\"Scala\">import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator\nimport org.deeplearning4j.datasets.datavec._\nimport org.deeplearning4j.eval._\nimport org.deeplearning4j.nn.conf._\nimport org.deeplearning4j.nn.conf.inputs.InputType\nimport org.deeplearning4j.nn.conf.layers._\nimport org.deeplearning4j.nn.multilayer.MultiLayerNetwork\nimport org.deeplearning4j.nn.weights.WeightInit\nimport org.deeplearning4j.optimize.listeners.ScoreIterationListener\nimport org.deeplearning4j.evaluation._\n\nimport org.nd4j.linalg.activations.Activation\nimport org.nd4j.linalg.dataset.api.iterator.DataSetIterator\nimport org.nd4j.linalg.learning.config.Nesterovs\nimport org.nd4j.linalg.lossfunctions.LossFunctions\nimport org.nd4j.linalg.dataset.api.preprocessor._\nimport org.nd4j.linalg.learning.config._\n\nimport org.datavec.api.records.reader.impl.csv._\nimport org.datavec.api.split._\nimport org.datavec.api.transform.schema.InferredSchema\nimport org.datavec.api.transform.TransformProcess\nimport org.datavec.api.records.reader.impl.transform.TransformProcessRecordReader\nimport org.datavec.api.transform.schema.Schema\n\nimport java.util.Arrays\n\n\n<\/code><\/pre>\n<pre><code>import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator\nimport org.deeplearning4j.datasets.datavec._\nimport org.deeplearning4j.eval._\nimport org.deeplearning4j.nn.conf._\nimport org.deeplearning4j.nn.conf.inputs.InputType\nimport org.deeplearning4j.nn.conf.layers._\nimport org.deeplearning4j.nn.multilayer.MultiLayerNetwork\nimport org.deeplearning4j.nn.weights.WeightInit\nimport org.deeplearning4j.optimize.listeners.ScoreIterationListener\nimport org.deeplearning4j.evaluation._\nimport org.nd4j.linalg.activations.Activation\nimport org.nd4j.linalg.dataset.api.iterator.DataSetIterator\nimport org.nd4j.linalg.learning.config.Nesterovs\nimport org.nd4j.linalg.lossfunctions.LossFunctions\nimport org.nd4j.linalg.dataset.api.preprocessor._\nimport org.nd4j.linalg.learning.config._\nimport or...\n<\/code><\/pre>\n<h3>Data Input<\/h3>\n<p>We could directly use the IrisDataSetIterator which has been provided by DL4J. I prefer however to demo how to build on data which is available on the Internet: <a href=\"https:\/\/gist.githubusercontent.com\/netj\/8836201\/raw\/6f9306ad21398ea43cba4f7d537619d0e07d5ae3\/iris.csv\">Iris Data Set<\/a><\/p>\n<p>If the data is in CSV we can use the CSVRecordReader to load the data. Unfortunatly the content of the loaded file can only contain Numbers: Strings or Booleans (true, false) are not supported.<\/p>\n<p>DataVec (DL4J) can be used to perform the necessary conversions. This is usually done with<br \/>\nthe help of Spark. We need to have a Schema defined: If the data is available as CSV file the schema can be inferred with the help of new InferredSchema(file).build().<\/p>\n<pre><code class=\"Scala\">var dataUrl = \"https:\/\/gist.githubusercontent.com\/netj\/8836201\/raw\/6f9306ad21398ea43cba4f7d537619d0e07d5ae3\/iris.csv\"\nvar numLinesToSkip = 1\nvar delimiter = ','\nvar csvReader = new CSVRecordReader(numLinesToSkip, delimiter)\n\n<\/code><\/pre>\n<pre><code>org.datavec.api.records.reader.impl.csv.CSVRecordReader@3a192152\n<\/code><\/pre>\n<p>We can not load this data directly because it contains the variety column as strings.<\/p>\n<p>The schema inferral does not work in this case because we have no file so we need to set up the schema from scratch.<\/p>\n<p>Then we can define a TransformProcess to convert the variety fields into numbers and finally we use the TransformProcessRecordReader in order to load the converted data.<\/p>\n<pre><code class=\"Scala\">var schema = new Schema.Builder()\n    .addColumnDouble(\"sepal.length\")\n    .addColumnDouble(\"sepal.width\")\n    .addColumnDouble(\"petal.length\")\n    .addColumnDouble(\"petal.width\")\n    .addColumnCategorical(\"variety\", Arrays.asList(\"Setosa\",\"Versicolor\",\"Virginica\"))\n    .build();\n\nvar tp = new TransformProcess.Builder(schema)\n    .categoricalToInteger(\"variety\")                            \n    .build()\n\nvar inputStream = new java.net.URL(dataUrl).openStream()\ncsvReader.initialize(new InputStreamInputSplit(inputStream))\nvar tpReader = new TransformProcessRecordReader(csvReader, tp)\n\n<\/code><\/pre>\n<pre><code>org.datavec.api.records.reader.impl.transform.TransformProcessRecordReader@1645db61\n<\/code><\/pre>\n<p>Now we can load the data, shuffle it and split it into a training and test set.<\/p>\n<pre><code class=\"Scala\">var labelIndex = 4     \/\/5 values in each row of the iris.txt CSV: 4 input features followed by an integer label (class) index. Labels are the 5th value (index 4) in each row\nvar numClasses = 3     \/\/3 classes (types of iris flowers) in the iris data set. Classes have integer values 0, 1 or 2\nvar batchSize = 150    \/\/Iris data set: 150 examples total. We are loading all of them into one DataSet (not recommended for large data sets)\n\nvar iterator = new RecordReaderDataSetIterator(tpReader, batchSize,labelIndex,numClasses)\nvar allData = iterator.next()\nallData.shuffle()\n\nvar testAndTrain = allData.splitTestAndTrain(0.90)  \/\/Use 85% of data for training\nvar testData = testAndTrain.getTest()\nvar trainingData = testAndTrain.getTrain()\n\n<\/code><\/pre>\n<pre><code>===========INPUT===================\n[[    4.6000,    3.2000,    1.4000,    0.2000], \n [    6.8000,    2.8000,    4.8000,    1.4000], \n [    6.6000,    3.0000,    4.4000,    1.4000], \n [    6.8000,    3.0000,    5.5000,    2.1000], \n [    5.9000,    3.0000,    4.2000,    1.5000], \n [    4.6000,    3.6000,    1.0000,    0.2000], \n [    7.2000,    3.0000,    5.8000,    1.6000], \n [    4.4000,    2.9000,    1.4000,    0.2000], \n [    5.0000,    3.4000,    1.5000,    0.2000], \n [    6.2000,    2.8000,    4.8000,    1.8000], \n [    5.5000,    2.5000,    4.0000,    1.3000], \n [    5.5000,    3.5000,    1.3000,    0.2000], \n [    5.7000,    4.4000,    1.5000,    0.4000], \n [    5.6000,    3.0000,    4.1000,    1.3000], \n [    5.7000,    2.8000,    4.5000,    1.3000], \n [    4.8000,    3.0000,    1.4000,    0.1000], \n [    6.3000,    2.8000,    5.1000,    1.5000], \n [    5.8000,    2.8000,    5.1000,    2.4000], \n [    5.6000,    2.5000,    3.9000,    1.1000], \n [    6.3000,    3.4000,    5.6000,    2.4000], \n [    5.8000,    2.7000,    5.1000,    1.9000], \n [    6.4000,    2.8000,    5.6000,    2.1000], \n [    5.4000,    3.9000,    1.7000,    0.4000], \n [    4.9000,    3.1000,    1.5000,    0.2000], \n [    7.3000,    2.9000,    6.3000,    1.8000], \n [    5.1000,    3.8000,    1.6000,    0.2000], \n [    6.3000,    2.9000,    5.6000,    1.8000], \n [    6.3000,    3.3000,    6.0000,    2.5000], \n [    6.4000,    3.2000,    5.3000,    2.3000], \n [    5.9000,    3.2000,    4.8000,    1.8000], \n [    7.7000,    3.8000,    6.7000,    2.2000], \n [    6.9000,    3.2000,    5.7000,    2.3000], \n [    7.2000,    3.6000,    6.1000,    2.5000], \n [    7.1000,    3.0000,    5.9000,    2.1000], \n [    5.1000,    3.3000,    1.7000,    0.5000], \n [    6.7000,    3.3000,    5.7000,    2.5000], \n [    4.8000,    3.4000,    1.6000,    0.2000], \n [    5.6000,    3.0000,    4.5000,    1.5000], \n [    5.7000,    2.5000,    5.0000,    2.0000], \n [    7.7000,    2.8000,    6.7000,    2.0000], \n [    6.4000,    3.1000,    5.5000,    1.8000], \n [    5.5000,    2.4000,    3.8000,    1.1000], \n [    6.1000,    2.9000,    4.7000,    1.4000], \n [    6.7000,    3.1000,    4.7000,    1.5000], \n [    6.3000,    2.3000,    4.4000,    1.3000], \n [    6.2000,    2.2000,    4.5000,    1.5000], \n [    5.0000,    3.0000,    1.6000,    0.2000], \n [    5.1000,    3.5000,    1.4000,    0.2000], \n [    6.1000,    2.8000,    4.0000,    1.3000], \n [    6.1000,    2.6000,    5.6000,    1.4000], \n [    6.0000,    2.7000,    5.1000,    1.6000], \n [    6.0000,    2.9000,    4.5000,    1.5000], \n [    6.3000,    2.7000,    4.9000,    1.8000], \n [    6.6000,    2.9000,    4.6000,    1.3000], \n [    5.7000,    3.0000,    4.2000,    1.2000], \n [    5.8000,    4.0000,    1.2000,    0.2000], \n [    6.8000,    3.2000,    5.9000,    2.3000], \n [    6.7000,    2.5000,    5.8000,    1.8000], \n [    5.5000,    2.3000,    4.0000,    1.3000], \n [    6.7000,    3.3000,    5.7000,    2.1000], \n [    7.9000,    3.8000,    6.4000,    2.0000], \n [    5.0000,    3.6000,    1.4000,    0.2000], \n [    5.7000,    2.6000,    3.5000,    1.0000], \n [    4.4000,    3.2000,    1.3000,    0.2000], \n [    6.9000,    3.1000,    5.4000,    2.1000], \n [    6.5000,    3.0000,    5.5000,    1.8000], \n [    4.9000,    3.6000,    1.4000,    0.1000], \n [    6.5000,    3.2000,    5.1000,    2.0000], \n [    4.8000,    3.0000,    1.4000,    0.3000], \n [    5.7000,    3.8000,    1.7000,    0.3000], \n [    4.7000,    3.2000,    1.6000,    0.2000], \n [    5.3000,    3.7000,    1.5000,    0.2000], \n [    6.1000,    2.8000,    4.7000,    1.2000], \n [    6.3000,    2.5000,    4.9000,    1.5000], \n [    5.6000,    2.8000,    4.9000,    2.0000], \n [    4.7000,    3.2000,    1.3000,    0.2000], \n [    4.9000,    3.0000,    1.4000,    0.2000], \n [    7.4000,    2.8000,    6.1000,    1.9000], \n [    6.4000,    3.2000,    4.5000,    1.5000], \n [    6.0000,    2.2000,    4.0000,    1.0000], \n [    4.5000,    2.3000,    1.3000,    0.3000], \n [    4.9000,    2.5000,    4.5000,    1.7000], \n [    5.9000,    3.0000,    5.1000,    1.8000], \n [    7.0000,    3.2000,    4.7000,    1.4000], \n [    6.5000,    3.0000,    5.2000,    2.0000], \n [    5.6000,    2.7000,    4.2000,    1.3000], \n [    5.0000,    3.5000,    1.6000,    0.6000], \n [    5.1000,    3.8000,    1.9000,    0.4000], \n [    4.3000,    3.0000,    1.1000,    0.1000], \n [    5.4000,    3.7000,    1.5000,    0.2000], \n [    6.4000,    2.7000,    5.3000,    1.9000], \n [    5.7000,    2.9000,    4.2000,    1.3000], \n [    5.0000,    2.3000,    3.3000,    1.0000], \n [    5.8000,    2.6000,    4.0000,    1.2000], \n [    6.0000,    3.4000,    4.5000,    1.6000], \n [    6.5000,    2.8000,    4.6000,    1.5000], \n [    6.1000,    3.0000,    4.6000,    1.4000], \n [    6.5000,    3.0000,    5.8000,    2.2000], \n [    7.2000,    3.2000,    6.0000,    1.8000], \n [    6.0000,    3.0000,    4.8000,    1.8000], \n [    5.2000,    3.5000,    1.5000,    0.2000], \n [    5.4000,    3.4000,    1.7000,    0.2000], \n [    5.5000,    4.2000,    1.4000,    0.2000], \n [    5.0000,    3.4000,    1.6000,    0.4000], \n [    6.2000,    2.9000,    4.3000,    1.3000], \n [    6.4000,    2.8000,    5.6000,    2.2000], \n [    5.5000,    2.4000,    3.7000,    1.0000], \n [    4.8000,    3.4000,    1.9000,    0.2000], \n [    4.9000,    2.4000,    3.3000,    1.0000], \n [    5.2000,    4.1000,    1.5000,    0.1000], \n [    5.8000,    2.7000,    4.1000,    1.0000], \n [    5.5000,    2.6000,    4.4000,    1.2000], \n [    4.6000,    3.1000,    1.5000,    0.2000], \n [    4.4000,    3.0000,    1.3000,    0.2000], \n [    5.1000,    3.5000,    1.4000,    0.3000], \n [    5.2000,    3.4000,    1.4000,    0.2000], \n [    6.7000,    3.1000,    4.4000,    1.4000], \n [    4.8000,    3.1000,    1.6000,    0.2000], \n [    6.1000,    3.0000,    4.9000,    1.8000], \n [    6.2000,    3.4000,    5.4000,    2.3000], \n [    5.4000,    3.4000,    1.5000,    0.4000], \n [    6.4000,    2.9000,    4.3000,    1.3000], \n [    5.1000,    3.4000,    1.5000,    0.2000], \n [    6.9000,    3.1000,    4.9000,    1.5000], \n [    5.2000,    2.7000,    3.9000,    1.4000], \n [    5.1000,    2.5000,    3.0000,    1.1000], \n [    4.9000,    3.1000,    1.5000,    0.1000], \n [    7.7000,    2.6000,    6.9000,    2.3000], \n [    5.1000,    3.7000,    1.5000,    0.4000], \n [    4.6000,    3.4000,    1.4000,    0.3000], \n [    6.7000,    3.0000,    5.0000,    1.7000], \n [    5.0000,    2.0000,    3.5000,    1.0000], \n [    7.6000,    3.0000,    6.6000,    2.1000], \n [    5.4000,    3.9000,    1.3000,    0.4000], \n [    5.0000,    3.3000,    1.4000,    0.2000]]\n=================OUTPUT==================\n[[    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [    1.0000,         0,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0], \n [         0,    1.0000,         0], \n [         0,    1.0000,         0], \n [         0,         0,    1.0000], \n [    1.0000,         0,         0], \n [    1.0000,         0,         0]]\n<\/code><\/pre>\n<p>We need to normalize our data. For this we can  use NormalizeStandardize (which gives us mean 0, unit variance) on the trainsing set and apply it to the test set.<\/p>\n<pre><code class=\"Scala\">var normalizer = new NormalizerStandardize()\nnormalizer.fit(trainingData)            \/\/ Collect the statistics (mean\/stdev) from the training data. This does not modify the input data\nnormalizer.transform(trainingData)      \/\/ Apply normalization to the training data\nnormalizer.transform(testData)          \/\/ Apply normalization to the test data. This is using statistics calculated from the *training* set\n\nnormalizer\n<\/code><\/pre>\n<pre><code>org.nd4j.linalg.dataset.api.preprocessor.NormalizerStandardize@9b6b4e44\n<\/code><\/pre>\n<h3>Setup the Neural Network Model<\/h3>\n<p>The syntax is similar to the one used by Keras. We can define the network in a declarative way:<\/p>\n<pre><code class=\"Scala\"><br \/>var numInputs = 4;\nvar outputNum = 3;\nvar seed = 6;\n\nvar conf = new NeuralNetConfiguration.Builder()\n    .seed(seed)\n    .activation(Activation.TANH)\n    .weightInit(WeightInit.XAVIER)\n    .updater(new Sgd(0.1))\n    .l2(1e-4)\n    .list()\n    .layer(0, new DenseLayer.Builder().nIn(numInputs).nOut(3)\n        .build())\n    .layer(1, new DenseLayer.Builder().nIn(3).nOut(3)\n        .build())\n    .layer(2, new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD)\n        .activation(Activation.SOFTMAX)\n        .nIn(3).nOut(outputNum).build())\n    .backprop(true).pretrain(false)\n    .build();\n\n<\/code><\/pre>\n<pre><code>{\n  \"backprop\" : true,\n  \"backpropType\" : \"Standard\",\n  \"cacheMode\" : \"NONE\",\n  \"confs\" : [ {\n    \"cacheMode\" : \"NONE\",\n    \"epochCount\" : 0,\n    \"iterationCount\" : 0,\n    \"layer\" : {\n      \"@class\" : \"org.deeplearning4j.nn.conf.layers.DenseLayer\",\n      \"activationFn\" : {\n        \"@class\" : \"org.nd4j.linalg.activations.impl.ActivationTanH\"\n      },\n      \"biasInit\" : 0.0,\n      \"biasUpdater\" : null,\n      \"constraints\" : null,\n      \"dist\" : null,\n      \"gradientNormalization\" : \"None\",\n      \"gradientNormalizationThreshold\" : 1.0,\n      \"hasBias\" : true,\n      \"idropout\" : null,\n      \"iupdater\" : {\n        \"@class\" : \"org.nd4j.linalg.learning.config.Sgd\",\n        \"learningRate\" : 0.1\n      },\n      \"l1\" : 0.0,\n      \"l1Bias\" : 0.0,\n      \"l2\" : 1.0E-4,\n      \"l2Bias\" : 0.0,\n      \"layerName\" : \"layer0\",\n      \"nin\" : 4,\n      \"nout\" : 3,\n      \"pretrain\" : false,\n      \"weightInit\" : \"XAVIER\",\n      \"weightNoise\" : null\n    },\n    \"maxNumLineSearchIterations\" : 5,\n    \"miniBatch\" : true,\n    \"minimize\" : true,\n    \"optimizationAlgo\" : \"STOCHASTIC_GRADIENT_DESCENT\",\n    \"pretrain\" : false,\n    \"seed\" : 6,\n    \"stepFunction\" : null,\n    \"variables\" : [ ]\n  }, {\n    \"cacheMode\" : \"NONE\",\n    \"epochCount\" : 0,\n    \"iterationCount\" : 0,\n    \"layer\" : {\n      \"@class\" : \"org.deeplearning4j.nn.conf.layers.DenseLayer\",\n      \"activationFn\" : {\n        \"@class\" : \"org.nd4j.linalg.activations.impl.ActivationTanH\"\n      },\n      \"biasInit\" : 0.0,\n      \"biasUpdater\" : null,\n      \"constraints\" : null,\n      \"dist\" : null,\n      \"gradientNormalization\" : \"None\",\n      \"gradientNormalizationThreshold\" : 1.0,\n      \"hasBias\" : true,\n      \"idropout\" : null,\n      \"iupdater\" : {\n        \"@class\" : \"org.nd4j.linalg.learning.config.Sgd\",\n        \"learningRate\" : 0.1\n      },\n      \"l1\" : 0.0,\n      \"l1Bias\" : 0.0,\n      \"l2\" : 1.0E-4,\n      \"l2Bias\" : 0.0,\n      \"layerName\" : \"layer1\",\n      \"nin\" : 3,\n      \"nout\" : 3,\n      \"pretrain\" : false,\n      \"weightInit\" : \"XAVIER\",\n      \"weightNoise\" : null\n    },\n    \"maxNumLineSearchIterations\" : 5,\n    \"miniBatch\" : true,\n    \"minimize\" : true,\n    \"optimizationAlgo\" : \"STOCHASTIC_GRADIENT_DESCENT\",\n    \"pretrain\" : false,\n    \"seed\" : 6,\n    \"stepFunction\" : null,\n    \"variables\" : [ ]\n  }, {\n    \"cacheMode\" : \"NONE\",\n    \"epochCount\" : 0,\n    \"iterationCount\" : 0,\n    \"layer\" : {\n      \"@class\" : \"org.deeplearning4j.nn.conf.layers.OutputLayer\",\n      \"activationFn\" : {\n        \"@class\" : \"org.nd4j.linalg.activations.impl.ActivationSoftmax\"\n      },\n      \"biasInit\" : 0.0,\n      \"biasUpdater\" : null,\n      \"constraints\" : null,\n      \"dist\" : null,\n      \"gradientNormalization\" : \"None\",\n      \"gradientNormalizationThreshold\" : 1.0,\n      \"hasBias\" : true,\n      \"idropout\" : null,\n      \"iupdater\" : {\n        \"@class\" : \"org.nd4j.linalg.learning.config.Sgd\",\n        \"learningRate\" : 0.1\n      },\n      \"l1\" : 0.0,\n      \"l1Bias\" : 0.0,\n      \"l2\" : 1.0E-4,\n      \"l2Bias\" : 0.0,\n      \"layerName\" : \"layer2\",\n      \"lossFn\" : {\n        \"@class\" : \"org.nd4j.linalg.lossfunctions.impl.LossNegativeLogLikelihood\",\n        \"configProperties\" : false,\n        \"numOutputs\" : -1,\n        \"softmaxClipEps\" : 1.0E-10\n      },\n      \"nin\" : 3,\n      \"nout\" : 3,\n      \"pretrain\" : false,\n      \"weightInit\" : \"XAVIER\",\n      \"weightNoise\" : null\n    },\n    \"maxNumLineSearchIterations\" : 5,\n    \"miniBatch\" : true,\n    \"minimize\" : true,\n    \"optimizationAlgo\" : \"STOCHASTIC_GRADIENT_DESCENT\",\n    \"pretrain\" : false,\n    \"seed\" : 6,\n    \"stepFunction\" : null,\n    \"variables\" : [ ]\n  } ],\n  \"epochCount\" : 0,\n  \"inferenceWorkspaceMode\" : \"ENABLED\",\n  \"inputPreProcessors\" : { },\n  \"iterationCount\" : 0,\n  \"pretrain\" : false,\n  \"tbpttBackLength\" : 20,\n  \"tbpttFwdLength\" : 20,\n  \"trainingWorkspaceMode\" : \"ENABLED\"\n}\n<\/code><\/pre>\n<h3>Run the Model<\/h3>\n<p>Now that we have the data available and the model defined we can run the model in a<br \/>\npredefined number of iterations (epochs)<\/p>\n<pre><code class=\"Scala\">\/\/run the model\nvar model = new MultiLayerNetwork(conf)\nmodel.init()\nmodel.setListeners(new ScoreIterationListener(100))\n\nvar epochs = 1000\nfor(i &lt;- 0  to epochs) {\n    model.fit(trainingData)\n}\n\nepochs\n\n<\/code><\/pre>\n<pre><code>1000\n<\/code><\/pre>\n<h3>Evaluate the Model<\/h3>\n<p>And finally we can evaluate the perormance of the model:<\/p>\n<p>We can correctly predict the correct variaty in 100% of the cases.<\/p>\n<pre><code class=\"Scala\">\/\/evaluate the model on the test set\nvar eval = new Evaluation(3)\nvar output = model.output(testData.getFeatures())\neval.eval(testData.getLabels(), output)\n\neval.stats()\n\n<\/code><\/pre>\n<pre><code>========================Evaluation Metrics========================\n # of classes:    3\n Accuracy:        1.0000\n Precision:       1.0000\n Recall:          1.0000\n F1 Score:        1.0000\nPrecision, recall &amp; F1: macro-averaged (equally weighted avg. of 3 classes)\n\n\n=========================Confusion Matrix=========================\n 0 1 2\n-------\n 3 0 0 | 0 = 0\n 0 5 0 | 1 = 1\n 0 0 7 | 2 = 2\n\nConfusion matrix format: Actual (rowClass) predicted as (columnClass) N times\n==================================================================\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I am a big fan of Keras &#8211; Fortunately we also have a similar framework available when we need to implement a solution which works in the JVM: DeepLearning4J. In this Blog I give a quick introduction of some of the key concepts which are needed to get started. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":563,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[14],"tags":[],"class_list":["post-557","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Deeplearning4j - Iris Classification Example - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deeplearning4j - Iris Classification Example - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"I am a big fan of Keras &#8211; Fortunately we also have a similar framework available when we need to implement a solution which works in the JVM: DeepLearning4J. In this Blog I give a quick introduction of some of the key concepts which are needed to get started. I [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-17T19:31:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-21T21:22:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/machineLearning.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"286\" \/>\n\t<meta property=\"og:image:height\" content=\"176\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Deeplearning4j &#8211; Iris Classification Example\",\"datePublished\":\"2018-09-17T19:31:32+00:00\",\"dateModified\":\"2020-11-21T21:22:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/\"},\"wordCount\":427,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/machineLearning.jpeg\",\"articleSection\":[\"Machine Learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/\",\"name\":\"Deeplearning4j - Iris Classification Example - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/machineLearning.jpeg\",\"datePublished\":\"2018-09-17T19:31:32+00:00\",\"dateModified\":\"2020-11-21T21:22:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/machineLearning.jpeg\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/machineLearning.jpeg\",\"width\":286,\"height\":176},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/09\\\/17\\\/deeplearing4j-iris-classification-example\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deeplearning4j &#8211; Iris Classification Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deeplearning4j - Iris Classification Example - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/","og_locale":"en_US","og_type":"article","og_title":"Deeplearning4j - Iris Classification Example - Phil Schatzmann","og_description":"I am a big fan of Keras &#8211; Fortunately we also have a similar framework available when we need to implement a solution which works in the JVM: DeepLearning4J. In this Blog I give a quick introduction of some of the key concepts which are needed to get started. I [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/","og_site_name":"Phil Schatzmann","article_published_time":"2018-09-17T19:31:32+00:00","article_modified_time":"2020-11-21T21:22:51+00:00","og_image":[{"width":286,"height":176,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/machineLearning.jpeg","type":"image\/jpeg"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Deeplearning4j &#8211; Iris Classification Example","datePublished":"2018-09-17T19:31:32+00:00","dateModified":"2020-11-21T21:22:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/"},"wordCount":427,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/machineLearning.jpeg","articleSection":["Machine Learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/","url":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/","name":"Deeplearning4j - Iris Classification Example - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/machineLearning.jpeg","datePublished":"2018-09-17T19:31:32+00:00","dateModified":"2020-11-21T21:22:51+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/machineLearning.jpeg","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2018\/09\/machineLearning.jpeg","width":286,"height":176},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/09\/17\/deeplearing4j-iris-classification-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Deeplearning4j &#8211; Iris Classification Example"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=557"}],"version-history":[{"count":1,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/557\/revisions"}],"predecessor-version":[{"id":2222,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/557\/revisions\/2222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/563"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}