Maximum-likelihood model selection score for binary support vector machines. More...
#include <shark/ObjectiveFunctions/SvmLogisticInterpretation.h>
Public Types | |
typedef CVFolds< LabeledData< InputType, unsigned int > > | FoldsType |
typedef AbstractKernelFunction< InputType > | KernelType |
Public Types inherited from shark::AbstractObjectiveFunction< PointType, ResultT > | |
enum | Feature { HAS_VALUE = 1, HAS_FIRST_DERIVATIVE = 2, HAS_SECOND_DERIVATIVE = 4, CAN_PROPOSE_STARTING_POINT = 8, IS_CONSTRAINED_FEATURE = 16, HAS_CONSTRAINT_HANDLER = 32, CAN_PROVIDE_CLOSEST_FEASIBLE = 64, IS_THREAD_SAFE = 128, IS_NOISY = 256 } |
List of features that are supported by an implementation. More... | |
typedef PointType | SearchPointType |
typedef ResultT | ResultType |
typedef boost::mpl::if_< std::is_arithmetic< ResultT >, SearchPointType, RealMatrix >::type | FirstOrderDerivative |
typedef TypedFlags< Feature > | Features |
This statement declares the member m_features. See Core/Flags.h for details. More... | |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Member Functions | |
SvmLogisticInterpretation (FoldsType const &folds, KernelType *kernel, bool unconstrained=true, QpStoppingCondition *stop_cond=NULL) | |
std::string | name () const |
From INameable: return the class name. More... | |
bool | isFeasible (const SearchPointType &input) const |
std::size_t | numberOfVariables () const |
Accesses the number of variables. More... | |
double | eval (SearchPointType const ¶meters) const |
double | evalDerivative (SearchPointType const ¶meters, FirstOrderDerivative &derivative) const |
Public Member Functions inherited from shark::AbstractObjectiveFunction< PointType, ResultT > | |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasValue () const |
returns whether this function can calculate it's function value More... | |
bool | hasFirstDerivative () const |
returns whether this function can calculate the first derivative More... | |
bool | hasSecondDerivative () const |
returns whether this function can calculate the second derivative More... | |
bool | canProposeStartingPoint () const |
returns whether this function can propose a starting point. More... | |
bool | isConstrained () const |
returns whether this function can return More... | |
bool | hasConstraintHandler () const |
returns whether this function can return More... | |
bool | canProvideClosestFeasible () const |
Returns whether this function can calculate thee closest feasible to an infeasible point. More... | |
bool | isThreadSafe () const |
Returns true, when the function can be usd in parallel threads. More... | |
bool | isNoisy () const |
Returns true, when the function can be usd in parallel threads. More... | |
AbstractObjectiveFunction () | |
Default ctor. More... | |
virtual | ~AbstractObjectiveFunction () |
Virtual destructor. More... | |
virtual void | init () |
void | setRng (random::rng_type *rng) |
Sets the Rng used by the objective function. More... | |
virtual bool | hasScalableDimensionality () const |
virtual void | setNumberOfVariables (std::size_t numberOfVariables) |
Adjusts the number of variables if the function is scalable. More... | |
virtual std::size_t | numberOfObjectives () const |
virtual bool | hasScalableObjectives () const |
virtual void | setNumberOfObjectives (std::size_t numberOfObjectives) |
Adjusts the number of objectives if the function is scalable. More... | |
std::size_t | evaluationCounter () const |
Accesses the evaluation counter of the function. More... | |
AbstractConstraintHandler< SearchPointType > const & | getConstraintHandler () const |
Returns the constraint handler of the function if it has one. More... | |
virtual void | closestFeasible (SearchPointType &input) const |
If supported, the supplied point is repaired such that it satisfies all of the function's constraints. More... | |
virtual SearchPointType | proposeStartingPoint () const |
Proposes a starting point in the feasible search space of the function. More... | |
ResultType | operator() (SearchPointType const &input) const |
Evaluates the function. Useful together with STL-Algorithms like std::transform. More... | |
virtual ResultType | evalDerivative (SearchPointType const &input, SecondOrderDerivative &derivative) const |
Evaluates the objective function and calculates its gradient. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Protected Attributes | |
FoldsType | m_folds |
the underlying partitioned dataset. More... | |
KernelType * | mep_kernel |
the kernel with which to run the SVM More... | |
std::size_t | m_nhp |
for convenience, the Number of Hyper Parameters More... | |
std::size_t | m_nkp |
for convenience, the Number of Kernel Parameters More... | |
std::size_t | m_numFolds |
the number of folds to be used in cross-validation More... | |
std::size_t | m_numSamples |
overall number of samples in the dataset More... | |
std::size_t | m_inputDims |
input dimensionality More... | |
bool | m_svmCIsUnconstrained |
the SVM regularization parameter C is passed for unconstrained optimization, and the derivative should compensate for that More... | |
QpStoppingCondition * | mep_svmStoppingCondition |
the stopping criterion that is to be passed to the SVM trainer. More... | |
Protected Attributes inherited from shark::AbstractObjectiveFunction< PointType, ResultT > | |
Features | m_features |
std::size_t | m_evaluationCounter |
Evaluation counter, default value: 0. More... | |
AbstractConstraintHandler< SearchPointType > const * | m_constraintHandler |
random::rng_type * | mep_rng |
Additional Inherited Members | |
Protected Member Functions inherited from shark::AbstractObjectiveFunction< PointType, ResultT > | |
void | announceConstraintHandler (AbstractConstraintHandler< SearchPointType > const *handler) |
helper function which is called to announce the presence of an constraint handler. More... | |
Maximum-likelihood model selection score for binary support vector machines.
Definition at line 63 of file SvmLogisticInterpretation.h.
typedef CVFolds< LabeledData<InputType, unsigned int> > shark::SvmLogisticInterpretation< InputType >::FoldsType |
Definition at line 65 of file SvmLogisticInterpretation.h.
typedef AbstractKernelFunction<InputType> shark::SvmLogisticInterpretation< InputType >::KernelType |
Definition at line 66 of file SvmLogisticInterpretation.h.
|
inline |
constructor.
folds | an already partitioned dataset (i.e., a CVFolds object) |
kernel | pointer to the kernel to be used within the SVMs. |
unconstrained | whether or not the C-parameter of/for the C-SVM is passed for unconstrained optimization mode. |
stop_cond | the stopping conditions which are to be passed to the |
Definition at line 84 of file SvmLogisticInterpretation.h.
References shark::AbstractObjectiveFunction< PointType, ResultT >::HAS_FIRST_DERIVATIVE, shark::AbstractObjectiveFunction< PointType, ResultT >::HAS_VALUE, shark::AbstractKernelFunction< InputTypeT >::hasFirstParameterDerivative(), shark::AbstractObjectiveFunction< PointType, ResultT >::IS_CONSTRAINED_FEATURE, shark::AbstractObjectiveFunction< PointType, ResultT >::m_features, and SHARK_RUNTIME_CHECK.
|
inlinevirtual |
train a number of SVMs in a cross-validation setting using the hyperparameters passed to this method. the output scores from all validations sets are then concatenated. together with the true labels, these scores can then be used to fit a sigmoid such that it becomes as good as possible a model for the class membership probabilities given the SVM output scores. This method returns the negative likelihood of the best fitting sigmoid, given a set of SVM hyperparameters.
parameters | the SVM hyperparameters to use for all C-SVMs |
Reimplemented from shark::AbstractObjectiveFunction< PointType, ResultT >.
Definition at line 131 of file SvmLogisticInterpretation.h.
References shark::IParameterizable< VectorType >::setParameterVector(), and SHARK_RUNTIME_CHECK.
Referenced by run_one_trial().
|
inlinevirtual |
the derivative of the error() function above w.r.t. the parameters.
parameters | the SVM hyperparameters to use for all C-SVMs |
derivative | will store the computed derivative w.r.t. the current hyperparameters |
Reimplemented from shark::AbstractObjectiveFunction< PointType, ResultT >.
Definition at line 167 of file SvmLogisticInterpretation.h.
References shark::IParameterizable< VectorType >::setParameterVector(), and SHARK_RUNTIME_CHECK.
|
inlinevirtual |
checks whether the search point provided is feasible
input | the point to test for feasibility |
Reimplemented from shark::AbstractObjectiveFunction< PointType, ResultT >.
Definition at line 113 of file SvmLogisticInterpretation.h.
References shark::SvmLogisticInterpretation< InputType >::m_nhp, shark::SvmLogisticInterpretation< InputType >::m_svmCIsUnconstrained, and SHARK_ASSERT.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 108 of file SvmLogisticInterpretation.h.
|
inlinevirtual |
Accesses the number of variables.
Implements shark::AbstractObjectiveFunction< PointType, ResultT >.
Definition at line 121 of file SvmLogisticInterpretation.h.
References shark::SvmLogisticInterpretation< InputType >::m_nhp.
|
protected |
the underlying partitioned dataset.
Definition at line 68 of file SvmLogisticInterpretation.h.
|
protected |
input dimensionality
Definition at line 74 of file SvmLogisticInterpretation.h.
|
protected |
for convenience, the Number of Hyper Parameters
Definition at line 70 of file SvmLogisticInterpretation.h.
Referenced by shark::SvmLogisticInterpretation< InputType >::isFeasible(), and shark::SvmLogisticInterpretation< InputType >::numberOfVariables().
|
protected |
for convenience, the Number of Kernel Parameters
Definition at line 71 of file SvmLogisticInterpretation.h.
|
protected |
the number of folds to be used in cross-validation
Definition at line 72 of file SvmLogisticInterpretation.h.
|
protected |
overall number of samples in the dataset
Definition at line 73 of file SvmLogisticInterpretation.h.
|
protected |
the SVM regularization parameter C is passed for unconstrained optimization, and the derivative should compensate for that
Definition at line 75 of file SvmLogisticInterpretation.h.
Referenced by shark::SvmLogisticInterpretation< InputType >::isFeasible().
|
protected |
the kernel with which to run the SVM
Definition at line 69 of file SvmLogisticInterpretation.h.
|
protected |
the stopping criterion that is to be passed to the SVM trainer.
Definition at line 76 of file SvmLogisticInterpretation.h.