6.8 KiB
module torus.ml.sklearn.svm
Implement Support Vector Machine.
class LinearSVR
A Regression Support Vector Machine (SVM).
Parameters:
n_bits(int, Dict[str, int]): Number of bits to quantize the model. If an int is passed for n_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op_inputs" and "op_weights" as keys with corresponding number of quantization bits so that: - op_inputs : number of bits to quantize the input values - op_weights: number of bits to quantize the learned parameters Default to 8.
For more details on LinearSVR please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVR.html
method __init__
__init__(
n_bits=8,
epsilon=0.0,
tol=0.0001,
C=1.0,
loss='epsilon_insensitive',
fit_intercept=True,
intercept_scaling=1.0,
dual=True,
verbose=0,
random_state=None,
max_iter=1000
)
property fhe_circuit
Get the FHE circuit.
The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Torus documentation (https://docs.lux.network/torus/get-started/terminology) Is None if the model is not fitted.
Returns:
Circuit: The FHE circuit.
property is_compiled
Indicate if the model is compiled.
Returns:
bool: If the model is compiled.
property is_fitted
Indicate if the model is fitted.
Returns:
bool: If the model is fitted.
property onnx_model
Get the ONNX model.
Is None if the model is not fitted.
Returns:
onnx.ModelProto: The ONNX model.
method dump_dict
dump_dict() → Dict[str, Any]
classmethod load_dict
load_dict(metadata: Dict)
class LinearSVC
A Classification Support Vector Machine (SVM).
Parameters:
n_bits(int, Dict[str, int]): Number of bits to quantize the model. If an int is passed for n_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op_inputs" and "op_weights" as keys with corresponding number of quantization bits so that: - op_inputs : number of bits to quantize the input values - op_weights: number of bits to quantize the learned parameters Default to 8.
For more details on LinearSVC please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html
method __init__
__init__(
n_bits=8,
penalty='l2',
loss='squared_hinge',
dual=True,
tol=0.0001,
C=1.0,
multi_class='ovr',
fit_intercept=True,
intercept_scaling=1,
class_weight=None,
verbose=0,
random_state=None,
max_iter=1000
)
property fhe_circuit
Get the FHE circuit.
The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Torus documentation (https://docs.lux.network/torus/get-started/terminology) Is None if the model is not fitted.
Returns:
Circuit: The FHE circuit.
property is_compiled
Indicate if the model is compiled.
Returns:
bool: If the model is compiled.
property is_fitted
Indicate if the model is fitted.
Returns:
bool: If the model is fitted.
property n_classes_
Get the model's number of classes.
Using this attribute is deprecated.
Returns:
int: The model's number of classes.
property onnx_model
Get the ONNX model.
Is None if the model is not fitted.
Returns:
onnx.ModelProto: The ONNX model.
property target_classes_
Get the model's classes.
Using this attribute is deprecated.
Returns:
Optional[numpy.ndarray]: The model's classes.
method dump_dict
dump_dict() → Dict[str, Any]
classmethod load_dict
load_dict(metadata: Dict)