PLSSVM - Parallel Least Squares Support Vector Machine  2.0.0
A Least Squares Support Vector Machine implementation using different backends.
Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
plssvm::detail::parameter< T > Struct Template Reference

Class for encapsulating all important C-SVM parameters. More...

#include <parameter.hpp>

Collaboration diagram for plssvm::detail::parameter< T >:
[legend]

Public Types

using real_type = T
 The type of the data. Must be either float or double.
 

Public Member Functions

constexpr parameter () noexcept=default
 Default construct a parameter set, i.e., each SVM parameter has its default value.
 
constexpr parameter (const kernel_function_type kernel_p, const int degree_p, const real_type gamma_p, const real_type coef0_p, const real_type cost_p) noexcept
 Construct a parameter set by explicitly overwriting the SVM parameters' default values. More...
 
template<typename... Args, PLSSVM_REQUIRES(has_only_named_args_v< Args... >) >
constexpr parameter (const parameter &params, Args &&...named_args)
 Construct a parameter by using the values in params and overwriting all values using the provided named-parameters. More...
 
template<typename... Args, PLSSVM_REQUIRES(has_only_named_args_v< Args... >) >
constexpr parameter (Args &&...named_args) noexcept
 Construct a parameter set by overwriting the SVM parameters' default values that are provided using named-parameters. More...
 
template<typename U >
constexpr operator parameter< U > () const
 Convert a plssvm::parameter<T>to a plssvm::parameter<U> (i.e., conversion between float <-> double). More...
 
constexpr bool equivalent (const parameter &other) const noexcept
 Checks whether the current parameter set is equivalent to the one given by other. More...
 

Public Attributes

default_value< kernel_function_typekernel_type { default_init<kernel_function_type>{ kernel_function_type::linear } }
 The used kernel function: linear, polynomial, or radial basis functions (rbf).
 
default_value< int > degree { default_init<int>{ 3 } }
 The degree parameter used in the polynomial kernel function.
 
default_value< real_typegamma { default_init<real_type>{ 0.0 } }
 The gamma parameter used in the polynomial and rbf kernel functions.
 
default_value< real_typecoef0 { default_init<real_type>{ 0.0 } }
 The coef0 parameter used in the polynomial kernel function.
 
default_value< real_typecost { default_init<real_type>{ 1.0 } }
 The cost parameter in the C-SVM.
 

Private Member Functions

template<typename... Args>
void set_named_arguments (Args &&...named_args)
 Overwrite the default values of this parameter object with the potential provided named-parameters named_args. More...
 

Detailed Description

template<typename T>
struct plssvm::detail::parameter< T >

Class for encapsulating all important C-SVM parameters.

Template Parameters
Tthe used real_type, must either be float or double

Constructor & Destructor Documentation

◆ parameter() [1/3]

template<typename T >
constexpr plssvm::detail::parameter< T >::parameter ( const kernel_function_type  kernel_p,
const int  degree_p,
const real_type  gamma_p,
const real_type  coef0_p,
const real_type  cost_p 
)
inlineconstexprnoexcept

Construct a parameter set by explicitly overwriting the SVM parameters' default values.

Parameters
[in]kernel_pthe kernel type: linear, polynomial, or radial-basis functions (rbf)
[in]degree_pthe degree used in the polynomial kernel function
[in]gamma_pthe gamma used in the polynomial and rbf kernel functions
[in]coef0_pthe coef0 used in the polynomial kernel function
[in]cost_pthe cost used in all kernel functions

◆ parameter() [2/3]

template<typename T >
template<typename... Args, PLSSVM_REQUIRES(has_only_named_args_v< Args... >) >
constexpr plssvm::detail::parameter< T >::parameter ( const parameter< T > &  params,
Args &&...  named_args 
)
inlineexplicitconstexpr

Construct a parameter by using the values in params and overwriting all values using the provided named-parameters.

Template Parameters
Argsthe type of the named-parameters
Parameters
[in]paramsthe parameters used to overwrite the default values
[in]named_argsthe potential named-parameters

◆ parameter() [3/3]

template<typename T >
template<typename... Args, PLSSVM_REQUIRES(has_only_named_args_v< Args... >) >
constexpr plssvm::detail::parameter< T >::parameter ( Args &&...  named_args)
inlineexplicitconstexprnoexcept

Construct a parameter set by overwriting the SVM parameters' default values that are provided using named-parameters.

Template Parameters
Argsthe type of the named-parameters
Parameters
[in]named_argsthe potential named-parameters

Member Function Documentation

◆ operator parameter< U >()

template<typename T >
template<typename U >
constexpr plssvm::detail::parameter< T >::operator parameter< U > ( ) const
inlineexplicitconstexpr

Convert a plssvm::parameter<T>to a plssvm::parameter<U> (i.e., conversion between float <-> double).

Template Parameters
Uthe type to convert to
Returns
the plssvm::parameter values converted to U ([[nodiscard]])

◆ equivalent()

template<typename T >
constexpr bool plssvm::detail::parameter< T >::equivalent ( const parameter< T > &  other) const
inlineconstexprnoexcept

Checks whether the current parameter set is equivalent to the one given by other.

Compares the member variables based on the kernel, i.e., for example for the rbf kernel both parameter sets must only have the same gamma and cost values but may differ in the values of degree or coef0. If all members should be compared regardless of the kernel type, one can use the operator== overload.

Parameters
[in]otherthe other parameter set compared to this one
Returns
true if both parameter sets are equivalent, false otherwise ([[nodiscard]])

◆ set_named_arguments()

template<typename T >
template<typename... Args>
void plssvm::detail::parameter< T >::set_named_arguments ( Args &&...  named_args)
inlineprivate

Overwrite the default values of this parameter object with the potential provided named-parameters named_args.

Template Parameters
Argsthe type of the named-parameters
Parameters
[in]named_argsthe potential named-parameters

The documentation for this struct was generated from the following files: