[MATH-892] Add new ctor to SpearmansCorrelation, reordering of ctors.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1407847 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a170601629
commit
ff96ac9292
|
@ -52,6 +52,10 @@ If the output is not quite correct, check for invisible trailing spaces!
|
|||
<body>
|
||||
<release version="3.1" date="TBD" description="
|
||||
">
|
||||
<action dev="tn" type="add" issue="MATH-892">
|
||||
Add new constructor to "SpearmansCorrelation" class which allows to specify the
|
||||
"RankingAlgorithm" to be used.
|
||||
</action>
|
||||
<action dev="luc" type="fix" issue="MATH-890">
|
||||
Fixed naming inconsistencies between Interval and IntervalsSet classes.
|
||||
</action>
|
||||
|
|
|
@ -50,18 +50,21 @@ public class SpearmansCorrelation {
|
|||
private final PearsonsCorrelation rankCorrelation;
|
||||
|
||||
/**
|
||||
* Create a SpearmansCorrelation with the given input data matrix
|
||||
* and ranking algorithm.
|
||||
* Create a SpearmansCorrelation without data.
|
||||
*/
|
||||
public SpearmansCorrelation() {
|
||||
this(new NaturalRanking());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a SpearmansCorrelation with the given ranking algorithm.
|
||||
*
|
||||
* @param dataMatrix matrix of data with columns representing
|
||||
* variables to correlate
|
||||
* @param rankingAlgorithm ranking algorithm
|
||||
*/
|
||||
public SpearmansCorrelation(final RealMatrix dataMatrix, final RankingAlgorithm rankingAlgorithm) {
|
||||
this.data = dataMatrix.copy();
|
||||
public SpearmansCorrelation(final RankingAlgorithm rankingAlgorithm) {
|
||||
data = null;
|
||||
this.rankingAlgorithm = rankingAlgorithm;
|
||||
rankTransform(data);
|
||||
rankCorrelation = new PearsonsCorrelation(data);
|
||||
rankCorrelation = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,12 +78,18 @@ public class SpearmansCorrelation {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create a SpearmansCorrelation without data.
|
||||
* Create a SpearmansCorrelation with the given input data matrix
|
||||
* and ranking algorithm.
|
||||
*
|
||||
* @param dataMatrix matrix of data with columns representing
|
||||
* variables to correlate
|
||||
* @param rankingAlgorithm ranking algorithm
|
||||
*/
|
||||
public SpearmansCorrelation() {
|
||||
data = null;
|
||||
this.rankingAlgorithm = new NaturalRanking();
|
||||
rankCorrelation = null;
|
||||
public SpearmansCorrelation(final RealMatrix dataMatrix, final RankingAlgorithm rankingAlgorithm) {
|
||||
this.data = dataMatrix.copy();
|
||||
this.rankingAlgorithm = rankingAlgorithm;
|
||||
rankTransform(data);
|
||||
rankCorrelation = new PearsonsCorrelation(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue