diff --git a/neuralnetwork_Fis-30189_staticnative_neuralname b/neuralnetwork_Fis-30189_staticnative_neuralname new file mode 100644 index 0000000..389893e Binary files /dev/null and b/neuralnetwork_Fis-30189_staticnative_neuralname differ diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/configuration/ALG_PROPS.java b/src/main/java/org/gcube/dataanalysis/ecoengine/configuration/ALG_PROPS.java index 62ec85c..ba293dc 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/configuration/ALG_PROPS.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/configuration/ALG_PROPS.java @@ -2,6 +2,7 @@ package org.gcube.dataanalysis.ecoengine.configuration; public enum ALG_PROPS { + PARALLEL_SPECIES_VS_CSQUARE_FROM_DATABASE, SPECIES_VS_CSQUARE_FROM_DATABASE, SPECIES_VS_CSQUARE_REMOTE_FROM_DATABASE, SPECIES_VS_CSQUARE, diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNN.java b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNN.java index 80447e6..7e25906 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNN.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNN.java @@ -6,6 +6,7 @@ import java.io.ObjectInputStream; import java.util.List; import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger; +import org.gcube.dataanalysis.ecoengine.configuration.ALG_PROPS; import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration; import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType; import org.gcube.dataanalysis.ecoengine.datatypes.ServiceType; @@ -18,6 +19,7 @@ import org.hibernate.SessionFactory; public class AquamapsNN extends AquamapsNative{ private Neural_Network neuralnet; + @Override public String getName() { diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNNSuitable.java b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNNSuitable.java index b4b2ca1..ca5c6f1 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNNSuitable.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNNSuitable.java @@ -6,6 +6,7 @@ import java.io.ObjectInputStream; import java.util.List; import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger; +import org.gcube.dataanalysis.ecoengine.configuration.ALG_PROPS; import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration; import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType; import org.gcube.dataanalysis.ecoengine.datatypes.ServiceType; @@ -19,6 +20,12 @@ public class AquamapsNNSuitable extends AquamapsSuitable{ private Neural_Network neuralnet; + @Override + public ALG_PROPS[] getProperties() { + ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE}; + return p; + } + @Override public String getName() { return "AQUAMAPS_SUITABLE_NEURAL_NETWORK"; diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNative.java b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNative.java index d619ca0..0b846d6 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNative.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsNative.java @@ -3,8 +3,17 @@ package org.gcube.dataanalysis.ecoengine.spatialdistributions; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; +import org.gcube.dataanalysis.ecoengine.configuration.ALG_PROPS; + public class AquamapsNative extends AquamapsSuitable { + + @Override + public ALG_PROPS[] getProperties() { + ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE}; + return p; + } + @Override // to overwrite in case of native generation in order to filer on the probabilities types public Queue filterProbabilitySet(Queue probabiltyRows) { diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable.java b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable.java index d6eb856..2f88da0 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable.java @@ -233,7 +233,7 @@ public class AquamapsSuitable implements SpatialProbabilityDistributionTable{ @Override public ALG_PROPS[] getProperties() { // ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE, ALG_PROPS.SPECIES_VS_CSQUARE_REMOTE_FROM_DATABASE}; - ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE}; + ALG_PROPS [] p = {ALG_PROPS.PARALLEL_SPECIES_VS_CSQUARE_FROM_DATABASE}; return p; } diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable2050.java b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable2050.java index 516c2cd..6bd6525 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable2050.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/spatialdistributions/AquamapsSuitable2050.java @@ -1,5 +1,6 @@ package org.gcube.dataanalysis.ecoengine.spatialdistributions; +import org.gcube.dataanalysis.ecoengine.configuration.ALG_PROPS; import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration; import org.hibernate.SessionFactory; @@ -11,6 +12,12 @@ public class AquamapsSuitable2050 extends AquamapsSuitable { type = "2050"; } + @Override + public ALG_PROPS[] getProperties() { + ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE}; + return p; + } + @Override public String getName() { return "AQUAMAPS_SUITABLE_2050"; diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/test/experiments/latimeria/ExperimentsForLatimeria.java b/src/main/java/org/gcube/dataanalysis/ecoengine/test/experiments/latimeria/ExperimentsForLatimeria.java index f95c64d..cad1324 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/test/experiments/latimeria/ExperimentsForLatimeria.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/test/experiments/latimeria/ExperimentsForLatimeria.java @@ -42,6 +42,7 @@ public class ExperimentsForLatimeria { static String randomnative = "randomnative"; static int numberOfPoints = 34; + static String nnname = "neuralname"; static float x1 = 95.346678f; static float y1 = -9.18887f; static float x2 = 125.668944f; @@ -104,7 +105,7 @@ public class ExperimentsForLatimeria { List modelers = null; System.out.println("*****************************TRAINING NN SUITABLE WITH STATIC ABSENCES**********************************"); - modelers = ModelersFactory.getModelers(PresetConfigGenerator.configSuitableNeuralNetworkTraining(presenceTable,absenceStaticTable,staticsuitable,speciesID,"100"+AlgorithmConfiguration.getListSeparator()+"2")); + modelers = ModelersFactory.getModelers(PresetConfigGenerator.configSuitableNeuralNetworkTraining(presenceTable,absenceStaticTable,staticsuitable,speciesID,"100"+AlgorithmConfiguration.getListSeparator()+"2",nnname)); modelers.get(0).init(); Regressor.process(modelers.get(0)); modelers = null; @@ -117,7 +118,7 @@ public class ExperimentsForLatimeria { */ System.out.println("*****************************TRAINING NN NATIVE WITH STATIC ABSENCES**********************************"); - modelers = ModelersFactory.getModelers(PresetConfigGenerator.configNativeNeuralNetworkTraining(presenceTable,absenceStaticTable,staticnative,speciesID,"100")); + modelers = ModelersFactory.getModelers(PresetConfigGenerator.configNativeNeuralNetworkTraining(presenceTable,absenceStaticTable,staticnative,speciesID,"100",nnname)); modelers.get(0).init(); Regressor.process(modelers.get(0)); modelers = null; @@ -134,7 +135,7 @@ public class ExperimentsForLatimeria { List modelers = null; System.out.println("*****************************TRAINING NN SUITABLE WITH STATIC ABSENCES**********************************"); - modelers = ModelersFactory.getModelers(PresetConfigGenerator.configSuitableNeuralNetworkTraining(presenceTable,absenceStaticTable,staticsuitable,speciesID,"100"+AlgorithmConfiguration.getListSeparator()+"2")); + modelers = ModelersFactory.getModelers(PresetConfigGenerator.configSuitableNeuralNetworkTraining(presenceTable,absenceStaticTable,staticsuitable,speciesID,"100"+AlgorithmConfiguration.getListSeparator()+"2",nnname)); modelers.get(0).init(); Regressor.process(modelers.get(0)); modelers = null; @@ -144,7 +145,7 @@ public class ExperimentsForLatimeria { System.out.println("*****************************TRAINING NN NATIVE WITH STATIC ABSENCES**********************************"); List modelers = null; - modelers = ModelersFactory.getModelers(PresetConfigGenerator.configNativeNeuralNetworkTraining(presenceTable,absenceStaticTable,staticnative,speciesID,"100"+AlgorithmConfiguration.getListSeparator()+"2")); + modelers = ModelersFactory.getModelers(PresetConfigGenerator.configNativeNeuralNetworkTraining(presenceTable,absenceStaticTable,staticnative,speciesID,"100"+AlgorithmConfiguration.getListSeparator()+"2",nnname)); modelers.get(0).init(); Regressor.process(modelers.get(0)); modelers = null; @@ -155,7 +156,7 @@ public class ExperimentsForLatimeria { public static void generateAquamapsNativeSuitableNeuralNetwokrs() throws Exception{ List generators = null; System.out.println("*****************************GENERATING NN SUITABLE WITH STATIC ABSENCES**********************************"); - generators = GeneratorsFactory.getGenerators(PresetConfigGenerator.configAquamapsNNSuitable(nnsuitableTable,staticsuitable,envelopeTable,speciesID)); + generators = GeneratorsFactory.getGenerators(PresetConfigGenerator.configAquamapsNNSuitable(nnsuitableTable,staticsuitable,envelopeTable,speciesID,nnname)); generators.get(0).init(); Regressor.process(generators.get(0)); generators = null; @@ -169,7 +170,7 @@ public class ExperimentsForLatimeria { */ System.out.println("*****************************GENERATING NN NATIVE WITH STATIC ABSENCES**********************************"); - generators = GeneratorsFactory.getGenerators(PresetConfigGenerator.configAquamapsNNNative(nnnativeTable,staticnative,envelopeTable,speciesID)); + generators = GeneratorsFactory.getGenerators(PresetConfigGenerator.configAquamapsNNNative(nnnativeTable,staticnative,envelopeTable,speciesID,nnname)); generators.get(0).init(); Regressor.process(generators.get(0)); generators = null; @@ -280,17 +281,16 @@ public class ExperimentsForLatimeria { // generateAbsenceTable(); // generateHCAFFilter(); //train the neural networks on these tables -// trainSuitableNeuralNetworks(); -// trainNativeNeuralNetworks(); + trainSuitableNeuralNetworks(); + trainNativeNeuralNetworks(); //project the neural networks -// generateAquamapsNativeSuitableNeuralNetwokrs(); + generateAquamapsNativeSuitableNeuralNetwokrs(); //Analysis - + + /* calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable); calcdiscrepancy(aquamapsNativeTable, nnnativeTable); - - - /* + calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable); calcdiscrepancy(aquamapsNativeTable, nnnativeTable); diff --git a/src/main/java/org/gcube/dataanalysis/ecoengine/utils/PresetConfigGenerator.java b/src/main/java/org/gcube/dataanalysis/ecoengine/utils/PresetConfigGenerator.java index 00f2716..9d402a3 100644 --- a/src/main/java/org/gcube/dataanalysis/ecoengine/utils/PresetConfigGenerator.java +++ b/src/main/java/org/gcube/dataanalysis/ecoengine/utils/PresetConfigGenerator.java @@ -34,7 +34,7 @@ public class PresetConfigGenerator { return config; } - public static AlgorithmConfiguration configAquamapsNNSuitable(String tableName,String username, String envelopeTable, String speciesID) { + public static AlgorithmConfiguration configAquamapsNNSuitable(String tableName,String username, String envelopeTable, String speciesID,String nnname) { AlgorithmConfiguration config = Regressor.getConfig(); config.setNumberOfResources(5); @@ -46,11 +46,12 @@ public class PresetConfigGenerator { config.setParam("CreateTable", "true"); config.setParam("SpeciesName", speciesID); config.setParam("UserName", username); - + config.setParam("NeuralNetworkName", nnname); + return config; } - public static AlgorithmConfiguration configAquamapsNNNative(String tableName,String username, String envelopeTable, String speciesID) { + public static AlgorithmConfiguration configAquamapsNNNative(String tableName,String username, String envelopeTable, String speciesID,String nnname) { AlgorithmConfiguration config = Regressor.getConfig(); config.setNumberOfResources(5); @@ -62,11 +63,11 @@ public class PresetConfigGenerator { config.setParam("CreateTable", "true"); config.setParam("SpeciesName", speciesID); config.setParam("UserName", username); - + config.setParam("NeuralNetworkName", nnname); return config; } - public static AlgorithmConfiguration configSuitableNeuralNetworkTraining(String presenceTable, String absenceTable,String username, String speciesID, String neuronsAndLayers) { + public static AlgorithmConfiguration configSuitableNeuralNetworkTraining(String presenceTable, String absenceTable,String username, String speciesID, String neuronsAndLayers,String nnname) { AlgorithmConfiguration config = Regressor.getConfig(); config.setNumberOfResources(5); @@ -77,11 +78,11 @@ public class PresetConfigGenerator { config.setParam("SpeciesName", speciesID); config.setParam("UserName",username); config.setParam("LayersNeurons", neuronsAndLayers); - + config.setParam("NeuralNetworkName", nnname); return config; } - public static AlgorithmConfiguration configNativeNeuralNetworkTraining(String presenceTable, String absenceTable,String username, String speciesID, String neuronsAndLayers) { + public static AlgorithmConfiguration configNativeNeuralNetworkTraining(String presenceTable, String absenceTable,String username, String speciesID, String neuronsAndLayers,String nnname) { AlgorithmConfiguration config = Regressor.getConfig(); config.setNumberOfResources(5); @@ -92,7 +93,8 @@ public class PresetConfigGenerator { config.setParam("SpeciesName", speciesID); config.setParam("UserName", username); config.setParam("LayersNeurons", neuronsAndLayers); - + config.setParam("NeuralNetworkName", nnname); + return config; }