|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.misc.monotone.OSDLCore
public abstract class OSDLCore
This class is an implementation of the Ordinal Stochastic Dominance Learner.
Further information regarding the OSDL-algorithm can be found in:
S. Lievens, B. De Baets, K. Cao-Van (2006). A Probabilistic Framework for the Design of Instance-Based Supervised Ranking Algorithms in an Ordinal Setting. Annals of Operations Research..
Kim Cao-Van (2003). Supervised ranking: from semantics to algorithms.
Stijn Lievens (2004). Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken.
For more information about supervised ranking, see
http://users.ugent.be/~slievens/supervised_ranking.php
@article{Lievens2006, author = {S. Lievens and B. De Baets and K. Cao-Van}, journal = {Annals of Operations Research}, title = {A Probabilistic Framework for the Design of Instance-Based Supervised Ranking Algorithms in an Ordinal Setting}, year = {2006} } @phdthesis{Cao-Van2003, author = {Kim Cao-Van}, school = {Ghent University}, title = {Supervised ranking: from semantics to algorithms}, year = {2003} } @mastersthesis{Lievens2004, author = {Stijn Lievens}, school = {Ghent University}, title = {Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken}, year = {2004} }Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
-C <REG|WSUM|MAX|MED|RMED> Sets the classification type to be used. (Default: MED)
-B Use the balanced version of the Ordinal Stochastic Dominance Learner
-W Use the weighted version of the Ordinal Stochastic Dominance Learner
-S <value of interpolation parameter> Sets the value of the interpolation parameter (not with -W/T/P/L/U) (default: 0.5).
-T Tune the interpolation parameter (not with -W/S) (default: off)
-L <Lower bound for interpolation parameter> Lower bound for the interpolation parameter (not with -W/S) (default: 0)
-U <Upper bound for interpolation parameter> Upper bound for the interpolation parameter (not with -W/S) (default: 1)
-P <Number of parts> Determines the step size for tuning the interpolation parameter, nl. (U-L)/P (not with -W/S) (default: 10)
Field Summary | |
---|---|
static int |
CT_MAXPROB
Constant indicating that the classification type is the mode of the distribution. |
static int |
CT_MEDIAN
Constant indicating that the classification type is the median. |
static int |
CT_MEDIAN_REAL
Constant indicating that the classification type is the median, but not rounded to the nearest class. |
static int |
CT_REGRESSION
Constant indicating that the classification type is regression (probabilistic weighted sum). |
static int |
CT_WEIGHTED_SUM
Constant indicating that the classification type is the probabilistic weighted sum. |
static Tag[] |
TAGS_CLASSIFICATIONTYPES
the classification types |
Constructor Summary | |
---|---|
OSDLCore()
|
Method Summary | |
---|---|
java.lang.String |
balancedTipText()
Returns a string suitable for displaying in the gui/experimenter. |
void |
buildClassifier(Instances instances)
Builds the classifier. |
java.lang.String |
classificationTypeTipText()
Returns the tip text for this property. |
double |
classifyInstance(Instance instance)
Classifies a given instance using the current settings of the classifier. |
double |
crossValidate()
Tunes the interpolation parameter using the current settings of the classifier. |
double |
crossValidate(double sLow,
double sUp,
int sNrParts,
int ctype)
Tune the interpolation parameter using leave-one-out cross validation, the loss function used is the 1-0 loss function. |
double |
crossValidate(double sLow,
double sUp,
int sNrParts,
int ctype,
double[] performanceStats,
NominalLossFunction lossFunction)
Tune the interpolation parameter using leave-one-out cross validation. |
double[] |
cumulativeDistributionForInstance(Instance instance)
Calculates the cumulative class probabilities for the given test instance. |
double[] |
distributionForInstance(Instance instance)
Calculates the class probabilities for the given test instance. |
boolean |
getBalanced()
Returns if the balanced version of OSDL is in effect. |
Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
SelectedTag |
getClassificationType()
Returns the classification type. |
double |
getInterpolationParameter()
Returns the current value of the interpolation parameter. |
double |
getInterpolationParameterLowerBound()
Returns the lower bound for the interpolation parameter tuning (0 <= x < 1). |
double |
getInterpolationParameterUpperBound()
Returns the upper bound for the interpolation parameter tuning (0 < x <= 1). |
double |
getLowerBound()
Returns the current value of the lower bound for the interpolation parameter. |
int |
getNumberOfPartsForInterpolationParameter()
Gets the granularity for tuning the interpolation parameter. |
int |
getNumInstances()
Returns the number of instances in the training set. |
java.lang.String[] |
getOptions()
Gets the current settings of the OSDLCore classifier. |
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
boolean |
getTuneInterpolationParameter()
Returns whether the interpolation parameter is to be tuned based on the bounds. |
double |
getUpperBound()
Returns the current value of the upper bound for the interpolation parameter. |
boolean |
getWeighted()
Returns if the weighted version is in effect. |
java.lang.String |
globalInfo()
Returns a string describing the classifier. |
java.lang.String |
interpolationParameterLowerBoundTipText()
Returns the tip text for this property. |
java.lang.String |
interpolationParameterTipText()
Returns the tip text for this property. |
java.lang.String |
interpolationParameterUpperBoundTipText()
Returns the tip text for this property. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
java.lang.String |
numberOfPartsForInterpolationParameterTipText()
Returns the tip text for this property. |
void |
setBalanced(boolean balanced)
If balanced is true then the balanced
version of OSDL will be used, otherwise the ordinary version of
OSDL will be in effect. |
void |
setClassificationType(SelectedTag value)
Sets the classification type. |
void |
setInterpolationParameter(double s)
Sets the interpolation parameter. |
void |
setInterpolationParameterBounds(double sLow,
double sUp)
Sets the interpolation bounds for the interpolation parameter. |
void |
setInterpolationParameterLowerBound(double value)
Sets the lower bound for the interpolation parameter tuning (0 <= x < 1). |
void |
setInterpolationParameterUpperBound(double value)
Sets the upper bound for the interpolation parameter tuning (0 < x <= 1). |
void |
setNumberOfPartsForInterpolationParameter(int sParts)
Sets the granularity for tuning the interpolation parameter. |
void |
setOptions(java.lang.String[] options)
Parses the options for this object. |
void |
setTuneInterpolationParameter(boolean value)
Sets whether the interpolation parameter is to be tuned based on the bounds. |
void |
setWeighted(boolean weighted)
If weighted is true then the
weighted version of the OSDL is used. |
java.lang.String |
toString()
Returns a description of the classifier. |
double |
tuneInterpolationParameter()
Tune the interpolation parameter using the current settings of the classifier. |
double |
tuneInterpolationParameter(double sLow,
double sUp,
int sParts,
int ctype)
Tunes the interpolation parameter using the given settings. |
java.lang.String |
tuneInterpolationParameterTipText()
Returns the tip text for this property. |
java.lang.String |
weightedTipText()
Returns a string suitable for displaying in the gui/experimenter. |
Methods inherited from class weka.classifiers.Classifier |
---|
debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CT_REGRESSION
public static final int CT_WEIGHTED_SUM
public static final int CT_MAXPROB
public static final int CT_MEDIAN
public static final int CT_MEDIAN_REAL
public static final Tag[] TAGS_CLASSIFICATIONTYPES
Constructor Detail |
---|
public OSDLCore()
Method Detail |
---|
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if for some reason no distribution
could be predictedpublic double[] distributionForInstance(Instance instance)
distributionForInstance
in class Classifier
instance
- the instance to be classified
public double[] cumulativeDistributionForInstance(Instance instance)
instance
- the instance to be classified
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- the instances to be used for building the classifier
java.lang.Exception
- if the classifier can't be built successfullypublic java.lang.String classificationTypeTipText()
public void setClassificationType(SelectedTag value)
ctype
must be one of:
CT_REGRESSION
: use expectation value of
distribution. (Non-ordinal in nature).
CT_WEIGHTED_SUM
: use expectation value of
distribution rounded to nearest class label. (Non-ordinal in
nature).
CT_MAXPROB
: use the mode of the distribution.
(May deliver non-monotone results).
CT_MEDIAN
: use the median of the distribution
(rounded to the nearest class label).
CT_MEDIAN_REAL
: use the median of the distribution
but not rounded to the nearest class label.
value
- the classification typepublic SelectedTag getClassificationType()
public java.lang.String tuneInterpolationParameterTipText()
public void setTuneInterpolationParameter(boolean value)
value
- if true the parameter is tunedpublic boolean getTuneInterpolationParameter()
public java.lang.String interpolationParameterLowerBoundTipText()
public void setInterpolationParameterLowerBound(double value)
value
- the tne lower bound
java.lang.IllegalArgumentException
- if bound is invalidpublic double getInterpolationParameterLowerBound()
public java.lang.String interpolationParameterUpperBoundTipText()
public void setInterpolationParameterUpperBound(double value)
value
- the tne upper bound
java.lang.IllegalArgumentException
- if bound is invalidpublic double getInterpolationParameterUpperBound()
public void setInterpolationParameterBounds(double sLow, double sUp) throws java.lang.IllegalArgumentException
[sLow, sUp]
are considered.
It is important to note that using this method immediately
implies that the interpolation parameter is to be tuned.
sLow
- lower bound for the interpolation parameter,
should not be smaller than 0 or greater than sUp
sUp
- upper bound for the interpolation parameter,
should not exceed 1 or be smaller than sLow
java.lang.IllegalArgumentException
- if one of the above conditions
is not satisfied.public java.lang.String interpolationParameterTipText()
public void setInterpolationParameter(double s) throws java.lang.IllegalArgumentException
s
- value for the interpolation parameter.
java.lang.IllegalArgumentException
- if s
is not in
the range [0,1].public double getInterpolationParameter()
public java.lang.String numberOfPartsForInterpolationParameterTipText()
public void setNumberOfPartsForInterpolationParameter(int sParts) throws java.lang.IllegalArgumentException
sParts
parts, i.e.
sParts + 1
values will be checked when
tuneInterpolationParameter
is invoked.
This also means that the interpolation parameter is to
be tuned.
sParts
- the number of parts
java.lang.IllegalArgumentException
- if sParts
is
smaller or equal than 0.public int getNumberOfPartsForInterpolationParameter()
[s_low, s_up]
is to be splitpublic java.lang.String balancedTipText()
public void setBalanced(boolean balanced)
balanced
is true
then the balanced
version of OSDL will be used, otherwise the ordinary version of
OSDL will be in effect.
balanced
- if true
then B-OSDL is used, otherwise
it is OSDLpublic boolean getBalanced()
true
if the balanced version is in effect,
false
otherwisepublic java.lang.String weightedTipText()
public void setWeighted(boolean weighted)
weighted
is true
then the
weighted version of the OSDL is used.
Note: using the weighted (non-balanced) version only ensures the
quasi monotonicity of the results w.r.t. to training set.
weighted
- true
if the weighted version to be used,
false
otherwisepublic boolean getWeighted()
true
if the weighted version is in effect,
false
otherwise.public double getLowerBound()
public double getUpperBound()
public int getNumInstances()
public double tuneInterpolationParameter()
public double tuneInterpolationParameter(double sLow, double sUp, int sParts, int ctype) throws java.lang.IllegalArgumentException
sLow
- lower end point of interval of paramters to be examinedsUp
- upper end point of interval of paramters to be examinedsParts
- number of parts the interval is divided into. This thus determines
the granularity of the searchctype
- the classification type to use
java.lang.IllegalArgumentException
- if the given parameter list is not
validpublic double crossValidate() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if somehow the current settings of the
classifier are illegal.public double crossValidate(double sLow, double sUp, int sNrParts, int ctype) throws java.lang.IllegalArgumentException
The given settings are used, but the classifier is not updated!. Also, the interpolation parameter s is not set.
sLow
- lower end point of interval of paramters to be examinedsUp
- upper end point of interval of paramters to be examinedsNrParts
- number of parts the interval is divided into. This thus determines
the granularity of the searchctype
- the classification type to use
java.lang.IllegalArgumentException
- if the settings for the
interpolation parameter are not valid or if the classification
type is not validpublic double crossValidate(double sLow, double sUp, int sNrParts, int ctype, double[] performanceStats, NominalLossFunction lossFunction) throws java.lang.IllegalArgumentException
sLow
- lower bound for interpolation parametersUp
- upper bound for interpolation parametersNrParts
- determines the granularity of the searchctype
- the classification type to useperformanceStats
- array acting as output, and that will
contain the total loss of the leave-one-out cross validation for
each considered value of the interpolation parameterlossFunction
- the loss function to use
java.lang.IllegalArgumentException
- the length of the array
performanceStats
is not sufficient
java.lang.IllegalArgumentException
- if the interpolation parameters
are not valid
java.lang.IllegalArgumentException
- if the classification type is
not validpublic java.util.Enumeration listOptions()
setOptions
.
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D If set, classifier is run in debug mode and may output additional info to the console
-C <REG|WSUM|MAX|MED|RMED> Sets the classification type to be used. (Default: MED)
-B Use the balanced version of the Ordinal Stochastic Dominance Learner
-W Use the weighted version of the Ordinal Stochastic Dominance Learner
-S <value of interpolation parameter> Sets the value of the interpolation parameter (not with -W/T/P/L/U) (default: 0.5).
-T Tune the interpolation parameter (not with -W/S) (default: off)
-L <Lower bound for interpolation parameter> Lower bound for the interpolation parameter (not with -W/S) (default: 0)
-U <Upper bound for interpolation parameter> Upper bound for the interpolation parameter (not with -W/S) (default: 1)
-P <Number of parts> Determines the step size for tuning the interpolation parameter, nl. (U-L)/P (not with -W/S) (default: 10)
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
setOptions
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |