input
stringlengths
10
828
output
stringlengths
5
107
public class get input type return input type
returns the desired class of the input object
public boolean get keep default return keep default
indicates if the input should be consumed
public boolean show parameter return parameter
indicates if a user parameter should be defined
public string to string return input description for input type keep keep default parameter parameter name parameter name
returns a string representation of this input description
public void set lower argument bound double lower this lower bound lower
since circles are used the upper and lower bounds must be the same
public void set lower argument bound double lower this bound math max this bound math abs lower
since circles are used the upper and lower bounds must be the same
public void set total number of attributes int number this number of attributes number
sets the total number of attributes
public void set total number of examples int number this total number number
sets the total number of examples
public void set lower argument bound double lower
since circles are used the upper and lower bounds must be the same
public void set process process process this process process register operator this process
sets the process
public boolean should return inner output return true
returns true since this operator chain should just return the output of
public inner operator condition get inner operator condition return new simple chain inner operator condition
returns a simple chain condition
public boolean get add only additional output return true
since the apply methods of the inner operators already add additional
public int get max number of inner operators return integer max value
returns the highest possible value for the maximum number of innner
public int get min number of inner operators return 0
returns 0 for the minimum number of innner operators
public void add process listener process listener l listener list add l
adds an process listener to the list of listeners
public void remove process listener process listener l listener list remove l
removes an process listener from the list of listeners
public void clear listeners listener list clear
clears all process listeners
private iocontainer evaluate throws operator exception iocontainer container get input copy for int i 0 i get number of operators i container get operator i apply container return container
applies the inner operator
public void process starts throws operator exception super process starts iterator i listener list iterator while i has next process listener i next process starts this process
called at the beginning of the process
private void log output string message input stream in throws ioexception buffered reader bin new buffered reader new input stream reader in string line null string buffer buffer new string buffer message while line bin read line null buffer append tools get line separator buffer append line log note buffer to string
sends the output to the log service
protected void process started operator operator op for process listener listener listener list listener process started operator this process op
counts the step and notifies all process listeners
protected void process finished operator operator op for process listener listener listener list listener process finished operator this process op
counts the step and notifies all process listeners
public void process finished throws operator exception super process finished iterator i listener list iterator while i has next process listener i next process ended this process
called at the end of the process
public double get probability return double na n
returns na n since no single probability will be delivered
public int get max number of inner operators return 2
returns the maximum number of innner operators
public int get min number of inner operators return 2
returns the minimum number of innner operators
protected operator get learner return get operator 0
returns the first encapsulated inner operator or operator chain i
private operator get evaluator return get operator 1
returns the second encapsulated inner operator or operator chain i
protected iocontainer learn example set training set throws operator exception return learn result get learner apply new iocontainer new ioobject training set
applies the learner first encapsulated inner operator
protected iocontainer evaluate example set test set throws operator exception if learn result null throw new runtime exception wrong use of validation chain evaluate example set no preceding invocation of learn example set iocontainer result evaluate test set learn result learn result null return result
applies the applier and evaluator second encapsulated inner operator
public void add add listener add listener listener add listeners add listener
adds the given listener
public void remove add listener add listener listener add listeners remove listener
removes the given listener
public int size return io objects size
returns the number of
private void fire add event operator child iterator add listener i add listeners iterator while i has next i next operator added child
notifies all added add listeners that a new child was added
public ioobject get element at int index return io objects get index
returns the n th
public ioobject remove element at int index return io objects remove index
removes and returns the n th
public operator clone operator string name operator chain clone operator chain super clone operator name clone operators new vector operator iterator operator i operators iterator while i has next operator original child i next operator cloned child original child clone operator original child get name cloned child set parent clone clone add operator cloned child return clone
performs a deep clone of this operator chain
public boolean contains class extends ioobject cls try get input cls 0 false return true catch missing ioobject exception e return false
returns true if this iocontainer containts an ioobject of the desired
public iocontainer append ioobject object return append new ioobject object
creates a new iocontainer by adding all ioobjects of this container to
protected boolean should return inner output return false
indicates if inner output should be delivered by this operator chain
public iocontainer append ioobject output list ioobject new objects new linked list ioobject for int i 0 i output length i new objects add output i new objects add all io objects return new iocontainer new objects
creates a new iocontainer by adding all ioobjects of this container to
public iocontainer prepend ioobject object return prepend new ioobject object
creates a new iocontainer by adding the given object before the ioobjects
public iocontainer prepend ioobject output list ioobject new objects new linked list ioobject new objects add all io objects for int i 0 i output length i new objects add output i return new iocontainer new objects
creates a new iocontainer by adding the given objects before the
public iocontainer append collection ioobject output list ioobject new objects new linked list ioobject new objects add all output new objects add all io objects return new iocontainer new objects
appends this containers ioobjects to output
protected void register operator process process super register operator process iterator operator i operators iterator while i has next operator child i next child register operator process
register this operator chain and all of its children in the given process
public void remove all io objects clear
removes all objects from this iocontainer
protected void unregister operator process process super unregister operator process iterator operator i operators iterator while i has next operator operator i next operator unregister operator process
unregisters this chain and all of its children from the given process
public operator get operator int i if i 0 i get number of operators throw new runtime exception illegal operator index in get operator get name i int counter 0 iterator operator o operators iterator while o has next operator operator o next if operator is enabled if counter i return operator counter return null
returns the i th inner operator
public int get number of operators int number 0 iterator operator i operators iterator while i has next operator op i next if op is enabled number return number
returns the number of all enabled inner operators
public int get number of all operators return operators size
returns the number of all inner operators including the disabled
public operator get operator from all int i return operators get i
returns the i th operator
public void add individual individual individuals add individual
adds a single individual
public int get index of operator operator operator boolean use disabled if use disabled return operators index of operator else int index 0 iterator operator i operators iterator while i has next operator current i next if current is enabled if current equals operator return index index return 1
returns the index of the given operator in the list of children
public void add all individuals collection individual new individuals individuals add all new individuals
adds all individuals from the given collection
public void remove individual individual individuals remove individual
removes a single individual
public void remove int i individuals remove i
removes a single individual
public operator get inner operator for name string name if name null return null if name equals this get name return this iterator operator i operators iterator while i has next operator inner i next if name equals inner get name return inner if inner instanceof operator chain operator innerinner operator chain inner get inner operator for name name if innerinner null return innerinner return null
returns the inner operator named tt name tt or null if no such
public individual get int i return individuals get i
returns a single individual
public int get number of individuals return individuals size
returns the number of all individuals
public boolean empty return individuals size 0
returns true is the population contains no individuals
public void next generation generation
increase the generation number by one
public void process starts throws operator exception super process starts for int i 0 i get number of operators i get operator i process starts
invokes the super method and the method for all children
public int get generations without improval return generation generation of last improval
returns the number of generations without improval
public void update evaluation current best search best current best performance current best null null current best get performance if best ever null current best null current best performance compare to best performance ever 0 best ever new individual current best get weights best ever set performance current best get performance best performance ever best ever get performance generation of last improval generation
remember the current generations best individual and update the best
private individual search best try return collections max individuals performance comparator catch null pointer exception e return null catch no such element exception e return null
finds the current generations best individual
public void process finished throws operator exception super process finished for int i 0 i get number of operators i get operator i process finished
invokes the super method and the method for all children
public performance vector get best performance ever return best performance ever
returns the best performance
private asevaluation get weka attribute evaluator string prefix name string parameters throws operator exception string actual name prefix name substring weka tools weka operator prefix length string evaluator name null for int i 0 i weka attribute evaluators length i if weka attribute evaluators i ends with actual name evaluator name weka attribute evaluators i break asevaluation evaluator null try evaluator asevaluation asevaluation for name evaluator name parameters catch exception e throw new user error this e 904 new object evaluator name e return evaluator
returns the weka attribute evaluator based on the subtype of this
public individual get best individual ever return best ever
returns all generations best individual
public individual get current best return current best
returns the last generations best individual
public void perform additional checks throws user error iterator operator i operators iterator while i has next operator o i next if o is enabled o perform additional checks
this method invokes the additional check method for each child
public performance vector get current best performance return current best performance
returns the last generations best performance
public void sort collections sort individuals performance comparator
sorts the individuals in ascending order according to their performance
public int check properties int error count super check properties iterator operator i operators iterator while i has next operator o i next if o is enabled error count o check properties return error count
will throw an exception if a non optional property has no default value
public int check deprecations int deprecation count super check deprecations iterator operator i operators iterator while i has next operator o i next deprecation count o check deprecations return deprecation count
will count an the number of deprecated operators i
public boolean perform operation int generation return true
the default implementation returns true for every generation
protected string create process tree int indent string self prefix string child prefix operator mark operator string mark string tree super create process tree indent self prefix child prefix mark operator mark iterator operator i operators iterator while i has next operator o i next tree tools get line separator o create process tree indent child prefix child prefix i has next mark operator mark return tree
returns this operator chains name and class and the process trees of
public process get process operator parent get parent if parent null return null else return parent get process
returns the process of this operator by asking the parent operator
private double calculate distance example first example second double distance 0 for attribute attribute first get attributes double diff first get value attribute second get value attribute distance diff diff return math sqrt distance
calculates the euclidean distance between both examples
private boolean solution good enough if generation max generation return true else return false
returns true if the maximum number of generations was reached
private boolean is valid int individual for int i 0 i individual length i if individual i 0 return true return false
checks if at least one feature was selected
public void mutate list aggregation individual population list aggregation individual children new array list aggregation individual iterator aggregation individual i population iterator while i has next aggregation individual individual i next int parent individual get individual int child new int parent length for int j 0 j child length j child j parent j mutate child if is valid child children add new aggregation individual child population add all children
invokes the method mutate int for each individual
private void mutate int individual double prob 1 0d individual length int max 1 for int i 0 i individual length i if individual i max max individual i for int i 0 i individual length i if random next double prob individual i random next int in range 1 max 1
changes the individual each gene with probability 1 n
private void crossover int individual1 int individual2 switch crossover type case crossover one point int n 1 random next int individual1 length 1 for int i n i individual1 length i int dummy individual1 i individual1 i individual2 i individual2 i dummy break case crossover uniform for int i 0 i individual1 length i if random next boolean int dummy individual1 i individual1 i individual2 i individual2 i dummy break default break
changes the individual
public void log string message get log log get name message log service status
logs a status message with the correct log service
public void perform selection list aggregation individual population list list aggregation individual ranks new array list list aggregation individual while population size 0 list aggregation individual rank get next rank population ranks add rank iterator aggregation individual i rank iterator while i has next population remove i next population clear int index 0 while index ranks size population size ranks get index size pop size population add all ranks get index index if population size pop size list aggregation individual rank ranks get index sort by crowding distance rank while population size pop size population add rank remove 0
performs non dominated sorting selection from nsga ii
public boolean perform operation int generation return generation plot generations 0
returns true if the current generation modulo the plot generations
protected example set based population operator get mutation population operator example set e set throws undefined parameter error double p mutation get parameter as double parameter p mutation return new example set based selection mutation p mutation get random 1 get parameter as int parameter max total number of attributes 1
returns an operator that performs the mutation
public void log note string message get log log get name message log service note
logs a note message with the correct log service
public void log warning string message get log log get name message log service warning
logs a warning message with the correct log service
public void operate example set based population pop throws exception list example set based individual new individuals new linked list example set based individual for int i 0 i pop get number of individuals i list example set based individual individuals operate pop get i new individuals add all individuals pop clear pop add all individuals new individuals
operates on all individuals removes the original individuals and adds
protected example set based population operator get crossover population operator example set example set throws undefined parameter error double p crossover get parameter as double parameter p crossover int crossover type get parameter as int parameter crossover type return new unbalanced crossover crossover type p crossover get random
returns an code unbalanced crossover code
protected void evaluate population population throws operator exception population evaluator evaluate population
evaluates all individuals in the population by applying the inner
protected example set based population operator get generating population operator example set example set return null
since the mutation of yagga also creates new attributes this method
protected example set based population operator get mutation population operator example set e set throws operator exception list feature generator generators get generators if generators size 0 log warning no feature generators specified for get name list attribute attributes new linked list attribute for attribute attribute e set get attributes attributes add attribute double p mutation get parameter as double parameter p mutation int max number of attributes get parameter as int parameter max total number of attributes return new generating mutation attributes p mutation max number of attributes generators get random
returns the generating mutation code population operator code
public example set based population create initial population example set es throws undefined parameter error example set based population population super create initial population es example set based population pop removed deselected new example set based population for int i 0 i population get number of individuals i pop removed deselected add new example set based individual population get i get example set create clean clone return pop removed deselected
creates a initial population
private boolean is maximum reached if check for maximal fitness performance vector pv population get best performance ever if pv null return false else if pv get main criterion get fitness double positive infinity return true else if pv get main criterion get max fitness pv get main criterion get fitness return true else return pv get main criterion get fitness maximal fitness else return false
this method checks if the maximum was reached for the main criterion
public void log error string message get log log get name message log service error
logs an error message with the correct log service
protected boolean get check for maximum return this check for maximal fitness
returns if the operator should check if the maximum was reached for the