Search in sources :

Example 1 with NonNumericFeaturesException

use of de.lmu.ifi.dbs.elki.datasource.filter.normalization.NonNumericFeaturesException in project elki by elki-project.

the class CorrelationAnalysisSolution method writeToText.

/**
 * Text output of the equation system
 */
@Override
public void writeToText(TextWriterStream out, String label) {
    if (label != null) {
        out.commentPrintLn(label);
    }
    out.commentPrintLn("Model class: " + this.getClass().getName());
    try {
        if (getNormalizedLinearEquationSystem(null) != null) {
            // TODO: more elegant way of doing normalization here?
            /*
         * if(out instanceof TextWriterStreamNormalizing) {
         * TextWriterStreamNormalizing<V> nout =
         * (TextWriterStreamNormalizing<V>) out; LinearEquationSystem lq =
         * getNormalizedLinearEquationSystem(nout.getNormalization());
         * out.commentPrint("Linear Equation System: ");
         * out.commentPrintLn(lq.equationsToString(nf)); } else {
         */
            LinearEquationSystem lq = getNormalizedLinearEquationSystem(null);
            out.commentPrint("Linear Equation System: ");
            out.commentPrintLn(lq.equationsToString(nf));
        // }
        }
    } catch (NonNumericFeaturesException e) {
        LoggingUtil.exception(e);
    }
}
Also used : NonNumericFeaturesException(de.lmu.ifi.dbs.elki.datasource.filter.normalization.NonNumericFeaturesException) LinearEquationSystem(de.lmu.ifi.dbs.elki.math.linearalgebra.LinearEquationSystem)

Example 2 with NonNumericFeaturesException

use of de.lmu.ifi.dbs.elki.datasource.filter.normalization.NonNumericFeaturesException in project elki by elki-project.

the class CASH method runDerivator.

/**
 * Runs the derivator on the specified interval and assigns all points having
 * a distance less then the standard deviation of the derivator model to the
 * model to this model.
 *
 * @param relation the database containing the parameterization functions
 * @param ids the ids to build the model
 * @param dimensionality the dimensionality of the subspace
 * @return a basis of the found subspace
 */
private LinearEquationSystem runDerivator(Relation<ParameterizationFunction> relation, int dimensionality, DBIDs ids) {
    try {
        // build database for derivator
        Database derivatorDB = buildDerivatorDB(relation, ids);
        PCARunner pca = new PCARunner(new StandardCovarianceMatrixBuilder());
        EigenPairFilter filter = new FirstNEigenPairFilter(dimensionality);
        DependencyDerivator<DoubleVector> derivator = new DependencyDerivator<>(null, FormatUtil.NF4, pca, filter, 0, false);
        CorrelationAnalysisSolution<DoubleVector> model = derivator.run(derivatorDB);
        LinearEquationSystem les = model.getNormalizedLinearEquationSystem(null);
        return les;
    } catch (NonNumericFeaturesException e) {
        throw new IllegalStateException("Error during normalization" + e);
    }
}
Also used : EigenPairFilter(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.filter.EigenPairFilter) FirstNEigenPairFilter(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.filter.FirstNEigenPairFilter) DependencyDerivator(de.lmu.ifi.dbs.elki.algorithm.DependencyDerivator) FirstNEigenPairFilter(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.filter.FirstNEigenPairFilter) PCARunner(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCARunner) NonNumericFeaturesException(de.lmu.ifi.dbs.elki.datasource.filter.normalization.NonNumericFeaturesException) Database(de.lmu.ifi.dbs.elki.database.Database) ProxyDatabase(de.lmu.ifi.dbs.elki.database.ProxyDatabase) LinearEquationSystem(de.lmu.ifi.dbs.elki.math.linearalgebra.LinearEquationSystem) StandardCovarianceMatrixBuilder(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.StandardCovarianceMatrixBuilder)

Aggregations

NonNumericFeaturesException (de.lmu.ifi.dbs.elki.datasource.filter.normalization.NonNumericFeaturesException)2 LinearEquationSystem (de.lmu.ifi.dbs.elki.math.linearalgebra.LinearEquationSystem)2 DependencyDerivator (de.lmu.ifi.dbs.elki.algorithm.DependencyDerivator)1 Database (de.lmu.ifi.dbs.elki.database.Database)1 ProxyDatabase (de.lmu.ifi.dbs.elki.database.ProxyDatabase)1 PCARunner (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCARunner)1 StandardCovarianceMatrixBuilder (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.StandardCovarianceMatrixBuilder)1 EigenPairFilter (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.filter.EigenPairFilter)1 FirstNEigenPairFilter (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.filter.FirstNEigenPairFilter)1