diff --git a/src/main/hivemall/classifier/ConfidenceWeightedUDTF.java b/src/main/hivemall/classifier/ConfidenceWeightedUDTF.java index 7b8e2894..846d13a8 100644 --- a/src/main/hivemall/classifier/ConfidenceWeightedUDTF.java +++ b/src/main/hivemall/classifier/ConfidenceWeightedUDTF.java @@ -67,8 +67,8 @@ protected boolean returnCovariance() { @Override protected Options getOptions() { Options opts = super.getOptions(); - opts.addOption("phi", "confidence", true, "Confidence parameter [default 0.5]"); - opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.7]"); + opts.addOption("phi", "confidence", true, "Confidence parameter [default 1.0]"); + opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.85]"); return opts; } @@ -76,7 +76,7 @@ protected Options getOptions() { protected CommandLine processOptions(ObjectInspector[] argOIs) throws UDFArgumentException { final CommandLine cl = super.processOptions(argOIs); - float phi = 0.5f; + float phi = 1.f; if(cl != null) { String phi_str = cl.getOptionValue("phi"); if(phi_str == null) { diff --git a/src/main/hivemall/classifier/SoftConfideceWeightedUDTF.java b/src/main/hivemall/classifier/SoftConfideceWeightedUDTF.java index 00c4faa0..d22c7786 100644 --- a/src/main/hivemall/classifier/SoftConfideceWeightedUDTF.java +++ b/src/main/hivemall/classifier/SoftConfideceWeightedUDTF.java @@ -69,8 +69,8 @@ protected boolean returnCovariance() { @Override protected Options getOptions() { Options opts = super.getOptions(); - opts.addOption("phi", "confidence", true, "Confidence parameter [default 0.5]"); - opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.7]"); + opts.addOption("phi", "confidence", true, "Confidence parameter [default 1.0]"); + opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.85]"); opts.addOption("c", "aggressiveness", true, "Aggressiveness parameter C [default 1.0]"); return opts; } @@ -79,7 +79,7 @@ protected Options getOptions() { protected CommandLine processOptions(ObjectInspector[] argOIs) throws UDFArgumentException { final CommandLine cl = super.processOptions(argOIs); - float phi = 0.5f; + float phi = 1.f; float c = 1.f; if(cl != null) { String phi_str = cl.getOptionValue("phi"); diff --git a/src/main/hivemall/classifier/multiclass/MulticlassConfidenceWeightedUDTF.java b/src/main/hivemall/classifier/multiclass/MulticlassConfidenceWeightedUDTF.java index 4d0d038a..ecb6eb29 100644 --- a/src/main/hivemall/classifier/multiclass/MulticlassConfidenceWeightedUDTF.java +++ b/src/main/hivemall/classifier/multiclass/MulticlassConfidenceWeightedUDTF.java @@ -71,8 +71,8 @@ protected boolean returnCovariance() { @Override protected Options getOptions() { Options opts = super.getOptions(); - opts.addOption("phi", "confidence", true, "Confidence parameter [default 0.5]"); - opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.7]"); + opts.addOption("phi", "confidence", true, "Confidence parameter [default 1.0]"); + opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.85]"); return opts; } @@ -80,7 +80,7 @@ protected Options getOptions() { protected CommandLine processOptions(ObjectInspector[] argOIs) throws UDFArgumentException { final CommandLine cl = super.processOptions(argOIs); - float phi = 0.5f; + float phi = 1.f; if(cl != null) { String phi_str = cl.getOptionValue("phi"); if(phi_str == null) { diff --git a/src/main/hivemall/classifier/multiclass/MulticlassSoftConfidenceWeightedUDTF.java b/src/main/hivemall/classifier/multiclass/MulticlassSoftConfidenceWeightedUDTF.java index de6011ee..e10d0175 100644 --- a/src/main/hivemall/classifier/multiclass/MulticlassSoftConfidenceWeightedUDTF.java +++ b/src/main/hivemall/classifier/multiclass/MulticlassSoftConfidenceWeightedUDTF.java @@ -70,8 +70,8 @@ protected boolean returnCovariance() { @Override protected Options getOptions() { Options opts = super.getOptions(); - opts.addOption("phi", "confidence", true, "Confidence parameter [default 0.5]"); - opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.7]"); + opts.addOption("phi", "confidence", true, "Confidence parameter [default 1.0]"); + opts.addOption("eta", "hyper_c", true, "Confidence hyperparameter eta in range (0.5, 1] [default 0.85]"); opts.addOption("c", "aggressiveness", true, "Aggressiveness parameter C [default 1.0]"); return opts; } @@ -80,7 +80,7 @@ protected Options getOptions() { protected CommandLine processOptions(ObjectInspector[] argOIs) throws UDFArgumentException { final CommandLine cl = super.processOptions(argOIs); - float phi = 0.5f; + float phi = 1.f; float c = 1.f; if(cl != null) { String phi_str = cl.getOptionValue("phi"); diff --git a/src/main/hivemall/common/WeightValue.java b/src/main/hivemall/common/WeightValue.java index 11accdb8..31708be9 100644 --- a/src/main/hivemall/common/WeightValue.java +++ b/src/main/hivemall/common/WeightValue.java @@ -61,7 +61,7 @@ public String toString() { } public static final class WeightValueWithCovar extends WeightValue { - public static float DEFAULT_COVAR = 1.f; + public static final float DEFAULT_COVAR = 1.f; final float covariance; diff --git a/src/main/hivemall/ensemble/ArgminKLDistanceUDAF.java b/src/main/hivemall/ensemble/ArgminKLDistanceUDAF.java index 1dd830d1..1a3effeb 100644 --- a/src/main/hivemall/ensemble/ArgminKLDistanceUDAF.java +++ b/src/main/hivemall/ensemble/ArgminKLDistanceUDAF.java @@ -5,7 +5,7 @@ import org.apache.hadoop.hive.ql.exec.UDAFEvaluator; import org.apache.hadoop.io.FloatWritable; -@Description(name = "argmin_kld", value = "_FUNC_(mean [, covar]) - Returns mean or covar that minimize a KL-distance among distributions", extended = "The returned value is (1.0 / (sum(1.0 / covar))) * (sum(mean / covar)") +@Description(name = "argmin_kld", value = "_FUNC_([mean,] covar) - Returns mean or covar that minimize a KL-distance among distributions", extended = "The returned value is (1.0 / (sum(1.0 / covar))) * (sum(mean / covar)") public class ArgminKLDistanceUDAF extends UDAF { public static class ArgminMeanUDAFEvaluator implements UDAFEvaluator { @@ -95,7 +95,7 @@ public boolean merge(FloatWritable o) { } public FloatWritable terminate() { - return empty ? null : new FloatWritable(sum_inv_covar); + return empty ? null : new FloatWritable(1.f / sum_inv_covar); } } diff --git a/src/main/hivemall/utils/lang/NumberUtils.java b/src/main/hivemall/utils/lang/NumberUtils.java index ac6cea7e..27885ba0 100644 --- a/src/main/hivemall/utils/lang/NumberUtils.java +++ b/src/main/hivemall/utils/lang/NumberUtils.java @@ -1,3 +1,23 @@ +/* + * Hivemall: Hive scalable Machine Learning Library + * + * Copyright (C) 2013-2014 + * National Institute of Advanced Industrial Science and Technology (AIST) + * Registration Number: H25PRO-1520 + * + * This library 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ package hivemall.utils.lang; public final class NumberUtils { diff --git a/target/hivemall.jar b/target/hivemall.jar index 3bab9bd7..1f653c00 100644 Binary files a/target/hivemall.jar and b/target/hivemall.jar differ