/*
  This file is part of the BJP package.

  BJP package is free software: you can redistribute it and/or modify it
  under the terms of the GNU Lesser General Public License as published by the
  Free Software Foundation, either version 3 of the License, or (at your
  option) any later version.

  BJP package 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 Lesser General Public
  License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with BJP package.  If not, see <http://www.gnu.org/licenses/>.
 */
package learn.struct.it;

import java.util.List;

import dataset.Dataset;

/**
 * This interface enables to implement several statistical tests, such as Chi
 * square, G square, and the Bayesian statistical test of dependence. 
 */
public interface StatisticalIndependenceTest {

	/**
	 * @param dataset
	 *            An instance of the dataset class
	 * @param x
	 *            A random variable
	 * @param y
	 *            A random variable
	 * @param z
	 *            A set of random variables
	 * @param i
	 *            The cardinality of all the variables (i.e. 2 for binary
	 *            variables).
	 * @return A decision of Independence of the triplet, given data
	 */
	public boolean independent(Dataset dataset, List<Integer> x, List<Integer> y, List<Integer> z);

	/**
	 * @param dataset
	 *            An instance of the dataset class
	 * @param triplet
	 *            A triplet of sets of variables for querying conditional
	 *            independence
	 * @return
	 */
	public boolean independent(Dataset dataset, IndependenceTriplet triplet);

	/**
	 * @return A vector of double values, wit loglikelihoods[0] the log
	 *         likelihood of independence, and logprobs[1] the log likelihood of
	 *         dependence
	 */
	public double[] getLoglikelihoods();

	/**
	 * @return A vector of double values, wit logprobs[0] the log probability of
	 *         independence, and logprobs[1] the log probability dependence
	 */
	public double[] getLogProbs();
}
