6.5 KiB
module torus.ml.sklearn.rf
Implement RandomForest models.
class RandomForestClassifier
Implements the RandomForest classifier.
method __init__
__init__(
n_bits: Union[int, Dict[str, int]] = 6,
n_estimators=20,
criterion='gini',
max_depth=4,
min_samples_split=2,
min_samples_leaf=1,
min_weight_fraction_leaf=0.0,
max_features='sqrt',
max_leaf_nodes=None,
min_impurity_decrease=0.0,
bootstrap=True,
oob_score=False,
n_jobs=None,
random_state=None,
verbose=0,
warm_start=False,
class_weight=None,
ccp_alpha=0.0,
max_samples=None,
monotonic_cst=None
)
Initialize the RandomForestClassifier.
noqa: DAR101
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)
method post_processing
post_processing(y_preds: ndarray) → ndarray
class RandomForestRegressor
Implements the RandomForest regressor.
method __init__
__init__(
n_bits: Union[int, Dict[str, int]] = 6,
n_estimators=20,
criterion='squared_error',
max_depth=4,
min_samples_split=2,
min_samples_leaf=1,
min_weight_fraction_leaf=0.0,
max_features=1.0,
max_leaf_nodes=None,
min_impurity_decrease=0.0,
bootstrap=True,
oob_score=False,
n_jobs=None,
random_state=None,
verbose=0,
warm_start=False,
ccp_alpha=0.0,
max_samples=None,
monotonic_cst=None
)
Initialize the RandomForestRegressor.
noqa: DAR101
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)