Fix typos
Project: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/commit/5ac14b7d Tree: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/tree/5ac14b7d Diff: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/diff/5ac14b7d Branch: refs/heads/master Commit: 5ac14b7d8f1bb3232f3b18009bac060588831a8f Parents: 8e4351c Author: Takuya Kitazawa <tak...@apache.org> Authored: Fri Apr 13 15:41:16 2018 +0900 Committer: Takuya Kitazawa <tak...@apache.org> Committed: Fri Apr 13 15:41:16 2018 +0900 ---------------------------------------------------------------------- .../java/hivemall/anomaly/ChangeFinderUDF.java | 6 ++-- core/src/main/java/hivemall/anomaly/SDAR1D.java | 4 +-- core/src/main/java/hivemall/anomaly/SDAR2D.java | 14 ++++----- .../anomaly/SingularSpectrumTransformUDF.java | 4 +-- .../hivemall/common/RandomizedAmplifier.java | 8 +++--- .../LogisticRegressionDataGeneratorUDTF.java | 2 +- .../main/java/hivemall/evaluation/AUCUDAF.java | 2 +- .../java/hivemall/evaluation/HitRateUDAF.java | 2 +- .../main/java/hivemall/evaluation/MAPUDAF.java | 2 +- .../main/java/hivemall/evaluation/MRRUDAF.java | 2 +- .../main/java/hivemall/evaluation/NDCGUDAF.java | 2 +- .../java/hivemall/evaluation/PrecisionUDAF.java | 2 +- .../java/hivemall/evaluation/RecallUDAF.java | 2 +- core/src/main/java/hivemall/fm/Entry.java | 2 +- .../java/hivemall/fm/FMHyperParameters.java | 12 ++++---- .../hivemall/fm/FactorizationMachineUDTF.java | 4 +-- core/src/main/java/hivemall/fm/Feature.java | 6 ++-- .../fm/FieldAwareFactorizationMachineModel.java | 10 +++---- .../ftvec/binning/FeatureBinningUDF.java | 2 +- .../ftvec/binning/NumericHistogram.java | 2 +- .../ftvec/conv/QuantifyColumnsUDTF.java | 4 +-- .../ftvec/pairing/PolynomialFeaturesUDF.java | 4 +-- .../ftvec/trans/AddFieldIndicesUDF.java | 8 +++--- .../hivemall/ftvec/trans/BinarizeLabelUDTF.java | 2 +- .../ftvec/trans/CategoricalFeaturesUDF.java | 8 +++--- .../hivemall/ftvec/trans/FFMFeaturesUDF.java | 6 ++-- .../ftvec/trans/QuantifiedFeaturesUDTF.java | 14 ++++----- .../ftvec/trans/QuantitativeFeaturesUDF.java | 2 +- .../ftvec/trans/VectorizeFeaturesUDF.java | 2 +- .../main/java/hivemall/knn/lsh/MinHashUDTF.java | 2 +- .../knn/similarity/CosineSimilarityUDF.java | 2 +- .../math/matrix/builders/MatrixBuilder.java | 4 +-- .../hivemall/math/matrix/sparse/CSCMatrix.java | 2 +- .../hivemall/math/matrix/sparse/CSRMatrix.java | 2 +- .../matrix/sparse/floats/CSCFloatMatrix.java | 2 +- .../matrix/sparse/floats/CSRFloatMatrix.java | 2 +- .../hivemall/mf/BPRMatrixFactorizationUDTF.java | 4 +-- .../main/java/hivemall/mf/FactorizedModel.java | 12 ++++---- .../mf/OnlineMatrixFactorizationUDTF.java | 2 +- .../java/hivemall/mf/RatingInitializer.java | 25 ++++++++++++++++ .../main/java/hivemall/mf/RatingInitilizer.java | 25 ---------------- core/src/main/java/hivemall/mix/MixMessage.java | 2 +- .../main/java/hivemall/recommend/SlimUDTF.java | 2 +- .../PassiveAggressiveRegressionUDTF.java | 2 +- .../smile/classification/DecisionTree.java | 24 ++++++++-------- .../GradientTreeBoostingClassifierUDTF.java | 14 ++++----- .../RandomForestClassifierUDTF.java | 12 ++++---- .../regression/RandomForestRegressionUDTF.java | 12 ++++---- .../smile/regression/RegressionTree.java | 20 ++++++------- .../smile/tools/RandomForestEnsembleUDAF.java | 8 +++--- .../hivemall/smile/tools/TreePredictUDF.java | 6 ++-- .../hivemall/smile/tools/TreePredictUDFv1.java | 4 +-- .../hivemall/smile/utils/SmileExtUtils.java | 4 +-- .../hivemall/smile/utils/SmileTaskExecutor.java | 2 +- .../java/hivemall/smile/vm/StackMachine.java | 4 +-- .../java/hivemall/tools/GenerateSeriesUDTF.java | 2 +- .../hivemall/tools/array/ArrayUnionUDF.java | 6 ++-- .../hivemall/tools/array/CollectAllUDAF.java | 2 +- .../hivemall/tools/array/LastElementUDF.java | 2 +- .../hivemall/tools/compress/DeflateUDF.java | 2 +- .../hivemall/tools/map/UDAFToOrderedMap.java | 2 +- .../java/hivemall/tools/text/SplitWordsUDF.java | 2 +- .../hivemall/tools/vector/VectorDotUDF.java | 8 +++--- .../utils/collections/arrays/DoubleArray3D.java | 4 +-- .../java/hivemall/utils/hadoop/HiveUtils.java | 6 ++-- .../java/hivemall/utils/math/MatrixUtils.java | 30 ++++++++++---------- .../hivemall/anomaly/ChangeFinder2DTest.java | 2 +- .../common/RandomizedAmplifierTest.java | 6 ++-- .../test/java/hivemall/fm/ArrayModelTest.java | 2 +- .../smile/regression/RegressionTreeTest.java | 8 +++--- .../tools/array/ConditionalEmitUDTFTest.java | 6 ++-- .../java/hivemall/utils/math/FastMathTest.java | 14 ++++----- docs/gitbook/ft_engineering/vectorization.md | 2 +- .../hivemall/mix/metrics/ThroughputCounter.java | 4 +-- .../java/hivemall/xgboost/NativeLibLoader.java | 4 +-- 75 files changed, 227 insertions(+), 227 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/anomaly/ChangeFinderUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/anomaly/ChangeFinderUDF.java b/core/src/main/java/hivemall/anomaly/ChangeFinderUDF.java index b6c71c9..47d41e9 100644 --- a/core/src/main/java/hivemall/anomaly/ChangeFinderUDF.java +++ b/core/src/main/java/hivemall/anomaly/ChangeFinderUDF.java @@ -97,7 +97,7 @@ public final class ChangeFinderUDF extends UDFWithOptions { true, "Score threshold (inclusive) for determining change-point existence [default: -1, do not output decision]"); opts.addOption("loss1", "lossfunc1", true, - "Loss function for outliter scoring [default: hellinger, logloss]"); + "Loss function for outlier scoring [default: hellinger, logloss]"); opts.addOption("loss2", "lossfunc2", true, "Loss function for change point scoring [default: hellinger, logloss]"); return opts; @@ -126,8 +126,8 @@ public final class ChangeFinderUDF extends UDFWithOptions { "r1 must be in range (0,1): " + _params.r1); Preconditions.checkArgument(_params.r2 > 0.d && _params.r2 < 1.d, "r2 must be in range (0,1): " + _params.r2); - Preconditions.checkArgument(_params.T1 >= 2, "T1 must be greather than 1: " + _params.T1); - Preconditions.checkArgument(_params.T2 >= 2, "T2 must be greather than 1: " + _params.T2); + Preconditions.checkArgument(_params.T1 >= 2, "T1 must be greater than 1: " + _params.T1); + Preconditions.checkArgument(_params.T2 >= 2, "T2 must be greater than 1: " + _params.T2); return cl; } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/anomaly/SDAR1D.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/anomaly/SDAR1D.java b/core/src/main/java/hivemall/anomaly/SDAR1D.java index 92185be..5b2e76e 100644 --- a/core/src/main/java/hivemall/anomaly/SDAR1D.java +++ b/core/src/main/java/hivemall/anomaly/SDAR1D.java @@ -63,8 +63,8 @@ public final class SDAR1D { * @return x_hat predicted x */ public double update(@Nonnull final double[] x, final int k) { - Preconditions.checkArgument(x.length >= 1, "x.length MUST be greather than 1: ", x.length); - Preconditions.checkArgument(k >= 0, "k MUST be greather than or equals to 0: ", k); + Preconditions.checkArgument(x.length >= 1, "x.length MUST be greater than 1: ", x.length); + Preconditions.checkArgument(k >= 0, "k MUST be greater than or equals to 0: ", k); Preconditions.checkArgument(k < _C.length, "k MUST be less than |C| but ", "k=", k + ", |C|=", _C.length); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/anomaly/SDAR2D.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/anomaly/SDAR2D.java b/core/src/main/java/hivemall/anomaly/SDAR2D.java index fbc9b1f..7198067 100644 --- a/core/src/main/java/hivemall/anomaly/SDAR2D.java +++ b/core/src/main/java/hivemall/anomaly/SDAR2D.java @@ -68,8 +68,8 @@ public final class SDAR2D { */ @Nonnull public RealVector update(@Nonnull final ArrayRealVector[] x, final int k) { - Preconditions.checkArgument(x.length >= 1, "x.length MUST be greather than 1: " + x.length); - Preconditions.checkArgument(k >= 0, "k MUST be greather than or equals to 0: ", k); + Preconditions.checkArgument(x.length >= 1, "x.length MUST be greater than 1: " + x.length); + Preconditions.checkArgument(k >= 0, "k MUST be greater than or equals to 0: ", k); Preconditions.checkArgument(k < _C.length, "k MUST be less than |C| but " + "k=" + k + ", |C|=" + _C.length); @@ -102,7 +102,7 @@ public final class SDAR2D { // update covariance matrices // C_j := (1-r) C_j + r (x_t - \hat{µ}) (x_{t-j} - \hat{µ})' final RealMatrix[] C = this._C; - final RealVector rxResidual0 = xResidual[0].mapMultiply(_r); // r (x_t - \hat{µ}) + final RealVector rxResidual0 = xResidual[0].mapMultiply(_r); // r (x_t - \hat{µ}) for (int j = 0; j <= k; j++) { RealMatrix Cj = C[j]; if (Cj == null) { @@ -114,9 +114,9 @@ public final class SDAR2D { } // solve A in the following Yule-Walker equation - // C_j = â_{i=1}^{k} A_i C_{j-i} where j = 1..k, C_{-i} = C_i' + // C_j = â_{i=1}^{k} A_i C_{j-i} where j = 1..k, C_{-i} = C_i' /* - * /C_1\ /A_1\ /C_0 |C_1' |C_2' | . . . |C_{k-1}' \ + * /C_1\ /A_1\ /C_0 |C_1' |C_2' | . . . |C_{k-1}' \ * |---| |---| |--------+--------+--------+ +---------| * |C_2| |A_2| |C_1 |C_0 |C_1' | . | * |---| |---| |--------+--------+--------+ . | @@ -125,7 +125,7 @@ public final class SDAR2D { * | . | | . | | . . | * | . | | . | | . . | * |---| |---| |--------+ +--------| - * \C_k/ \A_k/ \C_{k-1} | . . . |C_0 / + * \C_k/ \A_k/ \C_{k-1} | . . . |C_0 / */ RealMatrix[][] rhs = MatrixUtils.toeplitz(C, k); RealMatrix[] lhs = Arrays.copyOfRange(C, 1, k + 1); @@ -143,7 +143,7 @@ public final class SDAR2D { } // update model covariance - // â := (1-r) â + r (x - \hat{x}) (x - \hat{x})' + // â := (1-r) â + r (x - \hat{x}) (x - \hat{x})' RealVector xEstimateResidual = x_t.subtract(x_hat); this._sigma = _sigma.scalarMultiply(1.d - _r).add( xEstimateResidual.mapMultiply(_r).outerProduct(xEstimateResidual)); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/anomaly/SingularSpectrumTransformUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/anomaly/SingularSpectrumTransformUDF.java b/core/src/main/java/hivemall/anomaly/SingularSpectrumTransformUDF.java index d718e12..3369edc 100644 --- a/core/src/main/java/hivemall/anomaly/SingularSpectrumTransformUDF.java +++ b/core/src/main/java/hivemall/anomaly/SingularSpectrumTransformUDF.java @@ -130,13 +130,13 @@ public final class SingularSpectrumTransformUDF extends UDFWithOptions { _params.changepointThreshold); Preconditions.checkArgument(_params.w >= 2, UDFArgumentException.class, - "w must be greather than 1: " + _params.w); + "w must be greater than 1: " + _params.w); Preconditions.checkArgument(_params.r >= 1, UDFArgumentException.class, "r must be greater than 0: " + _params.r); Preconditions.checkArgument(_params.k >= 1, UDFArgumentException.class, "k must be greater than 0: " + _params.k); Preconditions.checkArgument(_params.k >= _params.r, UDFArgumentException.class, - "k must be equals to or greather than r: k=" + _params.k + ", r" + _params.r); + "k must be equals to or greater than r: k=" + _params.k + ", r" + _params.r); Preconditions.checkArgument(_params.changepointThreshold > 0.d && _params.changepointThreshold < 1.d, UDFArgumentException.class, "changepointThreshold must be in range (0, 1): " + _params.changepointThreshold); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/common/RandomizedAmplifier.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/common/RandomizedAmplifier.java b/core/src/main/java/hivemall/common/RandomizedAmplifier.java index 7f37ec5..471fb5f 100644 --- a/core/src/main/java/hivemall/common/RandomizedAmplifier.java +++ b/core/src/main/java/hivemall/common/RandomizedAmplifier.java @@ -126,12 +126,12 @@ public final class RandomizedAmplifier<T> { } } - protected void dropout(T droppped) throws HiveException { - if (droppped == null) { + protected void dropout(T dropped) throws HiveException { + if (dropped == null) { throw new IllegalStateException("Illegal condition that dropped object is null"); } if (listener != null) { - listener.onDrop(droppped); + listener.onDrop(dropped); } } @@ -152,7 +152,7 @@ public final class RandomizedAmplifier<T> { } public interface DropoutListener<T> { - void onDrop(T droppped) throws HiveException; + void onDrop(T dropped) throws HiveException; } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/dataset/LogisticRegressionDataGeneratorUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/dataset/LogisticRegressionDataGeneratorUDTF.java b/core/src/main/java/hivemall/dataset/LogisticRegressionDataGeneratorUDTF.java index 3da1fd0..d07089a 100644 --- a/core/src/main/java/hivemall/dataset/LogisticRegressionDataGeneratorUDTF.java +++ b/core/src/main/java/hivemall/dataset/LogisticRegressionDataGeneratorUDTF.java @@ -115,7 +115,7 @@ public final class LogisticRegressionDataGeneratorUDTF extends UDTFWithOptions { if (dense) { if (n_features != n_dimensions) { throw new UDFArgumentException("n_features '" + n_features - + "' must be equlas to n_dimensions '" + n_dimensions + + "' must be equals to n_dimensions '" + n_dimensions + "' when making a dense dataset"); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/AUCUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/AUCUDAF.java b/core/src/main/java/hivemall/evaluation/AUCUDAF.java index 3c7faa7..9cacaa8 100644 --- a/core/src/main/java/hivemall/evaluation/AUCUDAF.java +++ b/core/src/main/java/hivemall/evaluation/AUCUDAF.java @@ -509,7 +509,7 @@ public final class AUCUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/HitRateUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/HitRateUDAF.java b/core/src/main/java/hivemall/evaluation/HitRateUDAF.java index 522c0f1..b6d74f1 100644 --- a/core/src/main/java/hivemall/evaluation/HitRateUDAF.java +++ b/core/src/main/java/hivemall/evaluation/HitRateUDAF.java @@ -178,7 +178,7 @@ public final class HitRateUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/MAPUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/MAPUDAF.java b/core/src/main/java/hivemall/evaluation/MAPUDAF.java index 8f3922d..437fab7 100644 --- a/core/src/main/java/hivemall/evaluation/MAPUDAF.java +++ b/core/src/main/java/hivemall/evaluation/MAPUDAF.java @@ -160,7 +160,7 @@ public final class MAPUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/MRRUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/MRRUDAF.java b/core/src/main/java/hivemall/evaluation/MRRUDAF.java index 70e6af5..1f5a95c 100644 --- a/core/src/main/java/hivemall/evaluation/MRRUDAF.java +++ b/core/src/main/java/hivemall/evaluation/MRRUDAF.java @@ -160,7 +160,7 @@ public final class MRRUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/NDCGUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/NDCGUDAF.java b/core/src/main/java/hivemall/evaluation/NDCGUDAF.java index 86990d8..7510bac 100644 --- a/core/src/main/java/hivemall/evaluation/NDCGUDAF.java +++ b/core/src/main/java/hivemall/evaluation/NDCGUDAF.java @@ -163,7 +163,7 @@ public final class NDCGUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/PrecisionUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/PrecisionUDAF.java b/core/src/main/java/hivemall/evaluation/PrecisionUDAF.java index 8dc9b3a..ef0c81f 100644 --- a/core/src/main/java/hivemall/evaluation/PrecisionUDAF.java +++ b/core/src/main/java/hivemall/evaluation/PrecisionUDAF.java @@ -161,7 +161,7 @@ public final class PrecisionUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/evaluation/RecallUDAF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/evaluation/RecallUDAF.java b/core/src/main/java/hivemall/evaluation/RecallUDAF.java index 427ae7b..cc2e27e 100644 --- a/core/src/main/java/hivemall/evaluation/RecallUDAF.java +++ b/core/src/main/java/hivemall/evaluation/RecallUDAF.java @@ -160,7 +160,7 @@ public final class RecallUDAF extends AbstractGenericUDAFResolver { recommendSize = PrimitiveObjectInspectorUtils.getInt(parameters[2], recommendSizeOI); if (recommendSize < 0) { throw new UDFArgumentException( - "The third argument `int recommendSize` must be in greather than or equals to 0: " + "The third argument `int recommendSize` must be in greater than or equals to 0: " + recommendSize); } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/fm/Entry.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/fm/Entry.java b/core/src/main/java/hivemall/fm/Entry.java index 974ab5b..370e727 100644 --- a/core/src/main/java/hivemall/fm/Entry.java +++ b/core/src/main/java/hivemall/fm/Entry.java @@ -158,7 +158,7 @@ class Entry { void clear() {}; static int sizeOf(@Nonnegative final int factors) { - Preconditions.checkArgument(factors >= 1, "Factors must be greather than 0: " + factors); + Preconditions.checkArgument(factors >= 1, "Factors must be greater than 0: " + factors); return SizeOf.FLOAT * factors; } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/fm/FMHyperParameters.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/fm/FMHyperParameters.java b/core/src/main/java/hivemall/fm/FMHyperParameters.java index e4254dd..69c19a8 100644 --- a/core/src/main/java/hivemall/fm/FMHyperParameters.java +++ b/core/src/main/java/hivemall/fm/FMHyperParameters.java @@ -67,7 +67,7 @@ class FMHyperParameters { double convergenceRate = 0.005d; // adaptive regularization - boolean adaptiveReglarization = false; + boolean adaptiveRegularization = false; float validationRatio = 0.05f; int validationThreshold = 1000; boolean parseFeatureAsInt = false; @@ -82,7 +82,7 @@ class FMHyperParameters { + vInit + ", minTarget=" + minTarget + ", maxTarget=" + maxTarget + ", eta=" + eta + ", numFeatures=" + numFeatures + ", l2norm=" + l2norm + ", iters=" + iters + ", conversionCheck=" + conversionCheck + ", convergenceRate=" + convergenceRate - + ", adaptiveReglarization=" + adaptiveReglarization + ", validationRatio=" + + ", adaptiveRegularization=" + adaptiveRegularization + ", validationRatio=" + validationRatio + ", validationThreshold=" + validationThreshold + ", parseFeatureAsInt=" + parseFeatureAsInt + "]"; } @@ -108,7 +108,7 @@ class FMHyperParameters { this.iters = Primitives.parseInt(cl.getOptionValue("iterations"), iters); this.conversionCheck = !cl.hasOption("disable_cvtest"); this.convergenceRate = Primitives.parseDouble(cl.getOptionValue("cv_rate"), convergenceRate); - this.adaptiveReglarization = cl.hasOption("adaptive_regularizaion"); + this.adaptiveRegularization = cl.hasOption("adaptive_regularization"); this.validationRatio = Primitives.parseFloat(cl.getOptionValue("validation_ratio"), validationRatio); if (validationRatio < 0.f || validationRatio >= 1.f) { @@ -154,7 +154,7 @@ class FMHyperParameters { float alphaFTRL = 0.2f; // Learning Rate float betaFTRL = 1.f; // Smoothing parameter for AdaGrad float lambda1 = 0.001f; // L1 Regularization - float lamdda2 = 0.0001f; // L2 Regularization + float lambda2 = 0.0001f; // L2 Regularization FFMHyperParameters() { super(); @@ -200,7 +200,7 @@ class FMHyperParameters { } this.betaFTRL = Primitives.parseFloat(cl.getOptionValue("betaFTRL"), betaFTRL); this.lambda1 = Primitives.parseFloat(cl.getOptionValue("lambda1"), lambda1); - this.lamdda2 = Primitives.parseFloat(cl.getOptionValue("lamdda2"), lamdda2); + this.lambda2 = Primitives.parseFloat(cl.getOptionValue("lambda2"), lambda2); break; } case "adagrad": { @@ -224,7 +224,7 @@ class FMHyperParameters { return "FFMHyperParameters [globalBias=" + globalBias + ", linearCoeff=" + linearCoeff + ", numFields=" + numFields + ", useAdaGrad=" + useAdaGrad + ", eps=" + eps + ", useFTRL=" + useFTRL + ", alphaFTRL=" + alphaFTRL + ", betaFTRL=" - + betaFTRL + ", lambda1=" + lambda1 + ", lamdda2=" + lamdda2 + "], " + + betaFTRL + ", lambda1=" + lambda1 + ", lambda2=" + lambda2 + "], " + super.toString(); } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java b/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java index cb72d0f..bbb3ef1 100644 --- a/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java +++ b/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java @@ -146,7 +146,7 @@ public class FactorizationMachineUDTF extends UDTFWithOptions { "Threshold to determine convergence [default: 0.005]"); // adaptive regularization if (isAdaptiveRegularizationSupported()) { - opts.addOption("adareg", "adaptive_regularizaion", false, + opts.addOption("adareg", "adaptive_regularization", false, "Whether to enable adaptive regularization [default: OFF]"); opts.addOption("va_ratio", "validation_ratio", true, "Ratio of training data used for validation [default: 0.05f]"); @@ -189,7 +189,7 @@ public class FactorizationMachineUDTF extends UDTFWithOptions { this._iterations = params.iters; this._factors = params.factors; this._parseFeatureAsInt = params.parseFeatureAsInt; - if (params.adaptiveReglarization) { + if (params.adaptiveRegularization) { this._va_rand = new Random(params.seed + 31L); } this._validationRatio = params.validationRatio; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/fm/Feature.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/fm/Feature.java b/core/src/main/java/hivemall/fm/Feature.java index c4915ca..e6a03ac 100644 --- a/core/src/main/java/hivemall/fm/Feature.java +++ b/core/src/main/java/hivemall/fm/Feature.java @@ -33,7 +33,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector; public abstract class Feature { public static final int DEFAULT_NUM_FIELDS = 256; public static final int DEFAULT_FEATURE_BITS = 21; - public static final int DEFAULT_NUM_FEATURES = 1 << 21; // 2^21 + public static final int DEFAULT_NUM_FEATURES = 1 << 21; // 2^21 protected double value; @@ -224,7 +224,7 @@ public abstract class Feature { final int pos2 = rest.indexOf(':'); if (pos2 == -1) { throw new HiveException( - "Invalid FFM feature repsentation. Expected <field>:<index>:<value> but got " + fv); + "Invalid FFM feature representation. Expected <field>:<index>:<value> but got " + fv); } final short field; @@ -295,7 +295,7 @@ public abstract class Feature { final int pos2 = rest.indexOf(':'); if (pos2 == -1) { throw new HiveException( - "Invalid FFM feature repsentation. Expected <field>:<index>:<value> but got " + fv); + "Invalid FFM feature representation. Expected <field>:<index>:<value> but got " + fv); } final short field; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/fm/FieldAwareFactorizationMachineModel.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/fm/FieldAwareFactorizationMachineModel.java b/core/src/main/java/hivemall/fm/FieldAwareFactorizationMachineModel.java index 730d0f4..4c0d83e 100644 --- a/core/src/main/java/hivemall/fm/FieldAwareFactorizationMachineModel.java +++ b/core/src/main/java/hivemall/fm/FieldAwareFactorizationMachineModel.java @@ -46,7 +46,7 @@ public abstract class FieldAwareFactorizationMachineModel extends FactorizationM private final float _alpha; private final float _beta; private final float _lambda1; - private final float _lamdda2; + private final float _lambda2; public FieldAwareFactorizationMachineModel(@Nonnull FFMHyperParameters params) { super(params); @@ -62,7 +62,7 @@ public abstract class FieldAwareFactorizationMachineModel extends FactorizationM this._alpha = params.alphaFTRL; this._beta = params.betaFTRL; this._lambda1 = params.lambda1; - this._lamdda2 = params.lamdda2; + this._lambda2 = params.lambda2; } public abstract float getV(@Nonnull Feature x, @Nonnull int yField, int f); @@ -160,7 +160,7 @@ public abstract class FieldAwareFactorizationMachineModel extends FactorizationM } final float nextWi = (float) ((MathUtils.sign(z) * _lambda1 - z) / ((_beta + Math.sqrt(n)) - / _alpha + _lamdda2)); + / _alpha + _lambda2)); if (!NumberUtils.isFinite(nextWi)) { throw new IllegalStateException("Got " + nextWi + " for next W[" + x.getFeature() + "]\n" + "Xi=" + Xi + ", gradWi=" + gradWi + ", wi=" + theta.getW() @@ -235,7 +235,7 @@ public abstract class FieldAwareFactorizationMachineModel extends FactorizationM } final float nextV = (float) ((MathUtils.sign(z) * _lambda1 - z) / ((_beta + Math.sqrt(n)) - / _alpha + _lamdda2)); + / _alpha + _lambda2)); if (!NumberUtils.isFinite(nextV)) { throw new IllegalStateException("Got " + nextV + " for next V" + f + '[' + x.getFeatureIndex() + "]\n" + "Xi=" + Xi + ", Vif=" + theta.getV(f) + ", h=" @@ -346,7 +346,7 @@ public abstract class FieldAwareFactorizationMachineModel extends FactorizationM } buf1.append("\n"); - // w0 + // w0 double ret = getW0(); buf1.append("predict(x) = w0"); buf2.append("predict(x) = ").append(ret); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/binning/FeatureBinningUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/binning/FeatureBinningUDF.java b/core/src/main/java/hivemall/ftvec/binning/FeatureBinningUDF.java index 3176490..14966bf 100644 --- a/core/src/main/java/hivemall/ftvec/binning/FeatureBinningUDF.java +++ b/core/src/main/java/hivemall/ftvec/binning/FeatureBinningUDF.java @@ -42,7 +42,7 @@ import java.util.*; @Description( name = "feature_binning", value = "_FUNC_(array<features::string> features, const map<string, array<number>> quantiles_map)" - + " / _FUNC(number weight, const array<number> quantiles)" + + " / _FUNC_(number weight, const array<number> quantiles)" + " - Returns binned features as an array<features::string> / bin ID as int") @UDFType(deterministic = true, stateful = false) public final class FeatureBinningUDF extends GenericUDF { http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/binning/NumericHistogram.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/binning/NumericHistogram.java b/core/src/main/java/hivemall/ftvec/binning/NumericHistogram.java index 51b9368..e4c4d4d 100644 --- a/core/src/main/java/hivemall/ftvec/binning/NumericHistogram.java +++ b/core/src/main/java/hivemall/ftvec/binning/NumericHistogram.java @@ -174,7 +174,7 @@ public final class NumericHistogram { */ public void add(double v) { // Binary search to find the closest bucket that v should go into. - // 'bin' should be interpreted as the bin to shift right in order to accomodate + // 'bin' should be interpreted as the bin to shift right in order to accommodate // v. As a result, bin is in the range [0,N], where N means that the value v is // greater than all the N bins currently in the histogram. It is also possible that // a bucket centered at 'v' already exists, so this must be checked in the next step. http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/conv/QuantifyColumnsUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/conv/QuantifyColumnsUDTF.java b/core/src/main/java/hivemall/ftvec/conv/QuantifyColumnsUDTF.java index e8214a1..dcca752 100644 --- a/core/src/main/java/hivemall/ftvec/conv/QuantifyColumnsUDTF.java +++ b/core/src/main/java/hivemall/ftvec/conv/QuantifyColumnsUDTF.java @@ -35,7 +35,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectIn import org.apache.hadoop.io.IntWritable; @Description(name = "quantify", - value = "_FUNC_(boolean outout, col1, col2, ...) - Returns an identified features") + value = "_FUNC_(boolean output, col1, col2, ...) - Returns an identified features") public final class QuantifyColumnsUDTF extends GenericUDTF { private BooleanObjectInspector boolOI; @@ -99,7 +99,7 @@ public final class QuantifyColumnsUDTF extends GenericUDTF { } } forward(forwardObjs); - } else {// load only + } else {// load only for (int i = 0, outputSize = args.length - 1; i < outputSize; i++) { Identifier<String> identifier = identifiers[i]; if (identifier != null) { http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/pairing/PolynomialFeaturesUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/pairing/PolynomialFeaturesUDF.java b/core/src/main/java/hivemall/ftvec/pairing/PolynomialFeaturesUDF.java index 742e76d..613d9f9 100644 --- a/core/src/main/java/hivemall/ftvec/pairing/PolynomialFeaturesUDF.java +++ b/core/src/main/java/hivemall/ftvec/pairing/PolynomialFeaturesUDF.java @@ -37,7 +37,7 @@ import org.apache.hadoop.io.Text; */ @Description(name = "polynomial_features", value = "_FUNC_(feature_vector in array<string>) - Returns a feature vector" - + "having polynominal feature space") + + "having polynomial feature space") @UDFType(deterministic = true, stateful = false) public final class PolynomialFeaturesUDF extends UDF { @@ -88,7 +88,7 @@ public final class PolynomialFeaturesUDF extends UDF { final int currentDegree, final int degree, final List<FeatureValue> srcVec, final int currentSrcPos, final List<Text> dstVec, final boolean interactionOnly, final boolean truncate) { - assert (currentDegree <= degree) : "currentDegree: " + currentDegree + ", degress: " + assert (currentDegree <= degree) : "currentDegree: " + currentDegree + ", degree: " + degree; final int lastSrcIndex = srcVec.size() - 1; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/AddFieldIndicesUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/AddFieldIndicesUDF.java b/core/src/main/java/hivemall/ftvec/trans/AddFieldIndicesUDF.java index 99cf785..3713cb3 100644 --- a/core/src/main/java/hivemall/ftvec/trans/AddFieldIndicesUDF.java +++ b/core/src/main/java/hivemall/ftvec/trans/AddFieldIndicesUDF.java @@ -38,7 +38,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; @Description(name = "add_field_indices", value = "_FUNC_(array<string> features) " - + "- Returns arrays of string that field indices (<field>:<feature>)* are argumented") + + "- Returns arrays of string that field indices (<field>:<feature>)* are augmented") @UDFType(deterministic = true, stateful = false) public final class AddFieldIndicesUDF extends GenericUDF { @@ -68,16 +68,16 @@ public final class AddFieldIndicesUDF extends GenericUDF { return null; } - final List<String> argumented = new ArrayList<>(features.length); + final List<String> augmented = new ArrayList<>(features.length); for (int i = 0; i < features.length; i++) { final String f = features[i]; if (f == null) { continue; } - argumented.add((i + 1) + ":" + f); + augmented.add((i + 1) + ":" + f); } - return argumented; + return augmented; } @Override http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/BinarizeLabelUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/BinarizeLabelUDTF.java b/core/src/main/java/hivemall/ftvec/trans/BinarizeLabelUDTF.java index 6f8fc0a..c10095d 100644 --- a/core/src/main/java/hivemall/ftvec/trans/BinarizeLabelUDTF.java +++ b/core/src/main/java/hivemall/ftvec/trans/BinarizeLabelUDTF.java @@ -48,7 +48,7 @@ public final class BinarizeLabelUDTF extends GenericUDTF { @Override public StructObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException { if (argOIs.length < 3) { - throw new UDFArgumentException("binalize_label(int/long positive, " + throw new UDFArgumentException("binarize_label(int/long positive, " + "int/long negative, *) takes at least three arguments"); } this.positiveOI = HiveUtils.asIntCompatibleOI(argOIs[0]); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/CategoricalFeaturesUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/CategoricalFeaturesUDF.java b/core/src/main/java/hivemall/ftvec/trans/CategoricalFeaturesUDF.java index 4722efd..cb1ab18 100644 --- a/core/src/main/java/hivemall/ftvec/trans/CategoricalFeaturesUDF.java +++ b/core/src/main/java/hivemall/ftvec/trans/CategoricalFeaturesUDF.java @@ -58,9 +58,9 @@ public final class CategoricalFeaturesUDF extends UDFWithOptions { protected Options getOptions() { Options opts = new Options(); opts.addOption("no_elim", "no_elimination", false, - "Wheather to emit NULL and value [default: false]"); - opts.addOption("emit_null", false, "Wheather to emit NULL [default: false]"); - opts.addOption("force_value", false, "Wheather to force emit value [default: false]"); + "Whether to emit NULL and value [default: false]"); + opts.addOption("emit_null", false, "Whether to emit NULL [default: false]"); + opts.addOption("force_value", false, "Whether to force emit value [default: false]"); return opts; } @@ -159,7 +159,7 @@ public final class CategoricalFeaturesUDF extends UDFWithOptions { continue; } - // categorical feature representation + // categorical feature representation final String f; if (_forceValue) { f = _featureNames[i] + '#' + s + ":1"; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/FFMFeaturesUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/FFMFeaturesUDF.java b/core/src/main/java/hivemall/ftvec/trans/FFMFeaturesUDF.java index b72b51a..33539af 100644 --- a/core/src/main/java/hivemall/ftvec/trans/FFMFeaturesUDF.java +++ b/core/src/main/java/hivemall/ftvec/trans/FFMFeaturesUDF.java @@ -48,7 +48,7 @@ import org.apache.hadoop.io.Text; @Description( name = "ffm_features", value = "_FUNC_(const array<string> featureNames, feature1, feature2, .. [, const string options])" - + " - Takes categroical variables and returns a feature vector array<string>" + + " - Takes categorical variables and returns a feature vector array<string>" + " in a libffm format <field>:<index>:<value>") @UDFType(deterministic = true, stateful = false) public final class FFMFeaturesUDF extends UDFWithOptions { @@ -66,7 +66,7 @@ public final class FFMFeaturesUDF extends UDFWithOptions { protected Options getOptions() { Options opts = new Options(); opts.addOption("no_hash", "disable_feature_hashing", false, - "Wheather to disable feature hashing [default: false]"); + "Whether to disable feature hashing [default: false]"); // feature hashing opts.addOption("p", "num_features", true, "The size of feature dimensions [default: -1]"); opts.addOption("hash", "feature_hashing", true, @@ -186,7 +186,7 @@ public final class FFMFeaturesUDF extends UDFWithOptions { final String featureName = _featureNames[i]; final String feature = featureName + '#' + s; - // categorical feature representation + // categorical feature representation final String fv; if (_mhash) { int field = _emitIndices ? i http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/QuantifiedFeaturesUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/QuantifiedFeaturesUDTF.java b/core/src/main/java/hivemall/ftvec/trans/QuantifiedFeaturesUDTF.java index 846be97..9299976 100644 --- a/core/src/main/java/hivemall/ftvec/trans/QuantifiedFeaturesUDTF.java +++ b/core/src/main/java/hivemall/ftvec/trans/QuantifiedFeaturesUDTF.java @@ -49,7 +49,7 @@ public final class QuantifiedFeaturesUDTF extends GenericUDTF { private DoubleWritable[] columnValues; // lazy instantiation to avoid org.apache.hive.com.esotericsoftware.kryo.KryoException: java.lang.NullPointerException - private transient Object[] fowardObjs; + private transient Object[] forwardObjs; @SuppressWarnings("unchecked") @Override @@ -65,7 +65,7 @@ public final class QuantifiedFeaturesUDTF extends GenericUDTF { this.doubleOIs = new PrimitiveObjectInspector[outputSize]; this.columnValues = new DoubleWritable[outputSize]; this.identifiers = new Identifier[outputSize]; - this.fowardObjs = null; + this.forwardObjs = null; for (int i = 0; i < outputSize; i++) { columnValues[i] = new DoubleWritable(Double.NaN); @@ -87,8 +87,8 @@ public final class QuantifiedFeaturesUDTF extends GenericUDTF { @Override public void process(Object[] args) throws HiveException { - if (fowardObjs == null) { - this.fowardObjs = new Object[] {Arrays.asList(columnValues)}; + if (forwardObjs == null) { + this.forwardObjs = new Object[] {Arrays.asList(columnValues)}; } boolean outputRow = boolOI.get(args[0]); @@ -110,8 +110,8 @@ public final class QuantifiedFeaturesUDTF extends GenericUDTF { } } } - forward(fowardObjs); - } else {// load only + forward(forwardObjs); + } else {// load only for (int i = 0, outputSize = args.length - 1; i < outputSize; i++) { Identifier<String> identifier = identifiers[i]; if (identifier != null) { @@ -131,7 +131,7 @@ public final class QuantifiedFeaturesUDTF extends GenericUDTF { this.doubleOIs = null; this.identifiers = null; this.columnValues = null; - this.fowardObjs = null; + this.forwardObjs = null; } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/QuantitativeFeaturesUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/QuantitativeFeaturesUDF.java b/core/src/main/java/hivemall/ftvec/trans/QuantitativeFeaturesUDF.java index 38e35e2..00514cf 100644 --- a/core/src/main/java/hivemall/ftvec/trans/QuantitativeFeaturesUDF.java +++ b/core/src/main/java/hivemall/ftvec/trans/QuantitativeFeaturesUDF.java @@ -58,7 +58,7 @@ public final class QuantitativeFeaturesUDF extends UDFWithOptions { @Override protected Options getOptions() { Options opts = new Options(); - opts.addOption("emit_null", false, "Wheather to emit NULL [default: false]"); + opts.addOption("emit_null", false, "Whether to emit NULL [default: false]"); return opts; } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/ftvec/trans/VectorizeFeaturesUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/ftvec/trans/VectorizeFeaturesUDF.java b/core/src/main/java/hivemall/ftvec/trans/VectorizeFeaturesUDF.java index f2ecbb6..4a37f94 100644 --- a/core/src/main/java/hivemall/ftvec/trans/VectorizeFeaturesUDF.java +++ b/core/src/main/java/hivemall/ftvec/trans/VectorizeFeaturesUDF.java @@ -59,7 +59,7 @@ public final class VectorizeFeaturesUDF extends UDFWithOptions { @Override protected Options getOptions() { Options opts = new Options(); - opts.addOption("emit_null", false, "Wheather to emit NULL [default: false]"); + opts.addOption("emit_null", false, "Whether to emit NULL [default: false]"); return opts; } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/knn/lsh/MinHashUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/knn/lsh/MinHashUDTF.java b/core/src/main/java/hivemall/knn/lsh/MinHashUDTF.java index bf4a8fb..2d86337 100644 --- a/core/src/main/java/hivemall/knn/lsh/MinHashUDTF.java +++ b/core/src/main/java/hivemall/knn/lsh/MinHashUDTF.java @@ -50,7 +50,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectIn @Description( name = "minhash", value = "_FUNC_(ANY item, array<int|bigint|string> features [, constant string options])" - + " - Returns n differnce k-depth signatures (i.e., clusteid) for each item <clusteid, item>") + + " - Returns n different k-depth signatures (i.e., clusterid) for each item <clusterid, item>") @UDFType(deterministic = true, stateful = false) public final class MinHashUDTF extends UDTFWithOptions { http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/knn/similarity/CosineSimilarityUDF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/knn/similarity/CosineSimilarityUDF.java b/core/src/main/java/hivemall/knn/similarity/CosineSimilarityUDF.java index f907abe..163ec70 100644 --- a/core/src/main/java/hivemall/knn/similarity/CosineSimilarityUDF.java +++ b/core/src/main/java/hivemall/knn/similarity/CosineSimilarityUDF.java @@ -103,7 +103,7 @@ public final class CosineSimilarityUDF extends GenericUDF { @Override public String getDisplayString(String[] children) { - return "consine_similarity(" + Arrays.toString(children) + ")"; + return "cosine_similarity(" + Arrays.toString(children) + ")"; } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/math/matrix/builders/MatrixBuilder.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/math/matrix/builders/MatrixBuilder.java b/core/src/main/java/hivemall/math/matrix/builders/MatrixBuilder.java index 66bd1e2..6f8c46a 100644 --- a/core/src/main/java/hivemall/math/matrix/builders/MatrixBuilder.java +++ b/core/src/main/java/hivemall/math/matrix/builders/MatrixBuilder.java @@ -73,12 +73,12 @@ public abstract class MatrixBuilder { } if (feature.indexOf(':') != -1) { - throw new IllegalArgumentException("Invaliad feature format `<index>:<value>`: " + col); + throw new IllegalArgumentException("Invalid feature format `<index>:<value>`: " + col); } int colIndex = Integer.parseInt(feature); if (colIndex < 0) { - throw new IllegalArgumentException("Col index MUST be greather than or equals to 0: " + throw new IllegalArgumentException("Col index MUST be greater than or equals to 0: " + colIndex); } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/math/matrix/sparse/CSCMatrix.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/math/matrix/sparse/CSCMatrix.java b/core/src/main/java/hivemall/math/matrix/sparse/CSCMatrix.java index b55e204..3fe2202 100644 --- a/core/src/main/java/hivemall/math/matrix/sparse/CSCMatrix.java +++ b/core/src/main/java/hivemall/math/matrix/sparse/CSCMatrix.java @@ -52,7 +52,7 @@ public final class CSCMatrix extends ColumnMajorMatrix { @Nonnull double[] values, int numRows, int numColumns) { super(); Preconditions.checkArgument(columnPointers.length >= 1, - "rowPointers must be greather than 0: " + columnPointers.length); + "rowPointers must be greater than 0: " + columnPointers.length); Preconditions.checkArgument(rowIndices.length == values.length, "#rowIndices (" + rowIndices.length + ") must be equals to #values (" + values.length + ")"); this.columnPointers = columnPointers; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/math/matrix/sparse/CSRMatrix.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/math/matrix/sparse/CSRMatrix.java b/core/src/main/java/hivemall/math/matrix/sparse/CSRMatrix.java index c1fa6e4..5b63b68 100644 --- a/core/src/main/java/hivemall/math/matrix/sparse/CSRMatrix.java +++ b/core/src/main/java/hivemall/math/matrix/sparse/CSRMatrix.java @@ -54,7 +54,7 @@ public final class CSRMatrix extends RowMajorMatrix { @Nonnull double[] values, @Nonnegative int numColumns) { super(); Preconditions.checkArgument(rowPointers.length >= 1, - "rowPointers must be greather than 0: " + rowPointers.length); + "rowPointers must be greater than 0: " + rowPointers.length); Preconditions.checkArgument(columnIndices.length == values.length, "#columnIndices (" + columnIndices.length + ") must be equals to #values (" + values.length + ")"); this.rowPointers = rowPointers; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/math/matrix/sparse/floats/CSCFloatMatrix.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/math/matrix/sparse/floats/CSCFloatMatrix.java b/core/src/main/java/hivemall/math/matrix/sparse/floats/CSCFloatMatrix.java index 948b6d5..9421f1c 100644 --- a/core/src/main/java/hivemall/math/matrix/sparse/floats/CSCFloatMatrix.java +++ b/core/src/main/java/hivemall/math/matrix/sparse/floats/CSCFloatMatrix.java @@ -52,7 +52,7 @@ public final class CSCFloatMatrix extends ColumnMajorFloatMatrix { @Nonnull float[] values, int numRows, int numColumns) { super(); Preconditions.checkArgument(columnPointers.length >= 1, - "rowPointers must be greather than 0: " + columnPointers.length); + "rowPointers must be greater than 0: " + columnPointers.length); Preconditions.checkArgument(rowIndices.length == values.length, "#rowIndices (" + rowIndices.length + ") must be equals to #values (" + values.length + ")"); this.columnPointers = columnPointers; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/math/matrix/sparse/floats/CSRFloatMatrix.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/math/matrix/sparse/floats/CSRFloatMatrix.java b/core/src/main/java/hivemall/math/matrix/sparse/floats/CSRFloatMatrix.java index 3dd44de..174e8e6 100644 --- a/core/src/main/java/hivemall/math/matrix/sparse/floats/CSRFloatMatrix.java +++ b/core/src/main/java/hivemall/math/matrix/sparse/floats/CSRFloatMatrix.java @@ -54,7 +54,7 @@ public final class CSRFloatMatrix extends RowMajorFloatMatrix { @Nonnull float[] values, @Nonnegative int numColumns) { super(); Preconditions.checkArgument(rowPointers.length >= 1, - "rowPointers must be greather than 0: " + rowPointers.length); + "rowPointers must be greater than 0: " + rowPointers.length); Preconditions.checkArgument(columnIndices.length == values.length, "#columnIndices (" + columnIndices.length + ") must be equals to #values (" + values.length + ")"); this.rowPointers = rowPointers; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/mf/BPRMatrixFactorizationUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/mf/BPRMatrixFactorizationUDTF.java b/core/src/main/java/hivemall/mf/BPRMatrixFactorizationUDTF.java index 0f9b5fd..e4bd781 100644 --- a/core/src/main/java/hivemall/mf/BPRMatrixFactorizationUDTF.java +++ b/core/src/main/java/hivemall/mf/BPRMatrixFactorizationUDTF.java @@ -62,7 +62,7 @@ import org.apache.hadoop.mapred.Reporter; @Description(name = "train_bprmf", value = "_FUNC_(INT user, INT posItem, INT negItem [, String options])" + " - Returns a relation <INT i, FLOAT Pi, FLOAT Qi [, FLOAT Bi]>") -public final class BPRMatrixFactorizationUDTF extends UDTFWithOptions implements RatingInitilizer { +public final class BPRMatrixFactorizationUDTF extends UDTFWithOptions implements RatingInitializer { private static final Log LOG = LogFactory.getLog(BPRMatrixFactorizationUDTF.class); private static final int RECORD_BYTES = (Integer.SIZE + Integer.SIZE + Integer.SIZE) / 8; @@ -362,7 +362,7 @@ public final class BPRMatrixFactorizationUDTF extends UDTFWithOptions implements return ex / (1.d + ex); } default: { - throw new IllegalStateException("Unexpectd loss function: " + loss); + throw new IllegalStateException("Unexpected loss function: " + loss); } } } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/mf/FactorizedModel.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/mf/FactorizedModel.java b/core/src/main/java/hivemall/mf/FactorizedModel.java index 2b32dbc..dc4dca9 100644 --- a/core/src/main/java/hivemall/mf/FactorizedModel.java +++ b/core/src/main/java/hivemall/mf/FactorizedModel.java @@ -33,7 +33,7 @@ import javax.annotation.concurrent.NotThreadSafe; public final class FactorizedModel { @Nonnull - private final RatingInitilizer ratingInitializer; + private final RatingInitializer ratingInitializer; @Nonnegative private final int factor; @@ -50,17 +50,17 @@ public final class FactorizedModel { private final Random[] randU, randI; - public FactorizedModel(@Nonnull RatingInitilizer ratingInitializer, @Nonnegative int factor, + public FactorizedModel(@Nonnull RatingInitializer ratingInitializer, @Nonnegative int factor, @Nonnull RankInitScheme initScheme) { this(ratingInitializer, factor, 0.f, initScheme, 136861); } - public FactorizedModel(@Nonnull RatingInitilizer ratingInitializer, @Nonnegative int factor, + public FactorizedModel(@Nonnull RatingInitializer ratingInitializer, @Nonnegative int factor, float meanRating, @Nonnull RankInitScheme initScheme) { this(ratingInitializer, factor, meanRating, initScheme, 136861); } - public FactorizedModel(@Nonnull RatingInitilizer ratingInitializer, @Nonnegative int factor, + public FactorizedModel(@Nonnull RatingInitializer ratingInitializer, @Nonnegative int factor, float meanRating, @Nonnull RankInitScheme initScheme, int expectedSize) { this.ratingInitializer = ratingInitializer; this.factor = factor; @@ -254,7 +254,7 @@ public final class FactorizedModel { } private static void uniformFill(final Rating[] a, final Random rand, final float maxInitValue, - final RatingInitilizer init) { + final RatingInitializer init) { for (int i = 0, len = a.length; i < len; i++) { float v = rand.nextFloat() * maxInitValue / len; a[i] = init.newRating(v); @@ -262,7 +262,7 @@ public final class FactorizedModel { } private static void gaussianFill(final Rating[] a, final Random[] rand, final double stddev, - final RatingInitilizer init) { + final RatingInitializer init) { for (int i = 0, len = a.length; i < len; i++) { float v = (float) MathUtils.gaussian(0.d, stddev, rand[i]); a[i] = init.newRating(v); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/mf/OnlineMatrixFactorizationUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/mf/OnlineMatrixFactorizationUDTF.java b/core/src/main/java/hivemall/mf/OnlineMatrixFactorizationUDTF.java index e389edf..2c10189 100644 --- a/core/src/main/java/hivemall/mf/OnlineMatrixFactorizationUDTF.java +++ b/core/src/main/java/hivemall/mf/OnlineMatrixFactorizationUDTF.java @@ -53,7 +53,7 @@ import org.apache.hadoop.mapred.Counters.Counter; import org.apache.hadoop.mapred.Reporter; public abstract class OnlineMatrixFactorizationUDTF extends UDTFWithOptions implements - RatingInitilizer { + RatingInitializer { private static final Log logger = LogFactory.getLog(OnlineMatrixFactorizationUDTF.class); private static final int RECORD_BYTES = (Integer.SIZE + Integer.SIZE + Double.SIZE) / 8; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/mf/RatingInitializer.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/mf/RatingInitializer.java b/core/src/main/java/hivemall/mf/RatingInitializer.java new file mode 100644 index 0000000..9022b52 --- /dev/null +++ b/core/src/main/java/hivemall/mf/RatingInitializer.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package hivemall.mf; + +public interface RatingInitializer { + + public Rating newRating(float v); + +} http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/mf/RatingInitilizer.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/mf/RatingInitilizer.java b/core/src/main/java/hivemall/mf/RatingInitilizer.java deleted file mode 100644 index 1938b00..0000000 --- a/core/src/main/java/hivemall/mf/RatingInitilizer.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package hivemall.mf; - -public interface RatingInitilizer { - - public Rating newRating(float v); - -} http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/mix/MixMessage.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/mix/MixMessage.java b/core/src/main/java/hivemall/mix/MixMessage.java index 9fd3676..8479296 100644 --- a/core/src/main/java/hivemall/mix/MixMessage.java +++ b/core/src/main/java/hivemall/mix/MixMessage.java @@ -58,7 +58,7 @@ public final class MixMessage implements Externalizable { throw new IllegalArgumentException("feature is null"); } if (deltaUpdates < 0 || deltaUpdates > Byte.MAX_VALUE) { - throw new IllegalArgumentException("Illegal deletaUpdates: " + deltaUpdates); + throw new IllegalArgumentException("Illegal deltaUpdates: " + deltaUpdates); } this.event = event; this.feature = feature; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/recommend/SlimUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/recommend/SlimUDTF.java b/core/src/main/java/hivemall/recommend/SlimUDTF.java index 7977a38..251c0d4 100644 --- a/core/src/main/java/hivemall/recommend/SlimUDTF.java +++ b/core/src/main/java/hivemall/recommend/SlimUDTF.java @@ -86,7 +86,7 @@ public class SlimUDTF extends UDTFWithOptions { private static final Log logger = LogFactory.getLog(SlimUDTF.class); //-------------------------------------------- - // intput OIs + // input OIs private PrimitiveObjectInspector itemIOI; private PrimitiveObjectInspector itemJOI; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/regression/PassiveAggressiveRegressionUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/regression/PassiveAggressiveRegressionUDTF.java b/core/src/main/java/hivemall/regression/PassiveAggressiveRegressionUDTF.java index f822fd5..ff5049a 100644 --- a/core/src/main/java/hivemall/regression/PassiveAggressiveRegressionUDTF.java +++ b/core/src/main/java/hivemall/regression/PassiveAggressiveRegressionUDTF.java @@ -59,7 +59,7 @@ public class PassiveAggressiveRegressionUDTF extends RegressionBaseUDTF { protected Options getOptions() { Options opts = super.getOptions(); opts.addOption("c", "aggressiveness", true, - "Aggressiveness paramete [default Float.MAX_VALUE]"); + "Aggressiveness parameter [default Float.MAX_VALUE]"); opts.addOption("e", "epsilon", true, "Sensitivity to prediction mistakes [default 0.1]"); return opts; } http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/smile/classification/DecisionTree.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/smile/classification/DecisionTree.java b/core/src/main/java/hivemall/smile/classification/DecisionTree.java index e6160d2..76164f4 100644 --- a/core/src/main/java/hivemall/smile/classification/DecisionTree.java +++ b/core/src/main/java/hivemall/smile/classification/DecisionTree.java @@ -1,10 +1,10 @@ /* * Copyright (c) 2010 Haifeng Li - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -197,7 +197,7 @@ public final class DecisionTree implements Classifier<Vector> { */ int output = -1; /** - * Posteriori probability based on sample ratios in this node. + * A posteriori probability based on sample ratios in this node. */ @Nullable double[] posteriori = null; @@ -358,7 +358,7 @@ public final class DecisionTree implements Classifier<Vector> { final int myNodeId = nodeIdGenerator.getValue(); if (trueChild == null && falseChild == null) { - // fillcolor=h,s,v + // fillcolor=h,s,v // https://en.wikipedia.org/wiki/HSL_and_HSV // http://www.graphviz.org/doc/info/attrs.html#k:colorList String hsvColor = (colorBrew == null || output >= colorBrew.length) ? "#00000000" @@ -394,7 +394,7 @@ public final class DecisionTree implements Classifier<Vector> { if (myNodeId != parentNodeId) { builder.append(' ').append(parentNodeId).append(" -> ").append(myNodeId); - if (parentNodeId == 0) {//only draw edge label on top + if (parentNodeId == 0) {//only draw edge label on top if (myNodeId == 1) { builder.append(" [labeldistance=2.5, labelangle=45, headlabel=\"True\"]"); } else { @@ -580,7 +580,7 @@ public final class DecisionTree implements Classifier<Vector> { /** * Finds the best attribute to split on at the current node. - * + * * @return true if a split exists to reduce squared error, false otherwise. */ public boolean findBestSplit() { @@ -669,7 +669,7 @@ public final class DecisionTree implements Classifier<Vector> { /** * Finds the best split cutoff for attribute j at the current node. - * + * * @param n the number instances in this node. * @param count the sample count in each class. * @param falseCount an array to store sample count in each class for false child node. @@ -779,7 +779,7 @@ public final class DecisionTree implements Classifier<Vector> { prevx = x_ij; prevy = y_i; trueCount[y_i] += sample; - }//apply() + }//apply() }); } else { throw new IllegalStateException("Unsupported attribute type: " @@ -808,7 +808,7 @@ public final class DecisionTree implements Classifier<Vector> { this.bags = null; // help GC for recursive call if (tc < _minLeafSize || fc < _minLeafSize) { - // set the node as leaf + // set the node as leaf node.splitFeature = -1; node.splitFeatureType = null; node.splitValue = Double.NaN; @@ -845,7 +845,7 @@ public final class DecisionTree implements Classifier<Vector> { } _importance.incr(node.splitFeature, node.splitScore); - node.posteriori = null; // posteriori is not needed for non-leaf nodes + node.posteriori = null; // a posteriori is not needed for non-leaf nodes return true; } @@ -898,7 +898,7 @@ public final class DecisionTree implements Classifier<Vector> { /** * Returns the impurity of a node. - * + * * @param count the sample count in each class. * @param n the number of samples in the node. * @param rule the rule for splitting a node. @@ -986,7 +986,7 @@ public final class DecisionTree implements Classifier<Vector> { this._attributes = SmileExtUtils.attributeTypes(attributes, x); if (attributes.length != x.numColumns()) { - throw new IllegalArgumentException("-attrs option is invliad: " + throw new IllegalArgumentException("-attrs option is invalid: " + Arrays.toString(attributes)); } this._hasNumericType = SmileExtUtils.containsNumericType(_attributes); http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/smile/classification/GradientTreeBoostingClassifierUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/smile/classification/GradientTreeBoostingClassifierUDTF.java b/core/src/main/java/hivemall/smile/classification/GradientTreeBoostingClassifierUDTF.java index adb405f..d94dc4c 100644 --- a/core/src/main/java/hivemall/smile/classification/GradientTreeBoostingClassifierUDTF.java +++ b/core/src/main/java/hivemall/smile/classification/GradientTreeBoostingClassifierUDTF.java @@ -156,7 +156,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { trees = Primitives.parseInt(cl.getOptionValue("num_trees"), trees); if (trees < 1) { - throw new IllegalArgumentException("Invlaid number of trees: " + trees); + throw new IllegalArgumentException("Invalid number of trees: " + trees); } eta = Primitives.parseDouble(cl.getOptionValue("learning_rate"), eta); subsample = Primitives.parseDouble(cl.getOptionValue("subsample"), subsample); @@ -320,7 +320,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { checkOptions(); this._attributes = SmileExtUtils.attributeTypes(_attributes, x); - // Shuffle training samples + // Shuffle training samples x = SmileExtUtils.shuffle(x, y, _seed); final int k = smile.math.Math.max(y) + 1; @@ -345,7 +345,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { private void train2(@Nonnull final Matrix x, @Nonnull final int[] y) throws HiveException { final int numVars = SmileExtUtils.computeNumInputVars(_numVars, x); if (logger.isInfoEnabled()) { - logger.info("k: " + 2 + ", numTrees: " + _numTrees + ", shirinkage: " + _eta + logger.info("k: " + 2 + ", numTrees: " + _numTrees + ", shrinkage: " + _eta + ", subsample: " + _subsample + ", numVars: " + numVars + ", maxDepth: " + _maxDepth + ", minSamplesSplit: " + _minSamplesSplit + ", maxLeafs: " + _maxLeafNodes + ", seed: " + _seed); @@ -427,7 +427,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { private void traink(final Matrix x, final int[] y, final int k) throws HiveException { final int numVars = SmileExtUtils.computeNumInputVars(_numVars, x); if (logger.isInfoEnabled()) { - logger.info("k: " + k + ", numTrees: " + _numTrees + ", shirinkage: " + _eta + logger.info("k: " + k + ", numTrees: " + _numTrees + ", shrinkage: " + _eta + ", subsample: " + _subsample + ", numVars: " + numVars + ", minSamplesSplit: " + _minSamplesSplit + ", maxDepth: " + _maxDepth + ", maxLeafs: " + _maxLeafNodes + ", seed: " + _seed); @@ -437,7 +437,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { final int numSamples = (int) Math.round(numInstances * _subsample); final double[][] h = new double[k][numInstances]; // boost tree output. - final double[][] p = new double[k][numInstances]; // posteriori probabilities. + final double[][] p = new double[k][numInstances]; // a posteriori probabilities. final double[][] response = new double[k][numInstances]; // pseudo response. final ColumnMajorIntMatrix order = SmileExtUtils.sort(_attributes, x); @@ -598,7 +598,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { /** * Constructor. - * + * * @param y pseudo response to fit. */ public L2NodeOutput(double[] y) { @@ -639,7 +639,7 @@ public final class GradientTreeBoostingClassifierUDTF extends UDTFWithOptions { /** * Constructor. - * + * * @param response response to fit. */ public LKNodeOutput(double[] response, int k) { http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/smile/classification/RandomForestClassifierUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/smile/classification/RandomForestClassifierUDTF.java b/core/src/main/java/hivemall/smile/classification/RandomForestClassifierUDTF.java index d0db3a1..a34a700 100644 --- a/core/src/main/java/hivemall/smile/classification/RandomForestClassifierUDTF.java +++ b/core/src/main/java/hivemall/smile/classification/RandomForestClassifierUDTF.java @@ -173,7 +173,7 @@ public final class RandomForestClassifierUDTF extends UDTFWithOptions { trees = Primitives.parseInt(cl.getOptionValue("num_trees"), trees); if (trees < 1) { - throw new IllegalArgumentException("Invlaid number of trees: " + trees); + throw new IllegalArgumentException("Invalid number of trees: " + trees); } numVars = Primitives.parseFloat(cl.getOptionValue("num_variables"), numVars); maxDepth = Primitives.parseInt(cl.getOptionValue("max_depth"), maxDepth); @@ -198,7 +198,7 @@ public final class RandomForestClassifierUDTF extends UDTFWithOptions { classWeight[i] = 1.0d; } else if (v <= 0.d) { throw new UDFArgumentTypeException(3, - "each classWeight must be greather than 0: " + "each classWeight must be greater than 0: " + Arrays.toString(classWeight)); } } @@ -364,7 +364,7 @@ public final class RandomForestClassifierUDTF extends UDTFWithOptions { // Shuffle training samples x = SmileExtUtils.shuffle(x, y, _seed); - int[] labels = SmileExtUtils.classLables(y); + int[] labels = SmileExtUtils.classLabels(y); Attribute[] attributes = SmileExtUtils.attributeTypes(_attributes, x); int numInputVars = SmileExtUtils.computeNumInputVars(_numVars, x); @@ -391,13 +391,13 @@ public final class RandomForestClassifierUDTF extends UDTFWithOptions { } catch (Exception ex) { throw new HiveException(ex); } finally { - executor.shotdown(); + executor.shutdown(); } } /** * Synchronized because {@link #forward(Object)} should be called from a single thread. - * + * * @param accuracy */ synchronized void forward(final int taskId, @Nonnull final Text model, @@ -567,7 +567,7 @@ public final class RandomForestClassifierUDTF extends UDTFWithOptions { /** * Stratified sampling for unbalanced data. - * + * * @link https://en.wikipedia.org/wiki/Stratified_sampling */ @Nonnull http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/smile/regression/RandomForestRegressionUDTF.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/smile/regression/RandomForestRegressionUDTF.java b/core/src/main/java/hivemall/smile/regression/RandomForestRegressionUDTF.java index bbf0431..6bd258f 100644 --- a/core/src/main/java/hivemall/smile/regression/RandomForestRegressionUDTF.java +++ b/core/src/main/java/hivemall/smile/regression/RandomForestRegressionUDTF.java @@ -112,7 +112,7 @@ public final class RandomForestRegressionUDTF extends UDTFWithOptions { @Nullable private Counter _treeBuildTaskCounter; @Nullable - private Counter _treeConstuctionTimeCounter; + private Counter _treeConstructionTimeCounter; @Nullable private Counter _treeSerializationTimeCounter; @@ -153,7 +153,7 @@ public final class RandomForestRegressionUDTF extends UDTFWithOptions { trees = Primitives.parseInt(cl.getOptionValue("num_trees"), trees); if (trees < 1) { - throw new IllegalArgumentException("Invlaid number of trees: " + trees); + throw new IllegalArgumentException("Invalid number of trees: " + trees); } numVars = Primitives.parseFloat(cl.getOptionValue("num_variables"), numVars); maxDepth = Primitives.parseInt(cl.getOptionValue("max_depth"), maxDepth); @@ -267,7 +267,7 @@ public final class RandomForestRegressionUDTF extends UDTFWithOptions { this._treeBuildTaskCounter = (_progressReporter == null) ? null : _progressReporter.getCounter("hivemall.smile.RandomForestRegression$Counter", "Number of finished tree construction tasks"); - this._treeConstuctionTimeCounter = (_progressReporter == null) ? null + this._treeConstructionTimeCounter = (_progressReporter == null) ? null : _progressReporter.getCounter("hivemall.smile.RandomForestRegression$Counter", "Elapsed time in seconds for tree construction"); this._treeSerializationTimeCounter = (_progressReporter == null) ? null @@ -349,13 +349,13 @@ public final class RandomForestRegressionUDTF extends UDTFWithOptions { } catch (Exception ex) { throw new HiveException(ex); } finally { - executor.shotdown(); + executor.shutdown(); } } /** * Synchronized because {@link #forward(Object)} should be called from a single thread. - * + * * @param error */ synchronized void forward(final int taskId, @Nonnull final Text model, @@ -466,7 +466,7 @@ public final class RandomForestRegressionUDTF extends UDTFWithOptions { RegressionTree tree = new RegressionTree(_attributes, _x, _y, _numVars, _udtf._maxDepth, _udtf._maxLeafNodes, _udtf._minSamplesSplit, _udtf._minSamplesLeaf, _order, bags, rnd2); - incrCounter(_udtf._treeConstuctionTimeCounter, stopwatch.elapsed(TimeUnit.SECONDS)); + incrCounter(_udtf._treeConstructionTimeCounter, stopwatch.elapsed(TimeUnit.SECONDS)); // out-of-bag prediction int oob = 0; http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/5ac14b7d/core/src/main/java/hivemall/smile/regression/RegressionTree.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/hivemall/smile/regression/RegressionTree.java b/core/src/main/java/hivemall/smile/regression/RegressionTree.java index b085734..67535c6 100755 --- a/core/src/main/java/hivemall/smile/regression/RegressionTree.java +++ b/core/src/main/java/hivemall/smile/regression/RegressionTree.java @@ -1,10 +1,10 @@ /* * Copyright (c) 2010 Haifeng Li - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software @@ -91,7 +91,7 @@ import smile.regression.Regression; * <p> * Some techniques such as bagging, boosting, and random forest use more than one decision tree for * their analysis. - * + * * @see GradientTreeBoost * @see RandomForest */ @@ -146,7 +146,7 @@ public final class RegressionTree implements Regression<Vector> { public interface NodeOutput { /** * Calculate the node output. - * + * * @param samples the samples in the node. * @return the node output */ @@ -341,7 +341,7 @@ public final class RegressionTree implements Regression<Vector> { if (myNodeId != parentNodeId) { builder.append(' ').append(parentNodeId).append(" -> ").append(myNodeId); - if (parentNodeId == 0) {//only draw edge label on top + if (parentNodeId == 0) {//only draw edge label on top if (myNodeId == 1) { builder.append(" [labeldistance=2.5, labelangle=45, headlabel=\"True\"]"); } else { @@ -522,7 +522,7 @@ public final class RegressionTree implements Regression<Vector> { /** * Calculate the node output for leaves. - * + * * @param output the output calculate functor. */ public void calculateOutput(final NodeOutput output) { @@ -558,7 +558,7 @@ public final class RegressionTree implements Regression<Vector> { // Loop through features and compute the reduction of squared error, - // which is trueCount * trueMean^2 + falseCount * falseMean^2 - count * parentMean^2 + // which is trueCount * trueMean^2 + falseCount * falseMean^2 - count * parentMean^2 final int[] samples = _hasNumericType ? SmileExtUtils.bagsToSamples(bags, x.numRows()) : null; for (int varJ : variableIndex(x, bags)) { @@ -603,7 +603,7 @@ public final class RegressionTree implements Regression<Vector> { /** * Finds the best split cutoff for attribute j at the current node. - * + * * @param n the number instances in this node. * @param count the sample count in each class. * @param impurity the impurity of this node. @@ -838,7 +838,7 @@ public final class RegressionTree implements Regression<Vector> { /** * Constructor. Learns a regression tree for gradient tree boosting. - * + * * @param attributes the attribute properties. * @param x the training instances. * @param y the response variable. @@ -860,7 +860,7 @@ public final class RegressionTree implements Regression<Vector> { this._attributes = SmileExtUtils.attributeTypes(attributes, x); if (_attributes.length != x.numColumns()) { - throw new IllegalArgumentException("-attrs option is invliad: " + throw new IllegalArgumentException("-attrs option is invalid: " + Arrays.toString(attributes)); } this._hasNumericType = SmileExtUtils.containsNumericType(_attributes);