input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public void clear error list error list clear
|
clears the list of errors
|
protected double inner product double x double y double sum 0 for int i 0 i x length i sum x i y i return sum
|
return the inner product of x and y x
|
public double get c return c
|
gets the complexity constant of the svm
|
protected void prune linked list integer basis set create phit double phi t array new double basis set size for int j 0 j basis set size j phi t array j phi basis set get j phi t new matrix phi t array create diagonal matrix a a new matrix basis set size basis set size for int j 0 j basis set size j a set j j alpha basis set get j
|
create pruned versions of all important matrices vectors so that
|
protected void update sigma matrix sigma inv phi t times phi t transpose sigma inv times equals beta sigma inv plus equals a update the factor secholesky decomposition cd new secholesky decomposition sigma inv get array matrix u cd get ptr times cd get l sigma chol u inverse update sigma sigma sigma chol transpose times sigma chol
|
update the covariance matrix of the weight posterior distribution sigma
|
public void set alpha int pos double alpha alphas pos alpha
|
sets an alpha value
|
protected void reestimate alpha int selected basis alpha selected basis s s q q s
|
reestimate alpha by setting it to the value which maximizes the
|
protected void include basis int selected basis basis set add integer value of selected basis reestimate alpha selected basis
|
include a basis function into the model
|
protected void delete basis int selected basis basis set remove integer value of selected basis alpha selected basis 1 0d
|
delete a basis function from the model
|
public string to string return constructive regression rvm
|
identify the rvm
|
public string to string return regression rvm
|
identify the rvm
|
protected void project to constraint project alphas to match the constraint double alpha sum sum alpha int svcount 0 double alpha int i for i 0 i examples total i alpha alphas i alpha sum alpha if alpha is zero alpha c neg i is zero alpha is zero alpha c pos i is zero svcount if svcount 0 project alpha sum svcount for i 0 i examples total i alpha alphas i if alpha is zero alpha c neg i is zero alpha is zero alpha c pos i is zero alphas i alpha sum
|
project variables to constraints
|
public void add warning string message log warning this get name message error list add message
|
adds a warning message to the error list
|
public double sigmoid double x return 1 0 1 0 math exp x
|
sigmoid link function
|
public string to string return classification rvm
|
identify the rvm
|
public performance vector get estimated performance throws operator exception if pattern throw new user error this 912 this cannot calculate leave one out estimation of error for regression tasks double est vector svmpattern get svm get xi alpha estimation get kernel performance vector pv new performance vector pv add criterion new estimated performance xialpha error est vector 0 1 true pv add criterion new estimated performance xialpha precision est vector 1 1 false pv add criterion new estimated performance xialpha recall est vector 2 1 false pv set main criterion name xialpha error return pv
|
returns the estimated performances of this svm
|
protected kernel get kernel return kernel
|
returns the kernel of this svm
|
protected svminterface get svm return svm
|
returns the used svm
|
public boolean should deliver optimization performance return get parameter as boolean parameter return optimization performance
|
returns the value of the corresponding parameter
|
protected void init working set calculate sum int i j project to constraint skip kernel calculation as all alphas 0 for i 0 i examples total i sum i 0 at bound i 0 first working set is random j 0 i 0 while i working set size j examples total working set i j if is alpha neg j which alpha i true else which alpha i false i j update working set
|
initialises the working set
|
public performance vector get optimization performance double final fitness get fitness svm examples get alphas svm examples get ys kernel performance vector result new performance vector result add criterion new estimated performance svm objective function final fitness 1 false result add criterion new estimated performance no support vectors svm examples get number of support vectors 1 true return result
|
returns the optimization performance of the best result
|
public boolean should calculate weights return get parameter as boolean parameter calculate weights
|
returns true if the user has specified that weights should be calculated
|
public attribute weights get weights example set example set throws operator exception if get parameter as int parameter kernel type kernel dot throw new user error this 916 this cannot create weights for nonlinear kernel double weights svm get weights attribute weights weight vector new attribute weights int i 0 for attribute attribute example set get attributes weight vector set weight attribute get name weights i return weight vector
|
returns the weights for all features
|
public performance vector get optimization performance return optimization get optimization performance
|
returns the optimization performance of the best result
|
public boolean supports capability learner capability lc if lc learner capability numerical attributes return true if lc learner capability binominal class return true if lc learner capability numerical class return true if lc learner capability weighted examples return true if lc learner capability formula provider return true return false
|
returns true for numerical attributes binominal classes and numerical
|
public performance vector evaluate individual double individual double fitness optimization function get fitness individual ys kernel 0 performance vector result new performance vector result add criterion new estimated performance svmopt value fitness 1 false return result
|
evaluates the individuals of the given population
|
protected void logln int level string message if param operator null param operator get log log message rapid miner verbosity level 1 else log service get global log message rapid miner verbosity level 1
|
log the output plus newline
|
public boolean supports capability learner capability lc if lc learner capability numerical attributes return true if lc learner capability binominal class return true if lc learner capability formula provider return true return false
|
returns true for numerical attributes binominal classes and numerical
|
public evo svmmodel train throws operator exception optimize return get model get best values ever
|
trains the svm
|
public performance vector get optimization performance double best values ever get best values ever double final fitness optimization function get fitness best values ever ys kernel performance vector result new performance vector result add criterion new estimated performance svm objective function final fitness 0 1 false result add criterion new estimated performance no support vectors 1 final fitness 1 1 true return result
|
delivers the fitness of the best individual as performance vector
|
public performance vector get optimization performance double best values ever get best values ever double final fitness optimization function get fitness best values ever ys kernel performance vector result new performance vector if final fitness length 1 result add criterion new estimated performance svm objective function final fitness 0 1 false else result add criterion new estimated performance alpha sum final fitness 0 1 false result add criterion new estimated performance svm objective function final fitness 1 1 false if final fitness length 3 result add criterion new estimated performance alpha label sum final fitness 2 1 false return result
|
delivers the fitness of the best individual as performance vector
|
public string to string string type null if get operator description null type get operator class name else type get class get name return break point 0 break point 1 name type
|
returns the name
|
public void predict svmexamples to predict int i double prediction svmexample s vmexample int size the examples count examples im 04 02 12 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 double predict svmexample s vmexample int i int sv index double sv att double the sum the examples get b double alpha for i 0 i examples total i alpha alphas i if alpha 0 sv index the examples index i sv att the examples atts i the sum alpha the kernel calculate k sv index sv att s vmexample index s vmexample att return the sum
|
predict a single example
|
public string create process tree int indent return create process tree indent null null
|
returns this operators name and class
|
public string to string return gauss regression gp
|
identify the gp
|
public model learn example set example set throws operator exception attribute label example set get attributes get label if label is nominal if label get mapping size 2 throw new user error this 114 get name label get name init neural net example set train example set return new neural net model example set neural net example set get attributes size this min label this max label
|
learns and returns a model
|
public boolean supports capability learner capability lc if lc learner capability numerical attributes return true if lc learner capability polynominal class return true if lc learner capability binominal class return true if lc learner capability numerical class return true if lc learner capability weighted examples return true return false
|
returns true for all types of attributes and numerical and binominal labels
|
public boolean supports capability learner capability lc if lc learner capability polynominal attributes return true if lc learner capability binominal attributes return true if lc learner capability numerical attributes return true if lc learner capability binominal class return true if lc learner capability numerical class return true return false
|
returns true for all types of attributes and numerical and binominal labels
|
public string create marked process tree int indent string mark operator mark operator return create process tree indent mark operator mark
|
returns this operators name and class
|
public boolean supports capability learner capability lc if lc learner capability numerical attributes return true if lc learner capability binominal class return true if lc learner capability numerical class return true return false
|
returns true for all types of attributes and numerical and binominal labels
|
protected boolean connect input node i int n if super connect input i n return false double new weights new double weights length 1 system arraycopy weights 0 new weights 0 weights length new weights new weights length 1 this random generator next double 0 1d 0 05d weights new weights double new weight changes new double weight changes length 1 system arraycopy weight changes 0 new weight changes 0 weight changes length new weight changes new weight changes length 1 0 weight changes new weight changes return true
|
overwrites the super method and also adds weight handling
|
public model learn example set example set throws operator exception parameter params get parameters example set if example set size 2 throw new user error this 110 2 linear reset random linear disable debug output problem problem get problem example set liblinear model model linear train problem params return new fast margin model example set model get parameter as boolean parameter use bias
|
learns a new svm model with the lib svm package
|
protected string create process tree int indent string self prefix string child prefix operator mark operator string mark if mark operator null get name equals mark operator get name return indent indent mark length mark self prefix get name apply count get operator class name else return indent indent self prefix get name apply count get operator class name
|
returns this operators name and class
|
private boolean deselect attribute with highest coefficient boolean selected attributes double coefficients double standard deviations double class standard deviation throws undefined parameter error double min coefficient get parameter as double parameter min standardized coefficient int attribute2 deselect 1 int coefficient index 0 for int i 0 i selected attributes length i if selected attributes i double standardized coefficient math abs coefficients coefficient index standard deviations i class standard deviation if standardized coefficient min coefficient min coefficient standardized coefficient attribute2 deselect i coefficient index if attribute2 deselect 0 selected attributes attribute2 deselect false return true return false
|
this method removes the attribute with the highest standardized coefficient
|
private double get squared error example set example set boolean selected attributes double coefficients boolean use intercept double error 0 iterator example i example set iterator while i has next example example i next double prediction regression prediction example selected attributes coefficients use intercept double diff prediction example get label error diff diff return error
|
calculates the squared error of a regression model on the training data
|
private double regression prediction example example boolean selected attributes double coefficients boolean use intercept double prediction 0 int index 0 int counter 0 for attribute attribute example get attributes if selected attributes counter prediction coefficients index example get value attribute index if use intercept prediction coefficients index return prediction
|
calculates the prediction for the given example
|
public double confidence intervall double total weight double total positive weight hypothesis hypo double delta if total weight large return conf small m total weight delta else return conf total weight total positive weight hypo delta
|
calculates the the confidence intervall for a specific hypothesis
|
public squared double priors int large super priors large
|
constructs a new squared with the given default probability
|
public abstract utility double priors int large this priors new double priors length system arraycopy priors 0 this priors 0 2 this large large
|
constructor for all utilities
|
public double utility double total weight double total positive weight hypothesis hypo double g hypo get covered weight total weight double p hypo get positive weight hypo get covered weight if hypo get prediction hypothesis positive class return g g p this priors hypothesis positive class else return g g p this priors hypothesis negative class
|
calculates the utility for the given number of examples positive examples and hypothesis
|
public double conf double total weight double delta return inverse normal 1 delta 2 2 math sqrt total weight
|
calculate confidence intervall without a specific rule for instance averaging functions
|
public double calculate m double delta double epsilon double i 1 perfomance start with step 10000 while conf i delta epsilon 2 0d i i 10000 if i 1 i i 10000 has been executed at least once i i 10000 while conf i delta epsilon 2 0d i return math ceil i
|
calculates the m value needed for the gss algorithm
|
public double conf double total weight double delta double inverse normal inverse normal 1 delta 2 return 3 0d 2 0d math sqrt total weight inverse normal total weight math sqrt total weight 4 0d total weight math sqrt total weight math pow inverse normal 2 0d math pow inverse normal 3 0d 8 0d total weight math sqrt total weight
|
calculate confidence intervall without a specific rule
|
public double conf double total weight double total positive weight hypothesis hypo double delta return inverse normal 1 delta 2 variance total weight total positive weight hypo
|
calculate confidence intervall for a specific rule for instance averaging functions
|
public double confidence intervall double total weight double delta if total weight large return conf small m total weight delta else return conf total weight delta
|
calculates the the unspecific confidence intervall
|
private double variance double p double total weight return p 1 p total weight
|
calculates the variance for a binomial distribution
|
private string indent int indent string buffer s new string buffer for int i 0 i indent i s append return s to string
|
returns a whitespace with length indent
|
public double confidence intervall double total weight double total positive weight hypothesis hypo double delta if hypo get covered weight large return conf small m total weight delta else return conf total weight total positive weight hypo delta
|
calculates the the confidence intervall for a specific hypothesis
|
public double conf small m double total weight double delta double term math log 4 0d delta 2 0d total weight return math pow term 1 5d 3 0d term 3 0d math sqrt term
|
calculate confidence intervall without a specific rule for small m
|
public linear double priors int large super priors large
|
constructs a new linear with the given default probability
|
public double get upper bound double total weight double total positive weight hypothesis hypo double delta double p0 if hypo get prediction hypothesis positive class p0 this priors hypothesis positive class else p0 this priors hypothesis negative class utility cov new coverage this priors this large hypothesis h hypo clone h set covered weight hypo get positive weight all fp become tn double g cov utility total weight total positive weight h double conf cov confidence intervall total weight delta return g conf g conf 1 0d p0
|
returns an upper bound for the utility of refinements for the given hypothesis
|
public double utility double total weight double total positive weight hypothesis hypo double g hypo get covered weight total weight double p hypo get positive weight hypo get covered weight if hypo get prediction hypothesis positive class return g p this priors hypothesis positive class else return g p this priors hypothesis negative class
|
calculates the utility for the given number of examples positive examples and hypothesis
|
public coverage double priors int large super priors large
|
constructs a new coverage with the given default probability
|
public wracc double priors int large super priors large
|
constructs new wracc with the given default probability
|
public double conf double total example weight double delta double inverse normal inverse normal 1 delta 4 return inverse normal math sqrt total example weight math pow inverse normal 2 0d 4 0d total example weight
|
calculate confidence intervall without a specific rule
|
public double utility double total weight double total positive weight hypothesis hypo return hypo get positive weight total weight
|
calculates the utility for the given number of examples positive examples and hypothesis
|
public double variance double total weight double total positive weight hypothesis hypo double p0 if hypo get prediction hypothesis positive class p0 this priors hypothesis positive class else p0 this priors hypothesis negative class double mean this utility total weight total positive weight hypo double inner term hypo get positive weight math pow 1 0 p0 mean 2 hypo get covered weight hypo get positive weight math pow 0 0 p0 mean 2 total weight hypo get covered weight math pow 0 0 mean 2 return math sqrt inner term total weight
|
calculates the empirical variance
|
public double variance double total weight double total positive weight hypothesis hypo double mean this utility total weight total positive weight hypo double inner term hypo get positive weight math pow 1 0d mean 2 0d total weight hypo get positive weight math pow 0 0d mean 2 0d return math sqrt inner term total weight
|
calculates the empirical variance
|
public double get upper bound double total weight double total positive weight hypothesis hypo double delta double p0 if hypo get prediction hypothesis positive class p0 this priors hypothesis positive class else p0 this priors hypothesis negative class utility cov new coverage this priors this large hypothesis h hypo clone h set covered weight hypo get positive weight all fp become tn double g cov utility total weight total positive weight h double conf cov confidence intervall total weight delta return g conf 1 0 p0
|
returns an upper bound for the utility of refinements for the given hypothesis
|
private double variance double p double total example weight return p 1 0d p total example weight
|
calculates the variance for a binomial distribution
|
public double get upper bound double total weight double total positive weight hypothesis hypo double delta never needed return 1 0d
|
returns an upper bound for the utility of refinements for the given hypothesis
|
public double conf small m double total example weight double delta return 3 0d math sqrt math log 4 0d delta 2 0d total example weight
|
calculate confidence intervall without a specific rule for small m
|
public double utility double total example weight double total positive weight hypothesis hypo double fp hypo get covered weight hypo get positive weight double tn total example weight total positive weight fp return hypo get positive weight tn total example weight
|
calculates the utility for the given number of examples positive examples and hypothesis
|
public binomial double priors int large super priors large
|
constructs a new binomial with the given default probability
|
public double get upper bound double total weight double total positive weight hypothesis hypo double delta double p0 if hypo get prediction hypothesis positive class p0 this priors hypothesis positive class else p0 this priors hypothesis negative class utility cov new coverage this priors this large hypothesis h hypo clone h set covered weight hypo get positive weight all fp become tn double g cov utility total weight total positive weight h double conf cov confidence intervall total weight delta return g conf 1 0d p0
|
returns an upper bound for the utility of refinements for the given hypothesis
|
public double utility double total weight double total positive weight hypothesis hypo double g hypo get covered weight total weight double p hypo get positive weight hypo get covered weight if hypo get prediction hypothesis positive class return math sqrt g p this priors hypothesis positive class else return math sqrt g p this priors hypothesis negative class
|
calculates the utility for the given number of examples positive examples and hypothesis
|
public double variance double total weight double total positive weight hypothesis hypo double fp hypo get covered weight hypo get positive weight double tn total weight total positive weight fp double correct predictions hypo get positive weight tn double mean correct predictions total weight double inner term correct predictions math pow 1 0d mean 2 total weight correct predictions math pow 0 0d mean 2 return math sqrt inner term total weight
|
calculates the empirical variance
|
public hypothesis get hypothesis return hypo
|
returns the stored hypothesis
|
public double conf double total weight double delta double inverse normal inverse normal 1 delta 4 return math sqrt inverse normal 2 math sqrt total weight inverse normal 2 math sqrt total weight math pow inverse normal 2 math sqrt total weight 1 5d
|
calculate confidence intervall without a specific rule
|
public double get utility return utility
|
returns the stored utility
|
public double get upper bound double total weight double total positive weight hypothesis hypo double delta hypothesis h hypo clone h set covered weight hypo get positive weight all fp become tn double util this utility total weight total positive weight h double conf this confidence intervall total weight delta return util conf
|
returns an upper bound for the utility of refinements for the given hypothesis
|
public double get confidence return confidence
|
returns the stored size of the confidence intervall
|
public double get total positive weight return total positive weight
|
returns the stored positive weight
|
public double conf small m double total example weight double delta double term math log 4 delta 2 total example weight return math sqrt term math pow term 0 25 math pow term 0 75
|
calculate confidence intervall without a specific rule for small m
|
public double get total weight return total weight
|
returns the stored total weight
|
public boolean equals object o if o instanceof result return false result other result result o if other result get hypothesis equals this get hypothesis return true else return false
|
returns true if the same hypothesis is stored by both results
|
public double get upper bound double total weight double total positive weight hypothesis hypo double delta double p0 if hypo get prediction hypothesis positive class p0 this priors hypothesis positive class else p0 this priors hypothesis negative class utility cov new coverage this priors this large hypothesis h hypo clone h set covered weight hypo get positive weight all fp become tn double g cov utility total weight total positive weight h double conf cov confidence intervall total weight delta return math sqrt g conf 1 0d p0
|
returns an upper bound for the utility of refinements for the given hypothesis
|
public hypothesis clone rule clone new rule this literals this prediction clone set covered weight this get covered weight clone set positive weight this get positive weight return clone
|
clones the rule with covered and positive weight
|
public boolean equals object o if o instanceof literal return false literal other literal literal o if this attribute equals other literal attribute this value other literal value return true else return false
|
returns true if both attributes and both values are equal
|
public void apply example e if this applicable e if rejection sampling covered weight if int e get label this prediction positive weight else covered weight e get weight if int e get label this prediction positive weight e get weight
|
applies the rule to the given examples
|
public string to string string str this attribute get mapping map index value return attribute get name str
|
returns a string represenation of this literal
|
public hypothesis attribute regulars attribute l boolean rs boolean create all rejection sampling rs create all hypothesis create all label l
|
create a new dummy hypothesis to allow calling the init method
|
public boolean equals object o if o instanceof gssmodel return false gssmodel other model gssmodel o if other model hypothesis equals this hypothesis return true else return false
|
returns true if the hypothesis contained in the model are equal
|
public boolean can be refined no literals can be appended if the last literal tests the last attribute if literals literals length 1 get index all literals length 1 return false else return true
|
returns true only if this hypothesis can still be refined
|
public attribute get label return label
|
returns the label
|
public void reset this covered weight 0 0d this positive weight 0 0d
|
sets covered weight and positive weight back to 0
|
public int get prediction index if this confidences hypothesis positive class this confidences hypothesis negative class return hypothesis positive class else return hypothesis negative class
|
returns the most probable label index for this model
|
public double get covered weight return this covered weight
|
returns the covered weight of this hypothesis
|
public int get prediction return this prediction
|
returns the index of prediction of this rule
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.