SVD.getFastestAvailableFactorization());
//Steps 1-2. Load analogy input
lra.loadAnalogiesFromFile(analogyFile);
Matrix projection;
// if we load a projection matrix from file, we can skip all the
// preprocessing
String readProjectionFile = props.getProperty(
LatentRelationalAnalysis.LRA_READ_MATRIX_FILE);
if (readProjectionFile != null) {
File readFile = new File(readProjectionFile);
if (readFile.exists()) {
projection =
MatrixIO.readMatrix(new File(readProjectionFile),
MatrixIO.Format.SVDLIBC_SPARSE_TEXT,
Matrix.Type.SPARSE_IN_MEMORY);
} else {
throw new IllegalArgumentException(
"specified projection file does not exist");
}
} else { //do normal LRA preprocessing...
//Step 3. Get patterns Step 4. Filter top NUM_PATTERNS
lra.findPatterns();
//Step 5. Map phrases to rows
lra.mapRows();
//Step 6. Map patterns to columns
lra.mapColumns();
//Step 7. Create sparse matrix
Matrix sparse_matrix = lra.createSparseMatrix();
//Step 8. Calculate entropy
sparse_matrix = lra.applyEntropyTransformations(sparse_matrix);
//Step 9. Compute SVD on the pre-processed matrix.