public class RNNUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.ejml.simple.SimpleMatrix |
concatenate(org.ejml.simple.SimpleMatrix... vectors)
Concatenates several column vectors into one large column vector
|
static org.ejml.simple.SimpleMatrix |
concatenateWithBias(org.ejml.simple.SimpleMatrix... vectors)
Concatenates several column vectors into one large column
vector, adds a 1.0 at the end as a bias term
|
static org.ejml.simple.SimpleMatrix |
elementwiseApplyLog(org.ejml.simple.SimpleMatrix input)
Applies log to each of the entries in the matrix.
|
static org.ejml.simple.SimpleMatrix |
elementwiseApplyTanh(org.ejml.simple.SimpleMatrix input)
Applies tanh to each of the entries in the matrix.
|
static org.ejml.simple.SimpleMatrix |
elementwiseApplyTanhDerivative(org.ejml.simple.SimpleMatrix input)
Applies the derivative of tanh to each of the elements in the vector.
|
static double[] |
paramsToVector(double scale,
int totalSize,
Iterator<org.ejml.simple.SimpleMatrix>... matrices)
Given a sequence of iterators over the matrices, builds a vector
out of those matrices in the order given.
|
static double[] |
paramsToVector(int totalSize,
Iterator<org.ejml.simple.SimpleMatrix>... matrices)
Given a sequence of iterators over the matrices, builds a vector
out of those matrices in the order given.
|
static org.ejml.simple.SimpleMatrix |
randomGaussian(int numRows,
int numCols,
Random rand)
Returns a vector with random Gaussian values, mean 0, std 1
|
static Map<String,org.ejml.simple.SimpleMatrix> |
readRawWordVectors(String filename,
int expectedSize)
This method reads a file of raw word vectors, with a given expected size, and returns a map of word to vector.
|
static double |
sigmoid(double x)
Returns a sigmoid applied to the input
x. |
static org.ejml.simple.SimpleMatrix |
softmax(org.ejml.simple.SimpleMatrix input)
Applies softmax to all of the elements of the matrix.
|
static void |
vectorToParams(double[] theta,
Iterator<org.ejml.simple.SimpleMatrix>... matrices)
Given a sequence of Iterators over SimpleMatrix, fill in all of
the matrices with the entries in the theta vector.
|
public static void vectorToParams(double[] theta,
Iterator<org.ejml.simple.SimpleMatrix>... matrices)
public static double[] paramsToVector(int totalSize,
Iterator<org.ejml.simple.SimpleMatrix>... matrices)
public static double[] paramsToVector(double scale,
int totalSize,
Iterator<org.ejml.simple.SimpleMatrix>... matrices)
scale parameter. Asks for an
expected total size as a time savings. AssertionError thrown if
the vector sizes do not exactly match.public static Map<String,org.ejml.simple.SimpleMatrix> readRawWordVectors(String filename, int expectedSize)
WORD X1 X2 X3 ... public static double sigmoid(double x)
x.public static org.ejml.simple.SimpleMatrix softmax(org.ejml.simple.SimpleMatrix input)
public static org.ejml.simple.SimpleMatrix elementwiseApplyLog(org.ejml.simple.SimpleMatrix input)
public static org.ejml.simple.SimpleMatrix elementwiseApplyTanh(org.ejml.simple.SimpleMatrix input)
public static org.ejml.simple.SimpleMatrix elementwiseApplyTanhDerivative(org.ejml.simple.SimpleMatrix input)
public static org.ejml.simple.SimpleMatrix concatenateWithBias(org.ejml.simple.SimpleMatrix... vectors)
public static org.ejml.simple.SimpleMatrix concatenate(org.ejml.simple.SimpleMatrix... vectors)
public static org.ejml.simple.SimpleMatrix randomGaussian(int numRows,
int numCols,
Random rand)