gemseo.mlearning.regression.algos.rbf_settings module#
Settings of the RBF network for regression.
- class Function(value)[source]#
Bases:
StrEnum
The radial basis functions.
- CUBIC = 'cubic'#
- GAUSSIAN = 'gaussian'#
- INVERSE_MULTIQUADRIC = 'inverse_multiquadric'#
- LINEAR = 'linear'#
- MULTIQUADRIC = 'multiquadric'#
- QUINTIC = 'quintic'#
- THIN_PLATE = 'thin_plate'#
- Settings RBFRegressor_Settings(*, transformer=None, parameters=None, input_names=(), output_names=(), function=Function.MULTIQUADRIC, der_function=None, epsilon=None, smooth=0.0, norm='euclidean')[source]#
Bases:
BaseRegressorSettings
The settings of the RBF network for regression.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
input_names (Sequence[str]) --
By default it is set to ().
output_names (Sequence[str]) --
By default it is set to ().
function (Function | Annotated[Callable[[float, float], float], WithJsonSchema(json_schema={}, mode=None)]) --
By default it is set to "multiquadric".
der_function (Annotated[Callable[[_NDArrayPydantic[Any, dtype[_ScalarType_co]]], _NDArrayPydantic[Any, dtype[_ScalarType_co]]], WithJsonSchema(json_schema={}, mode=None)] | None)
epsilon (float | None)
smooth (float) --
By default it is set to 0.0.
norm (str | Annotated[Callable[[_NDArrayPydantic[Any, dtype[_ScalarType_co]], _NDArrayPydantic[Any, dtype[_ScalarType_co]]], float], WithJsonSchema(json_schema={}, mode=None)]) --
By default it is set to "euclidean".
- Return type:
None
- der_function: Annotated[Callable[[NDArrayPydantic], NDArrayPydantic], WithJsonSchema({})] | None = None#
The derivative of the radial basis function.
Only to be provided if
function
is a callable and if the use of the model with its derivative is required. IfNone
and iffunction
is a callable, an error will be raised. IfNone
and iffunction
is a string, the class will look for its internal implementation and will raise an error if it is missing. Theder_function
shall take three arguments (input_data
,norm_input_data
,eps
). For an RBF of the form function(\(r\)), der_function(\(x\), \(|x|\), \(\epsilon\)) shall return \(\epsilon^{-1} x/|x| f'(|x|/\epsilon)\).
- epsilon: float | None = None#
An adjustable constant for Gaussian or multiquadric functions.
If
None
, use the average distance between input data.
- function: Function | Annotated[Callable[[float, float], float], WithJsonSchema({})] = Function.MULTIQUADRIC#
The radial basis function.
This function takes a radius \(r\) as input, representing a distance between two points. If it is a string, then it must be one of the following:
"multiquadric"
for \(\sqrt{(r/\epsilon)^2 + 1}\),"inverse"
for \(1/\sqrt{(r/\epsilon)^2 + 1}\),"gaussian"
for \(\exp(-(r/\epsilon)^2)\),"linear"
for \(r\),"cubic"
for \(r^3\),"quintic"
for \(r^5\),"thin_plate"
for \(r^2\log(r)\).
If it is a callable, then it must take the two arguments
self
andr
as inputs, e.g.lambda self, r: sqrt((r/self.epsilon)**2 + 1)
for the multiquadric function. The epsilon parameter will be available asself.epsilon
. Other keyword arguments passed in will be available as well.
- norm: str | Annotated[Callable[[NDArrayPydantic, NDArrayPydantic], float], WithJsonSchema({})] = 'euclidean'#
The distance metric.
Either a distance function name known by SciPy or a function that computes the distance between two points.