The distribution called itself torus-ml while shipping a package directory named concrete, so the name a user installs and the name they import disagreed — and most of the tree already said torus.ml, which could not resolve against src/concrete. Moved src/concrete to src/torus and pointed the include at it. The dependency was Zama's concrete-python from their index. It is torus-fhe from ours, which is what luxfhe/torus already ships: that frontend declares torus-fhe and ships a torus/fhe module, so every 'from torus.fhe' in this tree was already naming our compiler and only the dependency lagged. Two distributions share one namespace, which is the shape the upstream this forked from used and the reason the split works: torus-fhe gives torus.fhe, torus-ml gives torus.ml. Swept every other spelling — identifiers, enum members, workflow variables, filenames, notebooks. LICENSE and NOTICE keep the upstream attribution a fork owes; the figures carry the old name in JPEG metadata a text sweep cannot reach.
13 KiB
module torus.ml.sklearn.glm
Implement sklearn's Generalized Linear Models (GLM).
class PoissonRegressor
A Poisson regression model with FHE.
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 PoissonRegressor please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.PoissonRegressor.html
method __init__
__init__(
n_bits: 'Union[int, dict]' = 8,
alpha: 'float' = 1.0,
fit_intercept: 'bool' = True,
solver='lbfgs',
max_iter: 'int' = 100,
tol: 'float' = 0.0001,
warm_start: 'bool' = False,
verbose: 'int' = 0
)
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
method get_sklearn_params
get_sklearn_params(deep: 'bool' = True) → dict
classmethod load_dict
load_dict(metadata: 'Dict')
method post_processing
post_processing(y_preds: 'ndarray') → ndarray
method predict
predict(
X: 'Data',
fhe: 'Union[FheMode, str]' = <FheMode.DISABLE: 'disable'>
) → ndarray
class GammaRegressor
A Gamma regression model with FHE.
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 GammaRegressor please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.GammaRegressor.html
method __init__
__init__(
n_bits: 'Union[int, dict]' = 8,
alpha: 'float' = 1.0,
fit_intercept: 'bool' = True,
solver='lbfgs',
max_iter: 'int' = 100,
tol: 'float' = 0.0001,
warm_start: 'bool' = False,
verbose: 'int' = 0
)
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
method get_sklearn_params
get_sklearn_params(deep: 'bool' = True) → dict
classmethod load_dict
load_dict(metadata: 'Dict')
method post_processing
post_processing(y_preds: 'ndarray') → ndarray
method predict
predict(
X: 'Data',
fhe: 'Union[FheMode, str]' = <FheMode.DISABLE: 'disable'>
) → ndarray
class TweedieRegressor
A Tweedie regression model with FHE.
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 TweedieRegressor please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.TweedieRegressor.html
method __init__
__init__(
n_bits: 'Union[int, dict]' = 8,
power: 'float' = 0.0,
alpha: 'float' = 1.0,
fit_intercept: 'bool' = True,
link: 'str' = 'auto',
solver='lbfgs',
max_iter: 'int' = 100,
tol: 'float' = 0.0001,
warm_start: 'bool' = False,
verbose: 'int' = 0
)
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
method get_sklearn_params
get_sklearn_params(deep: 'bool' = True) → dict
classmethod load_dict
load_dict(metadata: 'Dict')
method post_processing
post_processing(y_preds: 'ndarray') → ndarray
method predict
predict(
X: 'Data',
fhe: 'Union[FheMode, str]' = <FheMode.DISABLE: 'disable'>
) → ndarray