Nu Support Vector Regression.
Similar to NuSVC, for regression, uses a parameter nu to control the number of support vectors. However, unlike NuSVC, where nu replaces C, here nu replaces the parameter epsilon of epsilon-SVR.
The implementation is based on libsvm.
Read more in the User Guide.
new NuSVR(opts?: object): NuSVR;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
opts.C? |
number |
Penalty parameter C of the error term. Default Value 1 |
opts.cache_size? |
number |
Specify the size of the kernel cache (in MB). Default Value 200 |
opts.coef0? |
number |
Independent term in kernel function. It is only significant in ‘poly’ and ‘sigmoid’. Default Value 0 |
opts.degree? |
number |
Degree of the polynomial kernel function (‘poly’). Must be non-negative. Ignored by all other kernels. Default Value 3 |
opts.gamma? |
number | "auto" | "scale" |
Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’. Default Value 'scale' |
opts.kernel? |
"sigmoid" | "precomputed" | "linear" | "poly" | "rbf" |
Specifies the kernel type to be used in the algorithm. If none is given, ‘rbf’ will be used. If a callable is given it is used to precompute the kernel matrix. Default Value 'rbf' |
opts.max_iter? |
number |
Hard limit on iterations within solver, or -1 for no limit. Default Value -1 |
opts.nu? |
number |
An upper bound on the fraction of training errors and a lower bound of the fraction of support vectors. Should be in the interval (0, 1]. By default 0.5 will be taken. Default Value 0.5 |
opts.shrinking? |
boolean |
Whether to use the shrinking heuristic. See the User Guide. Default Value true |
opts.tol? |
number |
Tolerance for stopping criterion. Default Value 0.001 |
opts.verbose? |
boolean |
Enable verbose output. Note that this setting takes advantage of a per-process runtime setting in libsvm that, if enabled, may not work properly in a multithreaded context. Default Value false |
Defined in: generated/svm/NuSVR.ts:27
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/svm/NuSVR.ts:171
Fit the SVM model according to the given training data.
fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike |
Training vectors, where n\_samples is the number of samples and n\_features is the number of features. For kernel=”precomputed”, the expected shape of X is (n_samples, n_samples). |
opts.sample_weight? |
ArrayLike |
Per-sample weights. Rescale C per sample. Higher weights force the classifier to put more emphasis on these points. |
opts.y? |
ArrayLike |
Target values (class labels in classification, real numbers in regression). |
Promise
<any
>
Defined in: generated/svm/NuSVR.ts:188
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/svm/NuSVR.ts:237
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/svm/NuSVR.ts:122
Perform regression on samples in X.
For an one-class model, +1 (inlier) or -1 (outlier) is returned.
predict(opts: object): Promise<ArrayLike>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike |
For kernel=”precomputed”, the expected shape of X is (n_samples_test, n_samples_train). |
Promise
<ArrayLike
>
Defined in: generated/svm/NuSVR.ts:272
Return the coefficient of determination of the prediction.
The coefficient of determination \(R^2\) is defined as \((1 - \frac{u}{v})\), where \(u\) is the residual sum of squares ((y\_true \- y\_pred)\*\* 2).sum()
and \(v\) is the total sum of squares ((y\_true \- y\_true.mean()) \*\* 2).sum()
. The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y
, disregarding the input features, would get a \(R^2\) score of 0.0.
score(opts: object): Promise<number>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n\_samples, n\_samples\_fitted) , where n\_samples\_fitted is the number of samples used in the fitting for the estimator. |
opts.sample_weight? |
ArrayLike |
Sample weights. |
opts.y? |
ArrayLike |
True values for X . |
Promise
<number
>
Defined in: generated/svm/NuSVR.ts:307
Request metadata passed to the fit
method.
Note that this method is only relevant if enable\_metadata\_routing=True
(see sklearn.set\_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
set_fit_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.sample_weight? |
string | boolean |
Metadata routing for sample\_weight parameter in fit . |
Promise
<any
>
Defined in: generated/svm/NuSVR.ts:358
Request metadata passed to the score
method.
Note that this method is only relevant if enable\_metadata\_routing=True
(see sklearn.set\_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
set_score_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.sample_weight? |
string | boolean |
Metadata routing for sample\_weight parameter in score . |
Promise
<any
>
Defined in: generated/svm/NuSVR.ts:395
boolean
=false
Defined in: generated/svm/NuSVR.ts:25
boolean
=false
Defined in: generated/svm/NuSVR.ts:24
PythonBridge
Defined in: generated/svm/NuSVR.ts:23
string
Defined in: generated/svm/NuSVR.ts:20
any
Defined in: generated/svm/NuSVR.ts:21
Multipliers of parameter C for each class. Computed based on the class\_weight
parameter.
class_weight_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/svm/NuSVR.ts:428
Coefficients of the support vector in the decision function.
dual_coef_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/svm/NuSVR.ts:451
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/svm/NuSVR.ts:543
0 if correctly fitted, 1 otherwise (will raise warning)
fit_status_(): Promise<number>;
Promise
<number
>
Defined in: generated/svm/NuSVR.ts:474
Constants in decision function.
intercept_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/svm/NuSVR.ts:497
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/svm/NuSVR.ts:520
Number of iterations run by the optimization routine to fit the model.
n_iter_(): Promise<number>;
Promise
<number
>
Defined in: generated/svm/NuSVR.ts:568
py(): PythonBridge;
PythonBridge
Defined in: generated/svm/NuSVR.ts:109
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/svm/NuSVR.ts:113
Array dimensions of training vector X
.
shape_fit_(): Promise<any[]>;
Promise
<any
[]>
Defined in: generated/svm/NuSVR.ts:590
Indices of support vectors.
support_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/svm/NuSVR.ts:613
Support vectors.
support_vectors_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/svm/NuSVR.ts:635