input
stringlengths
10
828
output
stringlengths
5
107
public void set covered weight double value this covered weight value
sets the covered weight of this hypothesis
public boolean applicable example example if this hypothesis applicable example return true else return false
returns true if the model is applicable to the current example
public double get positive weight return this positive weight
returns the covered positive weight of this hypothesis
public int get complexity return this literals length
returns the lenght of the premise of the rule
public void set positive weight double value this positive weight value
sets the covered positive weight of this hypothesis
public string to string string buffer result new string buffer super to string result append tools get line separator result append this hypothesis return result to string
returns a string representation of the hypothesis stored in this model
public hypothesis get hypothesis return this hypothesis
returns the hypothesis stored in this model
public string to string string buffer result new string buffer if for int i 0 i literals length 1 i result append literals i to string and result append literals literals length 1 to string result append then get label get name get label get mapping map index this get prediction return result to string
returns a string representation of the rule
public component get visualization component iocontainer container return new association rule table viewer this
returns the visualization component
public void add frequent set frequent item set item set frequent sets add item set maximum set size math max item set get number of items maximum set size
adds a frequent item set to this container
public string to string return to string max number of itemsets
this method generates the a string representation of this object
public string to string int max number string buffer output new string buffer frequent item sets size tools get line separator if frequent sets size 0 output append no itemsets found else int counter 0 for frequent item set set frequent sets counter if max number 0 counter max number output append size max number additional item sets break else output append set get items as string output append output append tools format number double set get frequency double number of transactions output append tools get line separator return output to string
this method generates the a string representation of this object
public component get visualization component iocontainer container return new frequent item set visualization this
returns the visualization component
public void add item set collection item item set int weight super add item set item set header table weight
this method adds a set of items to the tree
public input description get input description class cls if frequent item sets class is assignable from cls return new input description cls false true else return super get input description cls
indicates that the consumption of frequent item sets can be user defined
private void remove non boolean attributes example set example set removing non boolean attributes collection attribute delete attributes new array list attribute for attribute attribute example set get attributes if attribute is nominal attribute get mapping size 2 delete attributes add attribute for attribute attribute delete attributes example set get attributes remove attribute
removes every non boolean attribute
public fptree node get father return father
returns the father of this node or null if node is root
private void get item frequency example set example set attribute attributes double positive indices map attribute item mapping iterate over example set counting item frequency for example current example example set int i 0 for attribute attribute attributes if attribute is boolean and if attribute is the positive one increase frequency of item if current example get value attribute positive indices i mapping get attribute increase frequency i
this method scans the example set and counts the frequency of every item
public boolean has father return this father null
returns true if node has father
public int compare to frequent item set o compare size collection item his items o get items if items size his items size return 1 else if items size his items size return 1 else compare items iterator item iterator his items iterator for item my current item this items int relation my current item compare to iterator next if relation 0 return relation equal sets return 0
this method compares frequent item sets
public fptree node get sibling return sibling
returns the next node representing the same item as this node
public string get items as string string buffer buffer new string buffer iterator item iterator items iterator while iterator has next buffer append iterator next to string if iterator has next buffer append return buffer to string
this method returns a representation of the items
public string to string string buffer buffer new string buffer iterator item iterator items iterator while iterator has next buffer append iterator next to string if iterator has next buffer append buffer append frequency buffer append tools format number frequency return buffer to string
this method should return a proper string representation of this frequent item set
private fptree get fptree example set example set attribute attributes double positive indices map attribute item mapping fptree tree new fptree for example current example example set list item item set new array list item int i 0 for attribute current attribute attributes if current example get value current attribute positive indices i item set add mapping get current attribute i collections sort item set tree add item set item set 1 return tree
returns a new fptree representing the complete example set
public example set perform prediction example set example set attribute predicted label attribute throws operator exception attribute label get label iterator example r example set iterator while r has next example example r next example set value predicted label attribute value if label is nominal for int i 0 i confidences length i example set confidence predicted label attribute get mapping map index i confidences i return example set
iterates over all examples and applies the model to them
public void pop frequency int height frequencies pop frequency height
this method clears the frequency stack on top
public int get frequency int height return frequencies get frequency height
this returns the frequency of the node in current recursion
public item get node item return this node item
this returns the item this node represents
public model get model int index return this models get index
getter method for embedded models
protected model apply inner learner example set example set throws operator exception iocontainer input new iocontainer new ioobject example set for int i 0 i get number of operators i input get operator i apply input return input remove model class
this is a convenience method to apply the inner operators and return the
public fptree node get child if children size 1 return null else return children get children key set iterator next
this method returns the first child
public fptree node create child node item node item return new fptree node this node item
this method creates a new childnode of this node representing the node item
public boolean supports capability learner capability capability if get number of operators 0 return false if capability learner capability polynominal class return true if capability learner capability binominal class return true return super supports capability capability
support polynominal labels
public boolean supports capability learner capability capability if get number of operators 0 return false for int i 0 i get number of operators i if get operator i instanceof learner return learner get operator i supports capability capability return false
for all meta learners it checks for the underlying operator to see which
public double get cost value int i int j return cost matrix i j
returns a single value from the cost matrix
public double get probability int label int prediction return this pred label prediction label
method to query for the probability of one of the prediction label
private model train model example set example set throws operator exception iocontainer result get operator 0 apply new iocontainer new ioobject example set model model result remove model class return model
runs the quot embedded quot learner on the example set and retuns a
public double get probability label int label return this labels label
method to query for the quot prior quot probability of one of the
public double get probability prediction int premise return this predictions premise
method to query for the quot prior quot probability of one of the
public double get lift int label int prediction double pr label this get probability label label double pr pred this get probability prediction prediction double pr joint this get probability label prediction if pr pred 0 return rule does not apply else if pr joint 0 return 0 else if tools is equal pr joint pr pred return double positive infinity double lift pr joint pr label pr pred return lift
the lift of the rule specified by the nominal variables indices
public void set parameter string name string value throws operator exception if name equals ignore case max model number try this max model number integer parse int value return catch number format exception e else if name equals ignore case conv to crisp this threshold double parse double value trim return super set parameter name value
setting the parameter code max model number code allows to discard
public void set max model number int num models this max model number num models
using this setter with a positive value makes the model discard all
public boolean supports capability learner capability lc if lc learner capability numerical class return false if lc learner capability weighted examples return true return super supports capability lc
overrides the method of the super class
public boolean supports capability learner capability lc if lc learner capability numerical class return false else return super supports capability lc
overrides the method of the super class
private void read optional parameters try this start model get input model class catch missing ioobject exception e log get name no model found in input
helper method reading a start model from the input if present
private boolean is model useful ada boost performance measures wp return wp get error rate 0 5
helper method to decide whether a model improves the training error
private void apply prior model example set training set list bay boost base model info model info throws operator exception if the input contains a model already initialise the example weights if this start model null example set result set this start model apply example set training set clone initial values and the input model are stored in the output model weighted performance measures wp new weighted performance measures result set this reweight examples wp result set model info add new bay boost base model info this start model wp get contingency matrix prediction model remove predicted label result set
helper method applying the start model and adding it to the model info
private double get prior of class int class index return this priors class index
getter method for prior class probabilities estimated as the relative
public model get model int index return this model info get index get model
getter method for embedded models
private boolean is model useful contingency matrix cm should rather be decided offline by properly setting the number of iterations return true
helper method to decide whether a model improves the training error
public model get model int index object obj object this model info get index return model obj 0
getter method for embedded models
public contingency matrix get contingency matrix int index return this model info get index get contingency matrix
getter method for a specific confusion matrix
protected attribute create predicted label example set example set attribute predicted label super create predicted label example set get label return example set get attributes replace predicted label attribute factory change value type predicted label ontology real
creates a predicted label with the given name
public void set parameter string name string value throws operator exception if name equals ignore case max model number try this max model number integer parse int value return catch number format exception e super set parameter name value
setting the parameter code max model number code allows to discard
private void rescale priors example set example set double class priors the weights of class i are calculated as 1 classes rel freq class i double weights new double 2 for int i 0 i weights length i weights i 1 0d weights length class priors i iterator example ex read example set iterator while ex read has next example example ex read next example set weight weights int example get label
computes the weighted class priors of the boolean target attribute and
private void clean up special attributes example set example set attribute special attributes throws operator exception for int i 0 i special attributes length i example set get attributes remove special attributes i example set get example table remove attribute special attributes i
removes the provided special labels from the example set and example table
private model train base model example set example set throws operator exception model model apply inner learner example set create or replace predicted label for example set model return model
runs the quot embedded quot learner on the example set and retuns a
private double evaluate predictions example set example set iterator example reader example set iterator int count 0 int correct 0 while reader has next count example example reader next if example get label example get predicted label correct return double correct count
returns the accuracy of the predictions for the given example set
public split preprocessing get split preprocessing split preprocessing preprocessing null try preprocessing new random subset preprocessing get parameter as double parameter subset ratio random generator get random generator get parameter as int parameter local random seed catch undefined parameter error e cannot happen return preprocessing
returns a random feature subset sampling
public split preprocessing get split preprocessing return null
the split preprocessing is applied before each new split
private boolean is model useful contingency matrix cm for int row 0 row cm get number of predictions row for int col 0 col cm get number of classes col if math abs cm get lift row col 1 min advantage return true return false
helper method to decide whether a model improves the training error
protected benefit calculate benefit example set training set attribute attribute throws operator exception operator weight op null try weight op operator service create operator chi squared weighting class catch operator creation exception e log warning cannot create chi squared calculation operator double weight double na n if weight op null iocontainer output weight op apply new iocontainer training set attribute weights weights output remove attribute weights class weight weights get weight attribute get name if double is na n weight return new benefit weight attribute else return null
this method calculates the benefit of the given attribute
public example set perform prediction example set example set attribute predicted label throws operator exception iterator example r example set iterator while r has next example example r next example set value predicted label predict example return example set
iterates over all examples and applies the model to them
public object clone return new rule this
performs only a shallow clone on the conditions which are not mutable
public string to string string buffer buffer new string buffer if terms size 0 buffer append if boolean first term true for split condition condition terms if first term buffer append and buffer append condition to string first term false buffer append then else buffer append else buffer append label name if frequencies null buffer append for int i 0 i frequencies length i if i 0 buffer append buffer append frequencies i buffer append return buffer to string
this method returns a string representation of this rule
public void add term split condition condition terms add condition
this method adds a condition to the conjunction in the rules head
private double flip label double non predicted label return 1 0d non predicted label
works only for boolean labels and needs to be improved in case of
protected int get first unused attribute example set example set attribute all attributes int num attributes all attributes length int first unused attribute num attributes for int i num attributes 1 i 0 i attribute example set attribute all attributes i if this get position of attribute in rule example set attribute 1 return first unused attribute else first unused attribute i return first unused attribute
helper method of code get all refined rules code
private void add rules to open nodes collection rules double score upper bound if score upper bound this get pruning score return iterator it rules iterator while it has next this open nodes add new rule with score upper bound conjunctive rule model it next score upper bound
annotates the collection of conjunctive rule models with an optimistic
protected example set perform preprocessing example set e set throws operator exception try operator discretization operator operator service create operator bin discretization class discretization operator set parameter bin discretization parameter number of bins get parameter as int bin discretization parameter number of bins discretization operator set parameter bin discretization parameter create view true return discretization operator apply new iocontainer example set e set clone get example set class catch operator creation exception e should not happen throw new operator exception get name cannot create discretization operator e
this preprocessing discretizes the input example set by a view
protected example set perform preprocessing example set example set throws operator exception return example set
this default implementation does nothing
public input description get input description class cls if text object class is assignable from cls return new input description cls false true else return super get input description cls
indicates that the consumption of example sets can be user defined
protected object read resolve init actions return this
used for deserialization of the transient actions list
public string get name return tools class name wopackage this get class
the default implementation returns the classname without package
public void save final file file throws ioexception file output stream fos null try fos new file output stream file write fos finally if fos null fos close
saves the object into the given file by using the
public string to result string return to string
the default implementation simply returns the result of the method
public component get visualization component iocontainer container string str to html to result string jeditor pane result text new jeditor pane result text set content type text html result text set text html h1 get name h1 pre str pre html result text set border javax swing border factory create empty border 11 11 11 11 result text set editable false result text set background new jlabel get background return new extended jscroll pane result text
returns a editor pane that displays the
public void log string message get log log get name message
logs a status message with the correct log service
public void log note string message get log log note get name message
logs a note message with the correct log service
public void log warning string message get log log warning get name message
logs a warning message with the correct log service
public void log error string message get log log error get name message
logs an error message with the correct log service
public color get point color double value return get point color value 255
returns a color for the given value
public double get min double min math min lower whisker mean standard deviation for int i 0 i outliers length i min math min min outliers i return min
returns the smallest value occupied by this quartile
public double get max double max math max upper whisker mean standard deviation for int i 0 i outliers length i max math max max outliers i return max
returns the biggest value occupied by this quartile
private double sin double angle while angle 180 0d angle 180 0d double value angle 180 0d math pi return math sin value
gets the sinus of the angle
protected static class ellipsoid point style implements point style public shape create shape double x double y return new ellipse2 d double x pointsize 2 0d y pointsize 2 0d pointsize pointsize
the point style that should be used for plotting points
public jcomponent get options component int index if index 0 removes the icon for dataview in the toolbar while this plotpanel plot tool bar get component count get number of option icons this plotpanel plot tool bar remove this plotpanel plot tool bar get component count 1 return this plotpanel plot tool bar else return null
removes the data view button and adds the legend under the plotter panel
public double transform double value if value 0 0d throw new illegal argument exception cannot apply log scaling to a value less than or equal to zero return math log10 value
transforms the given value by applying a log function
public void calculate angles float total angle 360 0f float delta total angle values size float angle 0 0f angles new double values size for int i 0 i angles length i angles i angle angle delta
calculates the angles
public double inverse transform double value return math pow 10 value
transforms the given value by applying an exponential function
public string format double value int format number if format number 2 0 return format format value else return null
returns the formatted value
public double adapt tics min double min double tic size return min
adapts the minimum corresponding to the given tic size
public double adapt tics max double max double tic size return max
adapts the maximum corresponding to the given tic size
private double sin double angle while angle 180 0f angle 180 0 double value angle 180 0f math pi return math sin value
gets the sinus of the angle
public void set jitter int jitter this jitter amount jitter repaint
sets the level of jitter and initiates a repaint
protected void clear plot columns for int i 0 i columns length i columns i false
disables all plotting but does not invoke repaint
public void force plot generation
this default implementation does nothing
public void set draw range double draw min x double draw max x double draw min y double draw max y if draw min x 1 draw max x 1 draw min y 1 draw max y 1 this draw min x double negative infinity this draw max x double positive infinity this draw min y double negative infinity this draw max y double positive infinity else this draw min x draw min x this draw max x draw max x this draw min y draw min y this draw max y draw max y repaint
sets the draw range in data space
public void stop updates boolean value this stop updates value
indicates if the plotter is currently under a process of value adjustments
public double transform double value return value
transforms the given value by just returning it