本文整理匯總了Java中weka.core.pmml.VectorInstance類的典型用法代碼示例。如果您正苦於以下問題:Java VectorInstance類的具體用法?Java VectorInstance怎麽用?Java VectorInstance使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VectorInstance類屬於weka.core.pmml包,在下文中一共展示了VectorInstance類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: evaluate
import weka.core.pmml.VectorInstance; //導入依賴的package包/類
/**
* 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);
}