/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector (as an array of values) * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, double[] y) throws Exception { VectorInstance diff = x.subtract(y); // System.err.println("diff: " + diff.getValues()); double result = -m_gamma * diff.dotProduct(diff); // System.err.println("Result: " + result); return Math.exp(result); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector instance * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, VectorInstance y) throws Exception { double dotProd = x.dotProduct(y); double z = m_gamma * dotProd + m_coef0; double a = Math.exp(z); double b = Math.exp(-z); return ((a - b) / (a + b)); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector (as an array of values) * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, double[] y) throws Exception { double dotProd = x.dotProduct(y); double z = m_gamma * dotProd + m_coef0; double a = Math.exp(z); double b = Math.exp(-z); return ((a - b) / (a + b)); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector instance * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, VectorInstance y) throws Exception { VectorInstance diff = x.subtract(y); double result = -m_gamma * diff.dotProduct(diff); return Math.exp(result); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector instance * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public abstract double evaluate(VectorInstance x, VectorInstance y) throws Exception;
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector (as an array of values) * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public abstract double evaluate(VectorInstance x, double[] y) throws Exception;
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector instance * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, VectorInstance y) throws Exception { return x.dotProduct(y); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector (as an array of values) * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, double[] y) throws Exception { return x.dotProduct(y); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector instance * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, VectorInstance y) throws Exception { double dotProd = x.dotProduct(y); return Math.pow(m_gamma * dotProd + m_coef0, m_degree); }
/** * Compute the result of the kernel evaluation on the supplied vectors * * @param x the first vector instance * @param y the second vector (as an array of values) * @return the result of the kernel evaluation * @throws Exception if something goes wrong */ public double evaluate(VectorInstance x, double[] y) throws Exception { double dotProd = x.dotProduct(y); return Math.pow(m_gamma * dotProd + m_coef0, m_degree); }