Remove redundant initializers.

Closes #172.
This commit is contained in:
Arturo Bernal 2021-04-12 07:45:25 +02:00 committed by Gilles Sadowski
parent 0300f97d74
commit 26511237d2
21 changed files with 38 additions and 38 deletions

View File

@ -117,7 +117,7 @@ public class EmpiricalDistribution extends AbstractRealDistribution
private final List<SummaryStatistics> binStats;
/** Sample statistics */
private SummaryStatistics sampleStats = null;
private SummaryStatistics sampleStats;
/** Max loaded value */
private double max = Double.NEGATIVE_INFINITY;
@ -126,16 +126,16 @@ public class EmpiricalDistribution extends AbstractRealDistribution
private double min = Double.POSITIVE_INFINITY;
/** Grid size */
private double delta = 0d;
private double delta;
/** number of bins */
private final int binCount;
/** is the distribution loaded? */
private boolean loaded = false;
private boolean loaded;
/** upper bounds of subintervals in (0,1) "belonging" to the bins */
private double[] upperBounds = null;
private double[] upperBounds;
/**
* Creates a new EmpiricalDistribution with the default bin count.

View File

@ -71,7 +71,7 @@ public class MultivariateNormalMixtureExpectationMaximization {
/**
* The log likelihood of the data given the fitted model.
*/
private double logLikelihood = 0d;
private double logLikelihood;
/**
* Creates an object to fit a multivariate normal mixture model to data.

View File

@ -29,7 +29,7 @@ import org.apache.commons.math4.exception.NumberIsTooSmallException;
*/
public class FixedGenerationCount implements StoppingCondition {
/** Number of generations that have passed */
private int numGenerations = 0;
private int numGenerations;
/** Maximum number of generations (stopping criteria) */
private final int maxGenerations;

View File

@ -53,7 +53,7 @@ public class GeneticAlgorithm {
private final SelectionPolicy selectionPolicy;
/** the number of generations evolved to reach {@link StoppingCondition} in the last run. */
private int generationsEvolved = 0;
private int generationsEvolved;
/**
* Create a new genetic algorithm.

View File

@ -753,7 +753,7 @@ public abstract class RealVector {
return new Iterator<Entry>() {
/** Current index. */
private int i = 0;
private int i;
/** Current entry. */
private Entry e = new Entry();

View File

@ -254,7 +254,7 @@ public class MiniBatchKMeansClusterer<T extends Clusterable>
/** Minimum value of {@link #ewaInertia} during iteration. */
private double ewaInertiaMin = Double.POSITIVE_INFINITY;
/** Number of iteration during which {@link #ewaInertia} did not improve. */
private int noImprovementTimes = 0;
private int noImprovementTimes;
/**
* @param batchSize Number of elements for each batch iteration.

View File

@ -71,7 +71,7 @@ public class HaltonSequenceGenerator implements RandomVectorGenerator {
private final int dimension;
/** The current index in the sequence. */
private int count = 0;
private int count;
/** The base numbers for each component. */
private final int[] base;

View File

@ -74,7 +74,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
private final int dimension;
/** The current index in the sequence. */
private int count = 0;
private int count;
/** The direction vector for each component. */
private final long[][] direction;

View File

@ -78,7 +78,7 @@ public class MultivariateSummaryStatistics
private final int k;
/** Count of values that have been added */
private long n = 0;
private long n;
/** Sum statistic implementation - can be reset by setter. */
private final StorelessUnivariateStatistic[] sumImpl;

View File

@ -63,7 +63,7 @@ public class SummaryStatistics implements StatisticalSummary, Serializable {
private static final long serialVersionUID = -2021321786743555871L;
/** count of values that have been added */
private long n = 0;
private long n;
/** SecondMoment is used to compute the mean and variance */
private SecondMoment secondMoment = new SecondMoment();

View File

@ -51,7 +51,7 @@ public class Skewness extends AbstractStorelessUnivariateStatistic implements Se
private static final long serialVersionUID = 20150412L;
/** Third moment on which this statistic is based */
protected ThirdMoment moment = null;
protected ThirdMoment moment;
/**
* Determines whether or not this statistic can be incremented or cleared.

View File

@ -46,7 +46,7 @@ public class StandardDeviation extends AbstractStorelessUnivariateStatistic
private static final long serialVersionUID = 20150412L;
/** Wrapped Variance instance */
private Variance variance = null;
private Variance variance;
/**
* Constructs a StandardDeviation. Sets the underlying {@link Variance}

View File

@ -72,7 +72,7 @@ public class Variance extends AbstractStorelessUnivariateStatistic implements Se
private static final long serialVersionUID = 20150412L;
/** SecondMoment is used in incremental calculation of Variance*/
protected SecondMoment moment = null;
protected SecondMoment moment;
/**
* Whether or not {@link #increment(double)} should increment

View File

@ -99,7 +99,7 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic
* Markers is the marker collection object which comes to effect
* only after 5 values are inserted
*/
private PSquareMarkers markers = null;
private PSquareMarkers markers;
/**
* Computed p value (i,e percentile value of data set hither to received)

View File

@ -44,7 +44,7 @@ public abstract class AbstractMultipleLinearRegression implements
private RealVector yVector;
/** Whether or not the regression model includes an intercept. True means no intercept. */
private boolean noIntercept = false;
private boolean noIntercept;
/**
* @return the X sample data.

View File

@ -58,13 +58,13 @@ public class MillerUpdatingRegression implements UpdatingMultipleLinearRegressio
/** scratch space for tolerance calc */
private final double[] work_tolset;
/** number of observations entered */
private long nobs = 0;
private long nobs;
/** sum of squared errors of largest regression */
private double sserr = 0.0;
private double sserr;
/** has rss been called? */
private boolean rss_set = false;
private boolean rss_set;
/** has the tolerance setting method been called */
private boolean tol_set = false;
private boolean tol_set;
/** flags for variables with linear dependency problems */
private final boolean[] lindep;
/** singular x values */
@ -72,9 +72,9 @@ public class MillerUpdatingRegression implements UpdatingMultipleLinearRegressio
/** workspace for singularity method */
private final double[] work_sing;
/** summation of Y variable */
private double sumy = 0.0;
private double sumy;
/** summation of squared Y values */
private double sumsqy = 0.0;
private double sumsqy;
/** boolean flag whether a regression constant is added */
private final boolean hasIntercept;
/** zero tolerance */

View File

@ -54,7 +54,7 @@ import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegression {
/** Cached QR decomposition of X matrix */
private QRDecomposition qr = null;
private QRDecomposition qr;
/** Singularity threshold for QR decomposition */
private final double threshold;

View File

@ -66,28 +66,28 @@ public class SimpleRegression implements Serializable, UpdatingMultipleLinearReg
private static final long serialVersionUID = -3004689053607543335L;
/** sum of x values */
private double sumX = 0d;
private double sumX;
/** total variation in x (sum of squared deviations from xbar) */
private double sumXX = 0d;
private double sumXX;
/** sum of y values */
private double sumY = 0d;
private double sumY;
/** total variation in y (sum of squared deviations from ybar) */
private double sumYY = 0d;
private double sumYY;
/** sum of products */
private double sumXY = 0d;
private double sumXY;
/** number of observations */
private long n = 0;
private long n;
/** mean of accumulated x values, used in updating formulas */
private double xbar = 0;
private double xbar;
/** mean of accumulated y values, used in updating formulas */
private double ybar = 0;
private double ybar;
/** include an intercept or not */
private final boolean hasIntercept;

View File

@ -148,7 +148,7 @@ public class IntegerSequence {
/** Function called at counter exhaustion. */
private final MaxCountExceededCallback maxCountCallback;
/** Current count. */
private int count = 0;
private int count;
/**
* Defines a method to be called at counter exhaustion.

View File

@ -120,14 +120,14 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* The number of addressable elements in the array. Note that this
* has nothing to do with the length of the internal storage array.
*/
private int numElements = 0;
private int numElements;
/**
* The position of the first addressable element in the internal storage
* array. The addressable elements in the array are
* {@code internalArray[startIndex],...,internalArray[startIndex + numElements - 1]}.
*/
private int startIndex = 0;
private int startIndex;
/**
* Specification of expansion algorithm.

View File

@ -38,12 +38,12 @@ public class TransformerMap implements NumberTransformer, Serializable {
/**
* A default Number Transformer for Numbers and numeric Strings.
*/
private NumberTransformer defaultTransformer = null;
private NumberTransformer defaultTransformer;
/**
* The internal Map.
*/
private Map<Class<?>, NumberTransformer> map = null;
private Map<Class<?>, NumberTransformer> map;
/**
* Build a map containing only the default transformer.