input
stringlengths
10
828
output
stringlengths
5
107
public void set user description string description this user description description
sets the user specified comment for this operator
public string get user description return user description
the user specified comment for this operator
public void add example set based individual individual individuals add individual
adds a single individual
public void add all individuals collection example set based individual new individuals individuals add all new individuals
adds all individuals from the given collection
public void remove if parent null parent remove operator this process process get process if process null unregister operator process
removes this operator from its parent
public void remove example set based individual individual individuals remove individual
removes a single individual
public example set based individual get int i return individuals get i
returns a single individual
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 example set based individual attribute weighted example set current best get example set clone 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 example set based 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 population create initial population example set es throws undefined parameter error int direction get parameter as int parameter selection direction population init p new population if direction forward selection for int a 0 a es get attributes size a double weights new double es get attributes size weights a 1 0d init p add new individual weights else double weights new double es get attributes size for int a 0 a es get attributes size a weights a 1 0d init p add new individual weights return init p
may tt es tt have i n i features
public example set based individual get best individual ever return best ever
returns all generations best individual
public example set based individual get current best return current best
returns the last generations best individual
public boolean solution good enough population pop throws operator exception return pop empty generations woimp 0 pop get generations without improval generations woimp pop get generation max generations
returns true if the best individual is not better than the last
private void add all with exact number population pop double weights int start index int exact number of features individual individual new individual weights if individual get number of used attributes exact number of features return for int i start index i weights length i double clone individual get weights clone clone i 1 0d individual new individual new individual clone if new individual get number of used attributes exact number of features pop add new individual else add all with exact number pop clone i 1 exact number of features
add all attribute combinations with a fixed size to the population
protected void register operator process process if process null set name process register name get name this
registers this operator in the given process
protected void evaluate example set based population population throws operator exception for int i 0 i population get number of individuals i evaluate population get i
evaluates all individuals in the population by applying the inner
private double get correlation double samples double means double deviations int att1 int att2 calculate covariance double covariance 0 0d for int j 0 j samples length j covariance samples j att1 means att1 samples j att2 means att2 covariance covariance samples length 1 calculate correlation double correlation 0 0d correlation deviations att1 deviations att2 if correlation 0 0d correlation covariance else correlation covariance correlation return correlation
calculates the correlation between the two features
public double filter fitness double fitness return math exp fitness temperature
returns a fitness based on the boltzmann theorem i
public void operate population population super operate population this temperature delta
applies the method from the superclass and decreases the temperature in
protected performance vector evaluate example set based individual individual throws operator exception total evaluations if individual get performance null return individual get performance else evaluation counter attribute weighted example set clone individual get example set create clean clone ioobject operator chain input new ioobject clone iocontainer inner result get input prepend operator chain input for int i 0 i get number of operators i inner result get operator i apply inner result performance vector performance vector inner result remove performance vector class individual set performance performance vector return performance vector
evaluates the given individual
public population create initial population example set es throws undefined parameter error this generations woimp get parameter as int parameter generations without improval this max generations es get attributes size population init p new population double weights new double es get attributes size if max weight index 0 weights max weight index 1 0d else weights 0 1 0d init p add new individual weights return init p
returns an example set containing only the feature with the biggest
public double filter fitness double fitness return fitness
subclasses may override this method and recalculate the fitness based on
protected population operator get mutation population operator example set e set throws undefined parameter error double p mutation get parameter as double parameter p mutation int min number get parameter as int parameter min number of attributes int max number get parameter as int parameter max number of attributes int exact number get parameter as int parameter exact number of attributes return new selection mutation p mutation get random min number max number exact number
returns an operator that performs the mutation
protected void unregister operator process process process unregister name name
deletes this operator removing it from the name map of the process
public int get min number of inner operators return 1
returns 0 for the minimum number of innner operators
protected population operator get crossover population operator example set e 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 int min number get parameter as int parameter min number of attributes int max number get parameter as int parameter max number of attributes int exact number get parameter as int parameter exact number of attributes return new selection crossover crossover type p crossover get random min number max number exact number
returns an operator that performs crossover
public boolean solution good enough population pop return pop get generation max gen pop get generations without improval generations without improval
returns true if generation is maximum number of generations or after
private void calculate cumulative variance double sumvariance 0 0d for eigenvector ev this eigen vectors sumvariance ev get eigenvalue this variances new double this eigen vectors size this cumulative variance new double variances length double cumulative 0 0d int counter 0 for eigenvector ev this eigen vectors double proportion ev get eigenvalue sumvariance this variances counter proportion cumulative proportion this cumulative variance counter cumulative counter
calculates the cumulative variance
private void fill table example table table attribute attribute peak values throws operator exception data row reader reader table get data row reader int k 0 while reader has next data row data row reader next data row set attribute values k get magnitude check for stop
fills the table with the length of the given complex numbers in the
public void operate population pop throws exception list individual new individuals new linked list individual for int i 0 i pop get number of individuals i list 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
public int get number of sub nodes return 0
get the number of subnodes is always 0 since this node is leaf
public boolean is parallel return false
this method must return true if the operator performs parallel execution of
public input description get input description class cls if example set class is assignable from cls return new input description cls true true else return super get input description cls
indicates that the consumption of example sets can be user defined
public string get status return name apply count
returns human readable status information
public int get apply count return apply count
returns the number of times this operator was already applied
public string to string collection string dimension names string buffer buffer new string buffer int i 0 for string dim name dimension names buffer append dim name t buffer append tools format number centroid i tools get line separator i if i 100 break return buffer to string
this method only returns the first 100 attributes
public int get number of sub nodes return sub nodes size
get the number of subnodes
public double get b return examples get b
returns the value of b
public double get r return examples get r
returns the value of r
protected void exit optimizer qp null
exit the optimizer
protected input description get input description class input class return new input description input class
the default implementation returns an input description that consumes the
protected iodescription get iodescription return new default iodescription get desired input classes get delivered output classes
if you find the tt get input classes tt and
protected iodescription get iodescription class input classes get input classes boolean remove all true try remove all get parameter as int parameter deletion type delete all catch undefined parameter error e do nothing if input classes null input classes length 0 return new consumer iodescription input classes input classes 0 remove all else return super get iodescription
if you find the tt get input classes tt and
public performance vector write performance vector performance throws operator exception file performance file get parameter as file parameter performance file true output stream out null try out new file output stream performance file performance write out catch ioexception e throw new user error this e 303 new object performance file e get message finally if out null try out close catch ioexception e log error cannot close stream to file performance file return performance
writes the attribute set to a file
public void perform additional checks throws user error
this method is invoked during the validation checks
public int check deprecations string deprecation string get deprecation info int deprecation count 0 if deprecation string null add warning deprecation string deprecation count 1 return deprecation count
will count an the number of deprecated operators i
public attribute weights read throws operator exception file weight file get parameter as file parameter attribute weights file attribute weights result null try result attribute weights load weight file catch ioexception e throw new user error this e 302 new object weight file e get message return result
writes the attribute set to a file
public threshold write threshold threshold throws operator exception file threshold file get parameter as file parameter threshold file true print writer out null try out new print writer new output stream writer new file output stream threshold file get encoding out println xml version 1 0 encoding get encoding out println threshold version rapid miner get short version value threshold get threshold first threshold get zero class second threshold get one class out close catch ioexception e throw new user error this e 303 new object threshold file e get message finally if out null out close return threshold
writes the threshold to a file
public performance vector read throws operator exception file performance file get parameter as file parameter performance file performance vector performance null try input stream in new file input stream performance file performance performance vector abstract ioobject read in in close catch ioexception e throw new user error this e 303 new object performance file e get message return performance
writes the attribute set to a file
protected void logln int level string message param operator get log log message rapid miner verbosity level 1
log the output plus newline
public boolean get add only additional output return false
indicates how additional output should be added to the iocontainer
public result set get result set throws operator exception result set rs null try database handler get connected database handler string query get query log executing query query this statement database handler create statement false rs this statement execute query query log query executed catch sqlexception sqle throw new user error this sqle 304 sqle get message return rs
this method reads the file whose name is given extracts the database
public void predict svmexamples to predict int i double prediction svmexample s vmexample int size to predict count examples for i 0 i size i s vmexample to predict get example i prediction predict s vmexample to predict set y i prediction logln 4 prediction generated
predict values on the testset with model
public attribute weights write attribute weights weights throws operator exception file weight file get parameter as file parameter attribute weights file true try weights write attribute weights weight file get encoding catch ioexception e throw new user error this e 303 new object weight file e get message return weights
writes the attribute set to a file
public double predict svmexample s vmexample int i int sv index double sv att double the sum examples get b kernel calculate k s vmexample s vmexample double alpha for i 0 i examples total i alpha alphas i if alpha 0 sv index examples index i sv att examples atts i the sum 2 alpha kernel calculate k sv index sv att s vmexample index s vmexample att if the sum 0 numerical error the sum 0 return math sqrt the sum
predict a single example
protected boolean has input class extends ioobject cls return input container contains cls
returns true if this operator has an input object of the desired class
protected void set input iocontainer input if input null throw new illegal argument exception input is null this input container input
attention use this method only if you are absolutely sure what you are
private stream tokenizer create tokenizer reader in stream tokenizer tokenizer new stream tokenizer in tokenizer reset syntax tokenizer whitespace chars 0 tokenizer word chars 1 u00 ff tokenizer whitespace chars tokenizer comment char tokenizer quote char tokenizer quote char tokenizer ordinary char tokenizer ordinary char tokenizer eol is significant true return tokenizer
creates a stream tokenizer for reading arff files
protected int read input stream input stream byte buffer int length throws ioexception final int offset 0 return read input stream buffer offset length
reads a number specified by length of bytes from a given
protected int read input stream input stream byte buffer int offset int length throws ioexception int read length input stream read buffer offset length if read length length throw new ioexception wrong byte length return read length
reads a number specified by length of bytes from a given
protected int read without length check input stream input stream byte buffer int length throws ioexception return input stream read buffer 0 length
reads a number specified by length of bytes from a given
protected int read input stream input stream byte buffer char divider throws ioexception int index 0 do byte read byte byte 0x000000 ff input stream read if read byte 1 read byte byte divider return index buffer index read byte index while index buffer length return index
reads bytes from a given file reader until either a certain
protected int read input stream input stream byte buffer char divider throws ioexception int index 0 int divider index 0 do byte read byte byte 0x000000 ff input stream read if read byte 1 return index if read byte divider divider index divider index if divider index divider length index divider index 1 for int i index i index divider index i if i buffer length break buffer i 0 return index buffer index read byte index while index buffer length return index
reads bytes from a given file reader until either a specified
protected int extract2 byte int byte buffer int offset boolean reverse endian int r 0 if reverse endian r buffer offset 1 8 0x000000 ff buffer offset else r buffer offset 8 0x000000 ff buffer offset 1 return r
extracts a 2 byte short int from a byte array
public void process starts throws operator exception apply count 0
called when the process starts
protected int extract int byte buffer int offset boolean reverse endian int r 0 if reverse endian for int i offset 3 i offset i r r 8 r 0x000000 ff buffer i else for int i offset i offset 4 i r r 8 r 0x000000 ff buffer i return r
extracts an int from a byte array
protected float extract float byte value int offset boolean reverse endian int bits 0 if reverse endian for int i offset 3 i offset i bits bits 8 bits 0x000000 ff value i else for int i offset i offset 4 i bits bits 8 bits 0x000000 ff value i return java lang float int bits to float bits
extracts a float from a byte array
protected double extract double byte value int offset boolean reverse endian long bits 0 if reverse endian for int i offset 7 i offset i bits bits 8 bits 0x000000 ff value i else for int i offset i offset 8 i bits bits 8 bits 0x000000 ff value i return java lang double long bits to double bits
extracts a double from a byte array
protected string extract string byte value int offset int length todo shevek suggests this use a charset for safety return new string value offset length trim
extracts string from byte array
public void process finished throws operator exception
called at the end of the process
public performance vector get performance return performance
returns the performance of this parameter set
public void apply all process process map string string name map iterator i parameter values iterator while i has next parameter value i next apply process name map
applies all parameters in the set to their operators
public inner operator condition get inner operator condition return new all inner operator condition new class example set class new class 0
all inner operators must be able to handle an example set
protected performance vector get performance iocontainer input collection operator operators try for operator operator operators input operator apply input return input remove performance vector class catch operator exception e log warning cannot evaluate performance for current parameter combination e get message return null
applies the given operators and employs the performance evaluator for
public void set breakpoint int position boolean on break point position on
sets or clears a breakpoint at the given position
protected performance vector get performance iocontainer result container get input try for int i 0 i get number of operators i result container get operator i apply result container return result container remove performance vector class catch operator exception e log warning cannot evaluate performance for current parameter combination e get message return null
applies the inner operator and employs the performance evaluator for
public int get max number of inner operators return 1
returns the maximum number of innner operators
public inner operator condition get inner operator condition try int operator index 0 try operator index get parameter as int parameter select which catch number format exception e do nothing if operator index 1 operator index get number of operators return new all inner operator condition new class 0 new class 0 else operator operator get operator operator index 1 return new all inner operator condition operator get input classes operator get output classes catch undefined parameter error e return new all inner operator condition new class 0 new class 0
returns a simple chain condition
public inner operator condition get inner operator condition boolean keep output get parameter as boolean parameter keep output return new simple chain inner operator condition keep output
returns a simple chain condition
public boolean has breakpoint return has breakpoint breakpoint listener breakpoint before has breakpoint breakpoint listener breakpoint within has breakpoint breakpoint listener breakpoint after
returns true iff this operator has a breakpoint at any possible position
private operator get learner return get operator 0
returns the first encapsulated inner operator or operator chain i
private void apply on all in range example set example set attribute all attributes int min number of features int max number of features throws operator exception for int i min number of features i max number of features i apply on all with exact number example set all attributes i
recursive method to add all attribute combinations to the population
private operator get applier return get operator 1
returns the second encapsulated inner operator or operator chain i
private iocontainer apply inner loop 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 boolean has breakpoint int position return break point position
returns true iff a breakpoint is set at the given position
public boolean check process branch operator string value throws operator exception if value null throw new user error operator 205 process branch parameter condition value file file new file value return file exists
this method checks if the file with pathname value exists
public boolean check process branch operator string value throws operator exception if value null throw new user error operator 205 process branch parameter condition value double min fitness double negative infinity try min fitness double parse double value catch number format exception e throw new user error operator 207 new object value process branch parameter condition value e performance vector performance operator get condition input performance vector class return performance get main criterion get fitness min fitness
this method checks if the file with pathname value exists
public boolean check process branch operator string value throws operator exception if value null throw new user error operator 205 process branch parameter condition value double min value double negative infinity try min value double parse double value catch number format exception e throw new user error operator 207 new object value process branch parameter condition value e performance vector performance operator get condition input performance vector class return performance get main criterion get average min value
this method checks if the file with pathname value exists
public boolean check process branch operator string value throws operator exception class ioobject clazz operator get selected class if clazz null try operator get condition input clazz return true catch missing ioobject exception e do nothing return false
this method checks if the file with pathname value exists
public boolean check process branch operator string value throws operator exception if value null throw new user error operator 205 process branch parameter condition value double max value double negative infinity try max value double parse double value catch number format exception e throw new user error operator 207 new object value process branch parameter condition value e performance vector performance operator get condition input performance vector class return performance get main criterion get average max value
this method checks if the file with pathname value exists
public boolean check process branch operator string value throws operator exception if value null throw new user error operator 205 process branch parameter condition value double max fitness double positive infinity try max fitness double parse double value catch number format exception e throw new user error operator 207 new object value process branch parameter condition value e performance vector performance operator get condition input performance vector class return performance get main criterion get fitness max fitness
this method checks if the file with pathname value exists
public inner operator condition get inner operator condition try string operator name get parameter as string parameter operator name if operator name null operator operator get process get operator operator name if operator null operator set enabled get parameter as boolean parameter enable catch undefined parameter error e does nothing if parameter were not yet defined return new simple chain inner operator condition
returns a simple chain condition
protected esoptimization create optimizer random generator random throws undefined parameter error return new esparameter optimization this operators length esoptimization init type random get parameter as int parameter max generations get parameter as int parameter generations without improval get parameter as int parameter population size get parameter as int parameter selection type get parameter as double parameter tournament fraction get parameter as boolean parameter keep best get parameter as int parameter mutation type get parameter as double parameter crossover prob get parameter as boolean parameter show convergence plot random this
this method creates a apropriate optimizer
public void set distance double dist this distance dist
sets the distance of the container to dist double type value
public int get number of objects return this number of objects
gives the number of objects in the container e
private void set number of objects int number this number of objects number
sets the number of objects in the container to integer number
public int get dimensions return this dimensions
provides the integer number of dimensions of the object
public void add value value value value map put value get key value
adds an implementation of value
public int get number of objects return this list of objects size
returns the integer number of objects in the searchroom associated with it via
public void set dimensions int dim this dimensions dim
p sets the number of dimensions for the search space to dim