MATH-1443: Depend on "Commons Statistics".
This commit is contained in:
parent
6d9bc1ade0
commit
3c0c9d83e2
6
pom.xml
6
pom.xml
|
@ -365,6 +365,12 @@
|
|||
</contributors>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-statistics-distribution</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-numbers-core</artifactId>
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.apache.commons.math4.ml.neuralnet;
|
|||
|
||||
import org.apache.commons.math4.analysis.UnivariateFunction;
|
||||
import org.apache.commons.math4.analysis.function.Constant;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class FeatureInitializerFactory {
|
|||
public static FeatureInitializer uniform(final UniformRandomProvider rng,
|
||||
final double min,
|
||||
final double max) {
|
||||
return randomize(new UniformRealDistribution(min, max).createSampler(rng),
|
||||
return randomize(new UniformContinuousDistribution(min, max).createSampler(rng),
|
||||
function(new Constant(0), 0, 0));
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class FeatureInitializerFactory {
|
|||
* @return an initializer whose {@link FeatureInitializer#value() value}
|
||||
* method will return {@code orig.value() + random.sample()}.
|
||||
*/
|
||||
public static FeatureInitializer randomize(final RealDistribution.Sampler random,
|
||||
public static FeatureInitializer randomize(final ContinuousDistribution.Sampler random,
|
||||
final FeatureInitializer orig) {
|
||||
return new FeatureInitializer() {
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.commons.math4.analysis.FunctionUtils;
|
|||
import org.apache.commons.math4.analysis.UnivariateFunction;
|
||||
import org.apache.commons.math4.analysis.function.Constant;
|
||||
import org.apache.commons.math4.analysis.function.HarmonicOscillator;
|
||||
import org.apache.commons.math4.distribution.RealDistribution;
|
||||
import org.apache.commons.math4.distribution.UniformRealDistribution;
|
||||
import org.apache.commons.statistics.distribution.ContinuousDistribution;
|
||||
import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
||||
import org.apache.commons.math4.exception.MathUnsupportedOperationException;
|
||||
import org.apache.commons.math4.ml.distance.DistanceMeasure;
|
||||
import org.apache.commons.math4.ml.distance.EuclideanDistance;
|
||||
|
@ -341,7 +341,7 @@ public class TravellingSalesmanSolver {
|
|||
final UnivariateFunction f1 = FunctionUtils.add(h1, new Constant(centre[0]));
|
||||
final UnivariateFunction f2 = FunctionUtils.add(h2, new Constant(centre[1]));
|
||||
|
||||
final RealDistribution u = new UniformRealDistribution(-0.05 * radius, 0.05 * radius);
|
||||
final ContinuousDistribution u = new UniformContinuousDistribution(-0.05 * radius, 0.05 * radius);
|
||||
|
||||
return new FeatureInitializer[] {
|
||||
FeatureInitializerFactory.randomize(u.createSampler(random),
|
||||
|
|
Loading…
Reference in New Issue