This commit is contained in:
Gianpaolo Coro 2013-03-19 09:42:55 +00:00
parent 045abdc393
commit d037eb82cb
4 changed files with 12 additions and 13 deletions

View File

@ -9,7 +9,7 @@
</parent>
<groupId>org.gcube.dataanalysis</groupId>
<artifactId>ecological-engine</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.1-SNAPSHOT</version>
<name>ecological-engine</name>
<description>ecological-engine library</description>
<properties>

View File

@ -15,7 +15,6 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.PrimitiveTypes;
import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
import org.gcube.dataanalysis.ecoengine.interfaces.DataAnalysis;
import org.gcube.dataanalysis.ecoengine.utils.DatabaseFactory;
import org.gcube.dataanalysis.ecoengine.utils.DatabaseUtils;
import org.gcube.dataanalysis.ecoengine.utils.Operations;
public class DiscrepancyAnalysis extends DataAnalysis {
@ -110,15 +109,15 @@ public class DiscrepancyAnalysis extends DataAnalysis {
}
// String query = String.format(discrepancyQuery, FirstTableCsquareColumn, SecondTableCsquareColumn, FirstTableProbabilityColumn, SecondTableProbabilityColumn, FirstTable, SecondTable);
List<Object> nelementsQ = DatabaseFactory.executeSQLQuery(DatabaseUtils.countElementsStatement(FirstTable),connection);
int nelements = Integer.parseInt(""+nelementsQ.get(0));
// List<Object> nelementsQ = DatabaseFactory.executeSQLQuery(DatabaseUtils.countElementsStatement(FirstTable),connection);
// int nelements = Integer.parseInt(""+nelementsQ.get(0));
nelements = Math.min(Operations.calcNumOfRepresentativeElements(nelements, minElements),maxCompElements);
// int nelements = Math.min(Operations.calcNumOfRepresentativeElements(nPoints, minElements),maxCompElements);
int nelements = nPoints;
AnalysisLogger.getLogger().trace("Number Of Elements to take: "+nelements);
String query = String.format(discrepancyQuery, FirstTableCsquareColumn, SecondTableCsquareColumn, FirstTableProbabilityColumn, SecondTableProbabilityColumn, FirstTable, SecondTable,""+nelements);
AnalysisLogger.getLogger().trace("Discrepancy Calculation - Query to perform :" + query);
List<Object> takePoints = DatabaseFactory.executeSQLQuery(query, connection);
@ -134,11 +133,11 @@ public class DiscrepancyAnalysis extends DataAnalysis {
output.put("MEAN", "" + MathFunctions.roundDecimal(mean,2));
output.put("VARIANCE", "" + MathFunctions.roundDecimal(variance,2));
output.put("NUMBER_OF_ERRORS", "" + numberoferrors);
output.put("NUMBER_OF_COMPARISONS", "" + numberofvectors);
output.put("NUMBER_OF_COMPARISONS", "" + nelements);
float accuracy = 100;
if (processedRecords>0)
accuracy = (1 - (float) numberoferrors / (float) numberofvectors) * 100;
accuracy = (1 - (float) numberoferrors / (float) nelements) * 100;
output.put("ACCURACY", "" + MathFunctions.roundDecimal(accuracy,2));
@ -181,7 +180,7 @@ public class DiscrepancyAnalysis extends DataAnalysis {
if (elements[3] != null)
probabilityPoint2 = (Float) elements[3];
float discrepancy = Math.abs(probabilityPoint2 - probabilityPoint1);
if (discrepancy > threshold) {
errors.add(Math.abs(probabilityPoint2 - probabilityPoint1));
numberoferrors++;

View File

@ -104,7 +104,7 @@ public class TablesComparisonForLatimeria {
}
public static void main(String[] args) throws Exception {
calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable);
// calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable);
calcdiscrepancy(aquamapsNativeTable, nnnativeTable);
}

View File

@ -10,14 +10,14 @@
<Packages>
<Software>
<Name>ecological-engine</Name>
<Version>1.6.0-SNAPSHOT</Version>
<Version>1.6.1-SNAPSHOT</Version>
<MavenCoordinates>
<groupId>org.gcube.dataanalysis</groupId>
<artifactId>ecological-engine</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.1-SNAPSHOT</version>
</MavenCoordinates>
<Files>
<File>ecological-engine-1.6.0-SNAPSHOT.jar</File>
<File>ecological-engine-1.6.1-SNAPSHOT.jar</File>
</Files>
</Software>
</Packages>