correction in the discrepancy analysis: grouping now takes average instead of sum
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@76763 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
748f263593
commit
1634249c07
|
@ -23,9 +23,9 @@ public class DiscrepancyAnalysis extends DataAnalysis {
|
||||||
// static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from %5$s as a inner join %6$s as b on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
|
// static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from %5$s as a inner join %6$s as b on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
|
||||||
// static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from (select * from %5$s order by %1$s limit %7$s) as a inner join (select * from %6$s order by %2$s limit %7$s) as b on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
|
// static String discrepancyQuery = "select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from (select * from %5$s order by %1$s limit %7$s) as a inner join (select * from %6$s order by %2$s limit %7$s) as b on a.%1$s=b.%2$s and (a.%3$s<>b.%4$s)";
|
||||||
static String discrepancyQuery = "select * from (select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from " +
|
static String discrepancyQuery = "select * from (select distinct a.%1$s as csquareone,b.%2$s as csquaretwo,a.%3$s as firstprob,b.%4$s as secondprob from " +
|
||||||
"(select %1$s , sum(%3$s) as %3$s from (select distinct * from %5$s order by %1$s limit %7$s) as aa group by %1$s) as a " +
|
"(select %1$s , avg(%3$s) as %3$s from (select distinct * from %5$s order by %1$s limit %7$s) as aa group by %1$s) as a " +
|
||||||
"left join " +
|
"left join " +
|
||||||
"(select %2$s , sum(%4$s) as %4$s from (select distinct * from %6$s order by %2$s limit %7$s) as aa group by %2$s) as b " +
|
"(select %2$s , avg(%4$s) as %4$s from (select distinct * from %6$s order by %2$s limit %7$s) as aa group by %2$s) as b " +
|
||||||
"on a.%1$s=b.%2$s) as sel where firstprob<>secondprob";
|
"on a.%1$s=b.%2$s) as sel where firstprob<>secondprob";
|
||||||
|
|
||||||
static String getNumberOfElementsQuery = "select count(*) from %1$s";
|
static String getNumberOfElementsQuery = "select count(*) from %1$s";
|
||||||
|
@ -146,7 +146,7 @@ public class DiscrepancyAnalysis extends DataAnalysis {
|
||||||
output.put("MAXIMUM_ERROR_POINT", "" + maxdiscrepancyPoint);
|
output.put("MAXIMUM_ERROR_POINT", "" + maxdiscrepancyPoint);
|
||||||
if (numLower>numHigher)
|
if (numLower>numHigher)
|
||||||
output.put("TREND", "CONTRACTION");
|
output.put("TREND", "CONTRACTION");
|
||||||
if (numLower<numHigher)
|
else if (numLower<numHigher)
|
||||||
output.put("TREND", "EXPANSION");
|
output.put("TREND", "EXPANSION");
|
||||||
else
|
else
|
||||||
output.put("TREND", "STATIONARY");
|
output.put("TREND", "STATIONARY");
|
||||||
|
@ -185,10 +185,10 @@ public class DiscrepancyAnalysis extends DataAnalysis {
|
||||||
String csquare = (String) elements[0];
|
String csquare = (String) elements[0];
|
||||||
float probabilityPoint1 = 0;
|
float probabilityPoint1 = 0;
|
||||||
if (elements[2] != null)
|
if (elements[2] != null)
|
||||||
probabilityPoint1 = (Float) elements[2];
|
probabilityPoint1 = Float.parseFloat(""+elements[2]);
|
||||||
float probabilityPoint2 = 0;
|
float probabilityPoint2 = 0;
|
||||||
if (elements[3] != null)
|
if (elements[3] != null)
|
||||||
probabilityPoint2 = (Float) elements[3];
|
probabilityPoint2 = Float.parseFloat(""+elements[3]);
|
||||||
float discrepancy = Math.abs(probabilityPoint2 - probabilityPoint1);
|
float discrepancy = Math.abs(probabilityPoint2 - probabilityPoint1);
|
||||||
|
|
||||||
if (discrepancy > threshold) {
|
if (discrepancy > threshold) {
|
||||||
|
@ -200,7 +200,7 @@ public class DiscrepancyAnalysis extends DataAnalysis {
|
||||||
}
|
}
|
||||||
if (probabilityPoint2>probabilityPoint1)
|
if (probabilityPoint2>probabilityPoint1)
|
||||||
numHigher++;
|
numHigher++;
|
||||||
if (probabilityPoint2<probabilityPoint1)
|
else if (probabilityPoint2<probabilityPoint1)
|
||||||
numLower++;
|
numLower++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue