This commit is contained in:
Gianpaolo Coro 2012-09-28 09:08:38 +00:00
parent c75e118b6c
commit 38ef8f8b51
9 changed files with 50 additions and 22 deletions

Binary file not shown.

View File

@ -2,6 +2,7 @@ package org.gcube.dataanalysis.ecoengine.configuration;
public enum ALG_PROPS { public enum ALG_PROPS {
PARALLEL_SPECIES_VS_CSQUARE_FROM_DATABASE,
SPECIES_VS_CSQUARE_FROM_DATABASE, SPECIES_VS_CSQUARE_FROM_DATABASE,
SPECIES_VS_CSQUARE_REMOTE_FROM_DATABASE, SPECIES_VS_CSQUARE_REMOTE_FROM_DATABASE,
SPECIES_VS_CSQUARE, SPECIES_VS_CSQUARE,

View File

@ -6,6 +6,7 @@ import java.io.ObjectInputStream;
import java.util.List; import java.util.List;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger; 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.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType; import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType;
import org.gcube.dataanalysis.ecoengine.datatypes.ServiceType; import org.gcube.dataanalysis.ecoengine.datatypes.ServiceType;
@ -19,6 +20,7 @@ public class AquamapsNN extends AquamapsNative{
private Neural_Network neuralnet; private Neural_Network neuralnet;
@Override @Override
public String getName() { public String getName() {
return "AQUAMAPS_NATIVE_NEURAL_NETWORK"; return "AQUAMAPS_NATIVE_NEURAL_NETWORK";

View File

@ -6,6 +6,7 @@ import java.io.ObjectInputStream;
import java.util.List; import java.util.List;
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger; 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.configuration.AlgorithmConfiguration;
import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType; import org.gcube.dataanalysis.ecoengine.datatypes.PrimitiveType;
import org.gcube.dataanalysis.ecoengine.datatypes.ServiceType; import org.gcube.dataanalysis.ecoengine.datatypes.ServiceType;
@ -19,6 +20,12 @@ public class AquamapsNNSuitable extends AquamapsSuitable{
private Neural_Network neuralnet; private Neural_Network neuralnet;
@Override
public ALG_PROPS[] getProperties() {
ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE};
return p;
}
@Override @Override
public String getName() { public String getName() {
return "AQUAMAPS_SUITABLE_NEURAL_NETWORK"; return "AQUAMAPS_SUITABLE_NEURAL_NETWORK";

View File

@ -3,8 +3,17 @@ package org.gcube.dataanalysis.ecoengine.spatialdistributions;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import org.gcube.dataanalysis.ecoengine.configuration.ALG_PROPS;
public class AquamapsNative extends AquamapsSuitable { public class AquamapsNative extends AquamapsSuitable {
@Override
public ALG_PROPS[] getProperties() {
ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE};
return p;
}
@Override @Override
// to overwrite in case of native generation in order to filer on the probabilities types // to overwrite in case of native generation in order to filer on the probabilities types
public Queue<String> filterProbabilitySet(Queue<String> probabiltyRows) { public Queue<String> filterProbabilitySet(Queue<String> probabiltyRows) {

View File

@ -233,7 +233,7 @@ public class AquamapsSuitable implements SpatialProbabilityDistributionTable{
@Override @Override
public ALG_PROPS[] getProperties() { 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.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; return p;
} }

View File

@ -1,5 +1,6 @@
package org.gcube.dataanalysis.ecoengine.spatialdistributions; package org.gcube.dataanalysis.ecoengine.spatialdistributions;
import org.gcube.dataanalysis.ecoengine.configuration.ALG_PROPS;
import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration; import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
@ -11,6 +12,12 @@ public class AquamapsSuitable2050 extends AquamapsSuitable {
type = "2050"; type = "2050";
} }
@Override
public ALG_PROPS[] getProperties() {
ALG_PROPS [] p = {ALG_PROPS.SPECIES_VS_CSQUARE_FROM_DATABASE};
return p;
}
@Override @Override
public String getName() { public String getName() {
return "AQUAMAPS_SUITABLE_2050"; return "AQUAMAPS_SUITABLE_2050";

View File

@ -42,6 +42,7 @@ public class ExperimentsForLatimeria {
static String randomnative = "randomnative"; static String randomnative = "randomnative";
static int numberOfPoints = 34; static int numberOfPoints = 34;
static String nnname = "neuralname";
static float x1 = 95.346678f; static float x1 = 95.346678f;
static float y1 = -9.18887f; static float y1 = -9.18887f;
static float x2 = 125.668944f; static float x2 = 125.668944f;
@ -104,7 +105,7 @@ public class ExperimentsForLatimeria {
List<Modeler> modelers = null; List<Modeler> modelers = null;
System.out.println("*****************************TRAINING NN SUITABLE WITH STATIC ABSENCES**********************************"); 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(); modelers.get(0).init();
Regressor.process(modelers.get(0)); Regressor.process(modelers.get(0));
modelers = null; modelers = null;
@ -117,7 +118,7 @@ public class ExperimentsForLatimeria {
*/ */
System.out.println("*****************************TRAINING NN NATIVE WITH STATIC ABSENCES**********************************"); 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(); modelers.get(0).init();
Regressor.process(modelers.get(0)); Regressor.process(modelers.get(0));
modelers = null; modelers = null;
@ -134,7 +135,7 @@ public class ExperimentsForLatimeria {
List<Modeler> modelers = null; List<Modeler> modelers = null;
System.out.println("*****************************TRAINING NN SUITABLE WITH STATIC ABSENCES**********************************"); 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(); modelers.get(0).init();
Regressor.process(modelers.get(0)); Regressor.process(modelers.get(0));
modelers = null; modelers = null;
@ -144,7 +145,7 @@ public class ExperimentsForLatimeria {
System.out.println("*****************************TRAINING NN NATIVE WITH STATIC ABSENCES**********************************"); System.out.println("*****************************TRAINING NN NATIVE WITH STATIC ABSENCES**********************************");
List<Modeler> modelers = null; List<Modeler> 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(); modelers.get(0).init();
Regressor.process(modelers.get(0)); Regressor.process(modelers.get(0));
modelers = null; modelers = null;
@ -155,7 +156,7 @@ public class ExperimentsForLatimeria {
public static void generateAquamapsNativeSuitableNeuralNetwokrs() throws Exception{ public static void generateAquamapsNativeSuitableNeuralNetwokrs() throws Exception{
List<Generator> generators = null; List<Generator> generators = null;
System.out.println("*****************************GENERATING NN SUITABLE WITH STATIC ABSENCES**********************************"); 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(); generators.get(0).init();
Regressor.process(generators.get(0)); Regressor.process(generators.get(0));
generators = null; generators = null;
@ -169,7 +170,7 @@ public class ExperimentsForLatimeria {
*/ */
System.out.println("*****************************GENERATING NN NATIVE WITH STATIC ABSENCES**********************************"); 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(); generators.get(0).init();
Regressor.process(generators.get(0)); Regressor.process(generators.get(0));
generators = null; generators = null;
@ -280,17 +281,16 @@ public class ExperimentsForLatimeria {
// generateAbsenceTable(); // generateAbsenceTable();
// generateHCAFFilter(); // generateHCAFFilter();
//train the neural networks on these tables //train the neural networks on these tables
// trainSuitableNeuralNetworks(); trainSuitableNeuralNetworks();
// trainNativeNeuralNetworks(); trainNativeNeuralNetworks();
//project the neural networks //project the neural networks
// generateAquamapsNativeSuitableNeuralNetwokrs(); generateAquamapsNativeSuitableNeuralNetwokrs();
//Analysis //Analysis
/*
calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable); calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable);
calcdiscrepancy(aquamapsNativeTable, nnnativeTable); calcdiscrepancy(aquamapsNativeTable, nnnativeTable);
/*
calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable); calcdiscrepancy(aquamapsSuitableTable, nnsuitableTable);
calcdiscrepancy(aquamapsNativeTable, nnnativeTable); calcdiscrepancy(aquamapsNativeTable, nnnativeTable);

View File

@ -34,7 +34,7 @@ public class PresetConfigGenerator {
return config; 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(); AlgorithmConfiguration config = Regressor.getConfig();
config.setNumberOfResources(5); config.setNumberOfResources(5);
@ -46,11 +46,12 @@ public class PresetConfigGenerator {
config.setParam("CreateTable", "true"); config.setParam("CreateTable", "true");
config.setParam("SpeciesName", speciesID); config.setParam("SpeciesName", speciesID);
config.setParam("UserName", username); config.setParam("UserName", username);
config.setParam("NeuralNetworkName", nnname);
return config; 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(); AlgorithmConfiguration config = Regressor.getConfig();
config.setNumberOfResources(5); config.setNumberOfResources(5);
@ -62,11 +63,11 @@ public class PresetConfigGenerator {
config.setParam("CreateTable", "true"); config.setParam("CreateTable", "true");
config.setParam("SpeciesName", speciesID); config.setParam("SpeciesName", speciesID);
config.setParam("UserName", username); config.setParam("UserName", username);
config.setParam("NeuralNetworkName", nnname);
return config; 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(); AlgorithmConfiguration config = Regressor.getConfig();
config.setNumberOfResources(5); config.setNumberOfResources(5);
@ -77,11 +78,11 @@ public class PresetConfigGenerator {
config.setParam("SpeciesName", speciesID); config.setParam("SpeciesName", speciesID);
config.setParam("UserName",username); config.setParam("UserName",username);
config.setParam("LayersNeurons", neuronsAndLayers); config.setParam("LayersNeurons", neuronsAndLayers);
config.setParam("NeuralNetworkName", nnname);
return config; 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(); AlgorithmConfiguration config = Regressor.getConfig();
config.setNumberOfResources(5); config.setNumberOfResources(5);
@ -92,6 +93,7 @@ public class PresetConfigGenerator {
config.setParam("SpeciesName", speciesID); config.setParam("SpeciesName", speciesID);
config.setParam("UserName", username); config.setParam("UserName", username);
config.setParam("LayersNeurons", neuronsAndLayers); config.setParam("LayersNeurons", neuronsAndLayers);
config.setParam("NeuralNetworkName", nnname);
return config; return config;
} }