String transformClass =
properties.getProperty(MATRIX_TRANSFORM_PROPERTY);
if (transformClass != null)
transform = ReflectionUtil.getObjectInstance(transformClass);
MatrixFile transformedMatrix = processSpace(transform);
// Set all of the default properties
int dimensions = 300;
// Then load any of the user-specified properties
String dimensionsProp =
properties.getProperty(LPSA_DIMENSIONS_PROPERTY);
if (dimensionsProp != null) {
try {
dimensions = Integer.parseInt(dimensionsProp);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException(
LPSA_DIMENSIONS_PROPERTY + " is not an integer: " +
dimensionsProp);
}
}
LoggerUtil.verbose(LOG, "reducing to %d dimensions", dimensions);
Matrix termDocMatrix = MatrixIO.readMatrix(
transformedMatrix.getFile(),
transformedMatrix.getFormat(),
Matrix.Type.SPARSE_IN_MEMORY, true);
// Calculate the affinity matrix for the term-doc matrix
MatrixFile affinityMatrix = affinityCreator.calculate(
termDocMatrix);
// Using the affinity matrix as a guide to locality, project the
// co-occurrence matrix into the lower dimensional subspace
wordSpace = LocalityPreservingProjection.project(