This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import tensorflow as tf | |
| import numpy as np | |
| import fasttext | |
| from tensorflow.contrib.tensorboard.plugins import projector | |
| # load model | |
| word2vec = fasttext.load_model('wiki.en.bin') | |
| # create a list of vectors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function evaluate () { | |
| alg=$1 | |
| data=$2 | |
| i=$3 | |
| echo $data Fold$i | |
| model=./model/$alg-$data-Fold$i-model | |
| # train | |
| ./train $alg -training ./data/$data/Fold$i/train.txt -validation ./data/$data/Fold$i/vali.txt -model $mode\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def load(svmdata, limit=10): | |
| data = None | |
| with open(svmdata) as io: | |
| for i, l in enumerate(io): | |
| l = l.strip() | |
| if limit > 0 and i > limit: | |
| break | |
| if not l or len(l) == 0: | |
| continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.rikima.ml.dnn | |
| import java.nio.ByteBuffer | |
| import org.apache.spark.{SparkConf, SparkContext} | |
| import com.intel.analytics.bigdl.{DataSet, Module} | |
| import com.intel.analytics.bigdl.dataset.{ByteRecord, DataSet, MiniBatch} | |
| import com.intel.analytics.bigdl.dataset.image.{BytesToGreyImg, GreyImgNormalizer, GreyImgToBatch} | |
| import com.intel.analytics.bigdl.models.lenet.LeNet5 | |
| import com.intel.analytics.bigdl.nn.ClassNLLCriterion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JavaMatrix time: 9190 [ms] | |
| colt process time: 10543 [ms] | |
| La4j process time: 4560 [ms] | |
| Nd4j process time: 604 [ms] | |
| Breeze process time: 4957 [ms] | |
| BigDL Tensor time: 782 [ms] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.rikima.ml.dnn | |
| import java.util.Random | |
| import breeze.linalg.DenseMatrix | |
| import cern.colt.matrix.DoubleFactory2D | |
| import cern.colt.matrix.linalg.Algebra | |
| import com.intel.analytics.bigdl.tensor.Tensor | |
| import com.rikima.linalg.JavaMatrix | |
| import org.junit.Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public Pair<Gradient,INDArray> backpropGradient(INDArray epsilon) { | |
| //If this layer is layer L, then epsilon is (w^(L+1)*(d^(L+1))^T) (or equivalent) | |
| INDArray z = preOutput(true); //Note: using preOutput(INDArray) can't be used as this does a setInput(input) and resets the 'appliedDropout' flag | |
| INDArray activationDerivative = Nd4j.getExecutioner().execAndReturn(Nd4j.getOpFactory().createTransform(conf().getLayer().getActivationFunction(), z).derivative()); | |
| INDArray delta = epsilon.muli(activationDerivative); | |
| if(maskArray != null){ | |
| delta.muliColumnVector(maskArray); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tests in error: | |
| RecordReaderDataSetiteratorTest.testRecordReader:55 » FileNotFound class path ... | |
| RecordReaderDataSetiteratorTest.testRecordReaderMaxBatchLimit:66 » FileNotFound | |
| RecordReaderDataSetiteratorTest.testRecordReaderMultiRegression:78 » FileNotFound | |
| RecordReaderDataSetiteratorTest.testSequenceRecordReader:115 » FileNotFound cl... | |
| RecordReaderDataSetiteratorTest.testSequenceRecordReaderRegression:201 » FileNotFound | |
| RecordReaderDataSetiteratorTest.testSequenceRecordReaderReset:261 » FileNotFound | |
| RecordReaderDataSetiteratorTest.testSequenceRecordReaderSingleReader:527 » FileNotFound | |
| -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [INFO] | |
| [INFO] nd4j ............................................... SUCCESS [ 2.520 s] | |
| [INFO] nd4j-common ........................................ SUCCESS [ 10.818 s] | |
| [INFO] nd4j-context ....................................... SUCCESS [ 3.463 s] | |
| [INFO] nd4j-buffer ........................................ SUCCESS [ 6.908 s] | |
| [INFO] nd4j-backends ...................................... SUCCESS [ 0.035 s] | |
| [INFO] nd4j-api-parent .................................... SUCCESS [ 0.037 s] | |
| [INFO] nd4j-api ........................................... SUCCESS [ 32.103 s] | |
| [INFO] nd4j-jdbc .......................................... SUCCESS [ 0.036 s] | |
| [INFO] nd4j-jdbc-api ...................................... SUCCESS [ 2.798 s] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| eval cmake | |
| RUNNING OSX CLANG | |
| PACKAGING = none | |
| BUILD = release | |
| CHIP = cpu | |
| LIBRARY TYPE = dynamic | |
| /Users/a14350/workspace/libnd4j/blasbuild/cpu | |
| -- The C compiler identification is Clang 3.5.0 | |
| -- The CXX compiler identification is Clang 3.5.0 | |
| -- Check for working C compiler: /usr/local/bin/clang-omp |
NewerOlder