Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #93 from myui/hotfixes
Browse files Browse the repository at this point in the history
Hotfixes
  • Loading branch information
myui committed Aug 3, 2014
2 parents 7073c7f + f093437 commit cb34e0a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/main/hivemall/classifier/ConfidenceWeightedUDTF.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ 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;
}

@Override
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) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/hivemall/classifier/SoftConfideceWeightedUDTF.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ 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;
}

@Override
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/main/hivemall/common/WeightValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/main/hivemall/ensemble/ArgminKLDistanceUDAF.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}

Expand Down
20 changes: 20 additions & 0 deletions src/main/hivemall/utils/lang/NumberUtils.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Binary file modified target/hivemall.jar
Binary file not shown.

0 comments on commit cb34e0a

Please sign in to comment.