[ 
https://issues.apache.org/jira/browse/MATH-1651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17628353#comment-17628353
 ] 

Alex Herbert commented on MATH-1651:
------------------------------------

Or even refactor the extraction of the distances to a method:
{code:java}
final double[] distancesBefore = getDistances(net, dist, features);

final double[] distancesAfter = getDistances(net, dist, features);

private static double[] getDistances(Network net,
                                     DistanceMeasure dist,
                                     double[] features) {
  return net.getNeurons()
            .stream()
            .sorted((a, b) -> Long.compare(a.getIdentifier(), 
b.getIdentifier()))
            .mapToDouble(n -> dist.applyAsDouble(n.getFeatures(), features))
            .toArray();
}
{code}

> junit flaky tests in commons-math-neuralnet
> -------------------------------------------
>
>                 Key: MATH-1651
>                 URL: https://issues.apache.org/jira/browse/MATH-1651
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Anant Dahiya
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
>  
> Flaky JUnit Tests identified  in commons-math-neuralnet
> *How did we detect Flaky Test ?*
> We detected the existence of flaky test using the tool 
> [NonDex|https://github.com/TestingResearchIllinois/NonDex]
>  
> *Command*
> {code:java}
> mvn -pl commons-math-neuralnet edu.illinois:nondex-maven-plugin:1.1.2:nondex 
> -Dtest=org.apache.commons.math4.neuralnet.NetworkTest#testIterationOrder{code}
>  
> *Tests :* 
>  
>  
> ||Path||Test||
> |commons-math-neuralnet|org.apache.commons.math4.neuralnet.NetworkTest#testIterationOrder|
> |commons-math-neuralnet|org.apache.commons.math4.neuralnet.sofm.KohonenUpdateActionTest#testUpdate|



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to