本文整理汇总了Java中org.jgap.InvalidConfigurationException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidConfigurationException类的具体用法?Java InvalidConfigurationException怎么用?Java InvalidConfigurationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvalidConfigurationException类属于org.jgap包,在下文中一共展示了InvalidConfigurationException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPreprocessingMeasures
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Returns new Measures and other CommandGenes to also learn Preprocessing.
*
* @param config LinkSpecGeneticLearnerConfig
* @return new Measures and other CommandGenes to also learn Preprocessing
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
*/
private List<CommandGene> getPreprocessingMeasures(LinkSpecGeneticLearnerConfig config) throws InvalidConfigurationException {
List<CommandGene> nodes = new LinkedList<CommandGene>();
nodes.add(new AtomicPreprocessingCommand("nolang", config));
nodes.add(new AtomicPreprocessingCommand("cleaniri", config));
nodes.add(new AtomicPreprocessingCommand("uppercase", config));
nodes.add(new AtomicPreprocessingCommand("lowercase", config));
nodes.add(new AtomicPreprocessingCommand("removebraces", config));
nodes.add(new AtomicPreprocessingCommand("regularAlphabet", config));
nodes.add(new ChainedPreprocessingCommand("nolang", config));
// nodes.add(new ChainedPreprocessingCommand("cleaniri", config));
nodes.add(new ChainedPreprocessingCommand("uppercase", config));
nodes.add(new ChainedPreprocessingCommand("lowercase", config));
// nodes.add(new ChainedPreprocessingCommand("removebraces", config));
// nodes.add(new ChainedPreprocessingCommand("regularAlphabet", config));
nodes.add(new StringPreprocessMeasure("trigrams", config, String.class, true));
nodes.add(new StringPreprocessMeasure("jaccard", config, String.class, true));
nodes.add(new StringPreprocessMeasure("cosine", config, String.class, true));
nodes.add(new StringPreprocessMeasure("levenshtein", config, String.class, true));
nodes.add(new StringPreprocessMeasure("overlap", config, String.class, true));
return nodes;
}
开发者ID:dice-group,项目名称:LIMES,代码行数:31,代码来源:ExpressionProblem.java
示例2: useGeneticOperators
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Applies all GeneticOperators registered with the Configuration. The
* chromosomes created by the operators are collected in a new Population
* instance, which is returned.
*
* @param a_config
* the configuration to use
* @param a_pop
* the population to use as input
* @return a new Population instance containing the new Chromosomes
*
* @author Klaus Meffert
* @author Tamas Mahr
* @since 3.2
*/
@SuppressWarnings("rawtypes")
protected Population useGeneticOperators(Configuration a_config, Population a_pop) {
try {
Population newGeneration = new Population(a_config, a_pop.size());
List geneticOperators = a_config.getGeneticOperators();
Iterator operatorIterator = geneticOperators.iterator();
while (operatorIterator.hasNext()) {
GeneticOperator operator = (GeneticOperator) operatorIterator.next();
/**@todo utilize jobs: integrate job into GeneticOperator*/
operator.operate(a_pop, newGeneration.getChromosomes());
}
return newGeneration;
} catch (InvalidConfigurationException e){
// should never happen
throw new IllegalStateException(e);
}
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:35,代码来源:DashboardBreeder.java
示例3: learn
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
@Override
protected MLResults learn(AMapping trainingData) {
try {
setUp(trainingData);
} catch (InvalidConfigurationException e) {
e.printStackTrace();
logger.error(e.getMessage());
return null;
}
turn++;
fitness.addToReference(extractPositiveMatches(trainingData));
fitness.fillCachesIncrementally(trainingData);
Integer nGen = (Integer) getParameter(GENERATIONS);
for (int gen = 1; gen <= nGen; gen++) {
gp.evolve();
bestSolutions.add(determineFittest(gp, gen));
}
MLResults result = createSupervisedResult();
return result;
}
开发者ID:dice-group,项目名称:LIMES,代码行数:27,代码来源:Eagle.java
示例4: StringPreprocessMeasure
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Constructor for atomic similarity measures. @FIXME antiquated and not actually used.
*
* @param opName
* Name of the LIMES similarity measure operation (e.g. "trigram").
* @param a_conf
* JGAP GPConfiguration.
* @param a_returnType
* The return type of this command.
* @param a_mutateable
* true: this Commandgene is mutateable, viz. the LIMES similarity measure might be changed
* to another one out of the allowed operations.
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
*/
public StringPreprocessMeasure(String opName, final GPConfiguration a_conf,
final Class<?> a_returnType, boolean a_mutateable)
throws InvalidConfigurationException {
super(a_conf, 4, a_returnType, 1,
new int[]{
ResourceTerminalType.STRINGPROPPAIR.intValue(),
ResourceTerminalType.THRESHOLD.intValue(),
ResourceTerminalType.PREPROCESS.intValue(),
ResourceTerminalType.PREPROCESS.intValue(),
}
);
fillOperationSet();
setOperationName(opName);
m_mutateable = a_mutateable;
setNoValidation(false);
}
开发者ID:dice-group,项目名称:LIMES,代码行数:31,代码来源:StringPreprocessMeasure.java
示例5: LinkSpecGeneticLearnerConfig
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Constructor.
*
* @param KBIsource
* Specifies the source knowledge base.
* @param KBItarget
* Specifies the target knowledge base.
* @param propMapping
* A Mapping of Properties of both source and target.
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
*/
public LinkSpecGeneticLearnerConfig(KBInfo KBIsource, KBInfo KBItarget, PropertyMapping propMapping) throws InvalidConfigurationException {
super();
this.source = KBIsource;
this.target = KBItarget;
this.propMap = propMapping;
setGPFitnessEvaluator(new DeltaGPFitnessEvaluator()); // the lower the better
setCrossoverMethod(new BranchTypingCross(this)); // standard
setSelectionMethod(new TournamentSelector(2)); // new TournamentSelector(2) vs. FitnessProportionate
setProgramCreationMaxTries(100);
setMinInitDepth(1);
setMaxInitDepth(15);
setPreservFittestIndividual(true);
setNewChromsPercent(0.25f); // 0.4
setMaxCrossoverDepth(5);
setVerifyPrograms(false);
// seems that if we use program caches it only verifies if the first chromosome has changed.
setUseProgramCache(false);
setAlwaysCaculateFitness(true);
//defaults
this.setMutationProb(0.4f);
this.setCrossoverProb(0.4f);
// this.setReproductionProb(0.7f);
this.setPopulationSize(30);
}
开发者ID:dice-group,项目名称:LIMES,代码行数:36,代码来源:LinkSpecGeneticLearnerConfig.java
示例6: StringPreprocessingMeasure
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Constructor for atomic similarity measures. @FIXME antiquated and not actually used.
*
* @param opName
* Name of the LIMES similarity measure operation (e.g. "trigram").
* @param a_conf
* JGAP GPConfiguration.
* @param a_returnType
* The return type of this command.
* @param a_mutateable
* true: this Commandgene is mutateable, viz. the LIMES similarity measure might be changed
* to another one out of the allowed operations.
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
*/
public StringPreprocessingMeasure(String opName, final GPConfiguration a_conf,
final Class<?> a_returnType, boolean a_mutateable)
throws InvalidConfigurationException {
super(a_conf, 2, a_returnType, 1,
new int[]{
ResourceTerminalType.STRINGPROPPAIR.intValue(),
// ResourceTerminalType.SOURCE.intValue(),
// ResourceTerminalType.TARGET.intValue(),
ResourceTerminalType.THRESHOLD.intValue(),}
);
fillOperationSet();
setOperationName(opName);
m_mutateable = a_mutateable;
setNoValidation(false);
}
开发者ID:dice-group,项目名称:LIMES,代码行数:30,代码来源:StringPreprocessingMeasure.java
示例7: BooleanCommand
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Default Constructor. A Boolean Metric is a boolean expression combining two
* similarity measures as of now.
*
* @param a_conf
* A JGAP GPconfiguration instance.
* @param a_returnType
* Define the return type of this node.
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
* TODO For a future version also allow other boolean measures to be children of this node.
*/
public BooleanCommand(final GPConfiguration a_conf, Class<?> a_returnType, String command)
throws InvalidConfigurationException {
super(a_conf, 2, a_returnType, 4,
new int[]{1, 1}
);
metric = command;
// add default operators
supportedMetrics = new ArrayList<String>();
supportedMetrics.add("AND");
supportedMetrics.add("OR");
// supportedMetrics.add("XOR");
// supportedMetrics.add("MINUS");
// supportedMetrics.add("MIN");
// supportedMetrics.add("MAX");
}
开发者ID:dice-group,项目名称:LIMES,代码行数:27,代码来源:BooleanCommand.java
示例8: apply
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public IChromosome apply (IChromosome firstMate, IChromosome secondMate, RandomGenerator generator, Configuration config) throws InvalidConfigurationException
{
Gene[] rgGenes = new Gene[m_nElementPerOperand];
for (int i = 0; i < m_nElementPerOperand; i++)
rgGenes[i] = new IntegerGene (config, 0, 2 * m_nElementPerOperand - 1);
int[] rgOpConfig = new int[m_mapSelectors.size ()];
int nIdx = 0;
for (int nID : m_listIDs)
{
List<Selector> list = m_mapSelectors.get (nID);
rgOpConfig[nIdx] = generator.nextInt (list.get (0).getArgsCount ());
for (Selector s : list)
rgGenes[s.getIndex ()].setAllele (s.getResult (firstMate, secondMate, rgOpConfig[nIdx], m_nElementPerOperand));
nIdx++;
}
List<Operand> listParent = new ArrayList<> (2);
listParent.add ((Operand) firstMate.getApplicationData ());
if (m_nOperandsCount >= 2)
listParent.add ((Operand) secondMate.getApplicationData ());
IChromosome c = new Chromosome (config, rgGenes);
c.setApplicationData (new Operand (null, null, listParent, this, rgOpConfig));
return c;
}
开发者ID:matthias-christen,项目名称:patus,代码行数:28,代码来源:PermutatorGenetic.java
示例9: newGeneInternal
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
protected Gene newGeneInternal() {
try {
final IdentifiableDoubleGene result = new IdentifiableDoubleGene(id,getConfiguration(),getLowerBound(),getUpperBound());
return result;
} catch (final InvalidConfigurationException iex) {
throw new IllegalStateException(iex.getMessage());
}
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:9,代码来源:IdentifiableDoubleGene.java
示例10: getSelector
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public NaturalSelector getSelector(final Configuration config) throws InvalidConfigurationException {
final BestChromosomesSelector selector = new BestChromosomesSelector(config,model.getValue() / 100.0);
selector.setDoubletteChromosomesAllowed(false);
//selector.setDoubletteChromosomesAllowed(doubletteCheckBox.isSelected());
return selector;
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:8,代码来源:BestChromosomeSelectorConfigurator.java
示例11: newGeneInternal
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
@Override
protected Gene newGeneInternal() {
try {
final IdentifiableListGene result = new IdentifiableListGene(id,getConfiguration());
result.value = value;
result.validValues = new ArrayList<Object>(validValues);
return result;
} catch (final InvalidConfigurationException iex) {
throw new IllegalStateException(iex.getMessage());
}
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:12,代码来源:IdentifiableListGene.java
示例12: IdentifiableLongGene
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public IdentifiableLongGene(final String id, final Configuration a_config, final long lowerBound, final long upperBound) throws InvalidConfigurationException {
super(a_config);
Preconditions.checkNotNull(id);
this.id = id;
this.lowerBound = lowerBound;
this.upperBound = upperBound;
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:8,代码来源:IdentifiableLongGene.java
示例13: getSelector
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public NaturalSelector getSelector(final Configuration config) throws InvalidConfigurationException {
final int size = (Integer) tournamentSizeModel.getValue();
final double probability = selectionProbabilityModel.getValue() / 100.0;
final TournamentSelector selector = new TournamentSelector(config,size,probability);
// selector.setDoubletteChromosomesAllowed(doubletteCheckBox.isSelected());
return selector;
}
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:9,代码来源:TournamentSelectorConfigurator.java
示例14: getStringMeasures
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Constructs normal String Measures without preprocessing children.
*
* @param config LinkSpecGeneticLearnerConfig
* @return normal String Measures without preprocessing children
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
*/
private List<CommandGene> getStringMeasures(LinkSpecGeneticLearnerConfig config) throws InvalidConfigurationException {
List<CommandGene> nodes = new LinkedList<CommandGene>();
nodes.add(new StringMeasure(MeasureFactory.COSINE, config, String.class, 1, true));
nodes.add(new StringMeasure(MeasureFactory.JACCARD, config, String.class, 1, true));
nodes.add(new StringMeasure(MeasureFactory.TRIGRAM, config, String.class, 1, true));
nodes.add(new StringMeasure(MeasureFactory.LEVENSHTEIN, config, String.class, 1, true));
nodes.add(new StringMeasure(MeasureFactory.OVERLAP, config, String.class, 1, true));
nodes.add(new StringMeasure(MeasureFactory.QGRAMS, config, String.class, 1, true));
// nodes.add(new StringMeasure(MeasureFactory.EXACTMATCH, config, String.class, 1, true));
return nodes;
}
开发者ID:dice-group,项目名称:LIMES,代码行数:19,代码来源:ExpressionProblem.java
示例15: setUp
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Configures EAGLE.
*
* @param trainingData training data
* @throws InvalidConfigurationException
*/
private void setUp(AMapping trainingData) throws InvalidConfigurationException {
PropertyMapping pm = (PropertyMapping) getParameter(PROPERTY_MAPPING);
if(!pm.wasSet()) {
pm.setDefault(configuration.getSourceInfo(), configuration.getTargetInfo());
}
LinkSpecGeneticLearnerConfig jgapConfig = new LinkSpecGeneticLearnerConfig(configuration.getSourceInfo(), configuration.getTargetInfo(), pm);
jgapConfig.sC = sourceCache;
jgapConfig.tC = targetCache;
jgapConfig.setPopulationSize((Integer) getParameter(POPULATION));
jgapConfig.setCrossoverProb((Float) getParameter(CROSSOVER_RATE));
jgapConfig.setMutationProb((Float) getParameter(MUTATION_RATE));
jgapConfig.setPreservFittestIndividual((Boolean) getParameter(PRESERVE_FITTEST));
jgapConfig.setReproductionProb((Float) getParameter(REPRODUCTION_RATE));
jgapConfig.setPropertyMapping(pm);
if(trainingData != null) { // supervised
FMeasure fm = (FMeasure) getParameter(MEASURE);
fitness = ExpressionFitnessFunction.getInstance(jgapConfig, fm, trainingData);
org.jgap.Configuration.reset();
jgapConfig.setFitnessFunction(fitness);
} else { // unsupervised
PseudoFMeasure pfm = (PseudoFMeasure) getParameter(PSEUDO_FMEASURE);
fitness = PseudoFMeasureFitnessFunction.getInstance(jgapConfig, pfm, sourceCache, targetCache);
org.jgap.Configuration.reset();
jgapConfig.setFitnessFunction(fitness);
}
GPProblem gpP;
gpP = new ExpressionProblem(jgapConfig);
gp = gpP.create();
}
开发者ID:dice-group,项目名称:LIMES,代码行数:46,代码来源:Eagle.java
示例16: NumberMeasure
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
/**
* Constructor for atomic similarity measures for numeric properties.
*
* @param a_conf
* JGAP GPConfiguration.
* @param a_returnType
* The return type of this command.
* @param a_mutateable
* true: enables mutation.
* @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object
*/
public NumberMeasure(final GPConfiguration a_conf,
final Class<?> a_returnType, boolean a_mutateable)
throws InvalidConfigurationException {
super(a_conf, 2, a_returnType, 1,
new int[]{
ResourceTerminalType.NUMBERPROPPAIR.intValue(),
ResourceTerminalType.NUMBERTHRESHOLD.intValue(),}
);
m_mutateable = a_mutateable;
setNoValidation(false);
}
开发者ID:dice-group,项目名称:LIMES,代码行数:23,代码来源:NumberMeasure.java
示例17: applyMutation
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public CommandGene applyMutation(int a_index, double a_percentage)
throws InvalidConfigurationException {
// we will change the measure to a random one out of the Set of allowed operations
if (!m_mutateable) {
return this;
}
RandomGenerator randomGen = getGPConfiguration().getRandomGenerator();
double random = randomGen.nextDouble();
if (random < a_percentage) {
return applyMutation();
}
return this;
}
开发者ID:dice-group,项目名称:LIMES,代码行数:14,代码来源:StringPreprocessMeasure.java
示例18: applyMutation
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
@Override
public CommandGene applyMutation(int a_index, double a_percentage) throws InvalidConfigurationException {
// we will change the measure to a random one out of the Set of allowed
// operations
if (!m_mutateable) {
return this;
}
RandomGenerator randomGen = getGPConfiguration().getRandomGenerator();
double random = randomGen.nextDouble();
if (random < a_percentage) {
return applyMutation();
}
return this;
}
开发者ID:dice-group,项目名称:LIMES,代码行数:15,代码来源:PointSetMeasure.java
示例19: ChainedPreprocessingCommand
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public ChainedPreprocessingCommand(String command, GPConfiguration a_conf)
throws InvalidConfigurationException {
super(a_conf, 1, String.class, ResourceTerminalType.PREPROCESS.intValue(),
new int[]{ResourceTerminalType.PREPROCESS.intValue(),});
this.command = command;
functions.add(command);
}
开发者ID:dice-group,项目名称:LIMES,代码行数:8,代码来源:ChainedPreprocessingCommand.java
示例20: applyMutation
import org.jgap.InvalidConfigurationException; //导入依赖的package包/类
public CommandGene applyMutation(int a_index, double a_percentage)
throws InvalidConfigurationException {
if (!is_mutable) {
return this;
}
//FIXME somehow silly to do this !
RandomGenerator randomGen = getGPConfiguration().getRandomGenerator();
double random = randomGen.nextDouble();
if (random < a_percentage) {
return applyMutation();
}
return this;
}
开发者ID:dice-group,项目名称:LIMES,代码行数:14,代码来源:ChainedPreprocessingCommand.java
注:本文中的org.jgap.InvalidConfigurationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论