public class RandomProjection extends Object
Constructor and Description |
---|
RandomProjection(double eps) |
RandomProjection(double eps,
Random rng) |
RandomProjection(int components) |
RandomProjection(int components,
Random rng) |
Modifier and Type | Method and Description |
---|---|
static List<Integer> |
johnsonLindenstraussMinDim(int[] n,
double... eps)
Find a safe number of components to project this to, through
the Johnson-Lindenstrauss lemma
The minimum number n' of components to guarantee the eps-embedding is
given by:
n' >= 4 log(n) / (eps² / 2 - eps³ / 3)
see http://cseweb.ucsd.edu/~dasgupta/papers/jl.pdf §2.1
|
static List<Integer> |
johnsonLindenStraussMinDim(int n,
double... eps) |
static List<Long> |
johnsonLindenstraussMinDim(long[] n,
double... eps) |
static List<Long> |
johnsonLindenStraussMinDim(long n,
double... eps) |
INDArray |
project(INDArray data)
Create a copy random projection by using matrix product with a random matrix
|
INDArray |
project(INDArray data,
INDArray result)
Create a copy random projection by using matrix product with a random matrix
|
INDArray |
projecti(INDArray data)
Create an in-place random projection by using in-place matrix product with a random matrix
|
INDArray |
projecti(INDArray data,
INDArray result)
Create an in-place random projection by using in-place matrix product with a random matrix
|
protected static long[] |
targetShape(INDArray X,
double eps)
Compute the target shape of a suitable projection matrix
|
protected static long[] |
targetShape(INDArray X,
int targetDimension)
Compute the target shape of a suitable projection matrix
|
public RandomProjection(double eps, Random rng)
public RandomProjection(double eps)
public RandomProjection(int components, Random rng)
public RandomProjection(int components)
public static List<Integer> johnsonLindenstraussMinDim(int[] n, double... eps)
n
- Number of samples. If an array is given, it will compute
a safe number of components array-wise.eps
- Maximum distortion rate as defined by the Johnson-Lindenstrauss lemma.
Will compute array-wise if an array is given.public static List<Long> johnsonLindenstraussMinDim(long[] n, double... eps)
public static List<Integer> johnsonLindenStraussMinDim(int n, double... eps)
public static List<Long> johnsonLindenStraussMinDim(long n, double... eps)
protected static long[] targetShape(INDArray X, double eps)
X
- the Data tensoreps
- the relative error used in the Johnson-Lindenstrauss estimationprotected static long[] targetShape(INDArray X, int targetDimension)
X
- the Data TensortargetDimension
- a desired dimensionpublic INDArray project(INDArray data)
data
- public INDArray project(INDArray data, INDArray result)
data
- result
- a placeholder resultpublic INDArray projecti(INDArray data)
data
- Copyright © 2020. All rights reserved.