All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.citec.tcs.alignment.DerivableAlignmentDistance Maven / Gradle / Ivy

Go to download

This module defines the interface for AlignmentAlgorithms as well as some helper classes. An AlignmentAlgorithm computes an Alignment of two given input sequences, given a Comparator that works in these sequences. More details on the AlignmentAlgorithm can be found in the respective interface. More information on Comparators can be found in the comparators module. The resulting 'Alignment' may be just a real-valued dissimilarity between the input sequence or may incorporate additional information, such as a full Alignment, a PathList, a PathMap or a CooptimalModel. If those results support the calculation of a Gradient, they implement the DerivableAlignmentDistance interface. In more detail, the Alignment class represents the result of a backtracing scheme, listing all Operations that have been applied in one co-optimal Alignment. A classic AlignmentAlgorithm does not result in a differentiable dissimilarity, because the minimum function is not differentiable. Therefore, this package also contains utility functions for a soft approximation of the minimum function, namely Softmin. For faster (parallel) computation of many different alignments or gradients we also provide the ParallelProcessingEngine, the SquareParallelProcessingEngine and the ParallelGradientEngine.

The newest version!
/* 
 * TCS Alignment Toolbox Version 3
 * 
 * Copyright (C) 2016
 * Benjamin Paaßen
 * AG Theoretical Computer Science
 * Centre of Excellence Cognitive Interaction Technology (CITEC)
 * University of Bielefeld
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package de.citec.tcs.alignment;

import de.citec.tcs.alignment.comparators.DerivableComparator;
import java.util.List;
import lombok.NonNull;

/**
 * This is an interface to provide calculation methods for the gradient of an
 * alignment w.r.t. a specific comparator.
 *
 * Please note that this is an interface to be implemented by the results of AlignmentAlgorithms,
 * not the algorithms itself. For example the result of the StrictAlignmentFullAlgorithm is an
 * Alignment, which is an DerivableAlignmentDistance, because the AlignmentPath contains the
 * necessary information to calculate the gradient.
 *
 * @author Benjamin Paassen - bpaassen(at)techfak.uni-bielefeld.de
 * @param  the class of the elements in the left input sequence.
 * @param  the class of the elements in the right input sequence.
 */
public interface DerivableAlignmentDistance {

	/**
	 * This computes the gradient of this DerivableAlignmentDistance w.r.t. the parameters of the
	 * given Comparator.
	 *
	 * @param comp the DerivableComparator that was used in computing this distance.
	 *
	 * @return the derivatives for all parameters of the given comparator.
	 */
	public double[] computeGradient(@NonNull DerivableComparator comp);

	/**
	 * Returns the distance between the two input sequences.
	 *
	 * @return the distance between the two input sequences.
	 */
	public double getDistance();

	/**
	 * Returns the left sequence of this distance.
	 *
	 * @return the left sequence of this distance.
	 */
	public List getLeft();

	/**
	 * Returns the right sequence of this distance.
	 *
	 * @return the right sequence of this distance.
	 */
	public List getRight();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy