public class NystromMethod extends Object implements LinearizationFunction
Dataset
of examples represented through
tree structures and a tree kernel function, this class allows deriving a
linearized dataset at a given dimensionality. Modifier and Type | Field and Description |
---|---|
static float |
ESPILON |
Constructor and Description |
---|
NystromMethod() |
NystromMethod(List<Example> landmarks,
Kernel kernel)
Constructor of NystromMethod.
|
NystromMethod(List<Example> landmarks,
Kernel kernel,
int expectedRank) |
Modifier and Type | Method and Description |
---|---|
protected double[] |
calculateVector(Example example)
It derives an array of doubles containing the linearized representation
|
int |
getEmbeddingSize() |
Kernel |
getKernel() |
List<Example> |
getLandmarks() |
SimpleDataset |
getLinearizedDataset(Dataset dataset,
String representationName)
This method linearizes all the examples in the input
dataset
, generating a corresponding linearized dataset. |
Example |
getLinearizedExample(Example example,
String representationName)
This method linearizes an input example, providing a new example
containing only a representation with a specific name, provided as input.
|
DenseVector |
getLinearRepresentation(Example example)
Given an input
Example , this method generates a linear
Representation> , i.e. |
List<Double> |
getProjectionMatrix() |
int |
getRank() |
static NystromMethod |
load(String inputFilePath)
Load a Nystrom-based projection function from a file
|
void |
save(String outputFilePath)
Save a Nystrom-based projection function in a file.
|
void |
setKernel(Kernel kernel) |
void |
setLandmarks(List<Example> landmarks) |
void |
setProjectionMatrix(List<Double> projectionMatrix) |
void |
setRank(int rank) |
public static final float ESPILON
public NystromMethod()
public NystromMethod(List<Example> landmarks, Kernel kernel) throws InstantiationException
landmarks
landmarks
- The set of examples used as landmarkskernel
- The kernel functionInstantiationException
public NystromMethod(List<Example> landmarks, Kernel kernel, int expectedRank) throws InstantiationException
landmarks
- The set of examples used as landmarkskernel
- The kernel functionexpectedRank
- The expected rank of the space representing the linearized
examplesInstantiationException
public static NystromMethod load(String inputFilePath) throws FileNotFoundException, IOException
inputFilePath
- the input fileFileNotFoundException
IOException
protected double[] calculateVector(Example example)
example
- the input examplepublic Kernel getKernel()
public SimpleDataset getLinearizedDataset(Dataset dataset, String representationName)
LinearizationFunction
dataset
, generating a corresponding linearized dataset. The produced examples
inherit the labels of the corresponding input examples.getLinearizedDataset
in interface LinearizationFunction
dataset
- The input datasetrepresentationName
- The name of the linear representation inside the new examplespublic Example getLinearizedExample(Example example, String representationName)
LinearizationFunction
getLinearizedExample
in interface LinearizationFunction
example
- The input example.public DenseVector getLinearRepresentation(Example example)
LinearizationFunction
Example
, this method generates a linear
Representation>
, i.e. a Vector
.getLinearRepresentation
in interface LinearizationFunction
example
- The input example.public List<Double> getProjectionMatrix()
public int getRank()
public void save(String outputFilePath) throws FileNotFoundException, IOException
outputFilePath
- the output file pathFileNotFoundException
IOException
public void setKernel(Kernel kernel)
kernel
- The kernel functionpublic void setProjectionMatrix(List<Double> projectionMatrix)
projectionMatrix
- The projection matrixpublic void setRank(int rank)
rank
- The expected rankpublic int getEmbeddingSize()
getEmbeddingSize
in interface LinearizationFunction
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.