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

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

/* 
 * TCS Alignment Toolbox
 * 
 * Copyright (C) 2013-2015
 * Benjamin Paaßen, Georg Zentgraf
 * 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 de.citec.tcs.alignment.sequence.Sequence;
import de.citec.tcs.alignment.sequence.Value;

/**
 * This is an interface to provide calculation methods for the derivative of an
 * alignment w.r.t. a specific comparator and the weights for the keywords.
 *
 * 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 AlignmentPath, which is an
 * AlignmentDerivativeAlgorithm, because the AlignmentPath contains the
 * necessary information to calculate the derivative.
 *
 * @author Benjamin Paassen - bpaassen(at)techfak.uni-bielefeld.de
 */
public interface AlignmentDerivativeAlgorithm {

	/**
	 * This returns the derivatives for all parameters of the given comparator
	 * according to the implementation. Ideally the implementation should also
	 * use sparsity of the comparator if possible.
	 *
	 * @param      the values the given comparator can compare.
	 * @param comp    the DerivableComparator that provides functionality to
	 *                calculate local derivatives.
	 * @param keyword the keyword for which the given comparator was used in
	 *                the Alignment.
	 *
	 * @return the derivatives for all parameters of the given comparator.
	 */
	public  double[] calculateRawParameterDerivative(
			DerivableComparator comp, String keyword);

	/**
	 * This returns the derivatives for all parameters of the given comparator
	 * according to the implementation. Ideally the implementation should also
	 * use sparsity of the comparator if possible.
	 *
	 * @param      the values the given comparator can compare.
	 * @param      the result format for derivatives of the given comparator.
	 * @param comp    the DerivableComparator that provides functionality to
	 *                calculate local derivatives.
	 * @param keyword the keyword for which the given comparator was used in
	 *                the Alignment.
	 *
	 * @return the derivatives for all parameters of the given comparator in the
	 *         result form given by the respective comparator.
	 */
	public  Y calculateParameterDerivative(
			DerivableComparator comp, String keyword);

	/**
	 * Calculates the derivative for each keyword weight.
	 *
	 * @return the derivative for each keyword weight.
	 */
	public double[] calculateWeightDerivative();

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy