mirror of
https://github.com/luxfi/torus-ml.git
synced 2026-10-30 15:15:23 +00:00
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.
115 lines
3.4 KiB
Python
115 lines
3.4 KiB
Python
"""Tests lists of models in Torus ML."""
|
|
|
|
from torus.ml.pytest.utils import MODELS_AND_DATASETS, UNIQUE_MODELS_AND_DATASETS
|
|
from torus.ml.sklearn import (
|
|
_get_sklearn_all_models,
|
|
_get_sklearn_linear_models,
|
|
_get_sklearn_neighbors_models,
|
|
_get_sklearn_neural_net_models,
|
|
_get_sklearn_tree_models,
|
|
)
|
|
from torus.ml.sklearn.glm import GammaRegressor, PoissonRegressor, TweedieRegressor
|
|
from torus.ml.sklearn.linear_model import (
|
|
ElasticNet,
|
|
Lasso,
|
|
LinearRegression,
|
|
LogisticRegression,
|
|
Ridge,
|
|
SGDClassifier,
|
|
SGDRegressor,
|
|
)
|
|
from torus.ml.sklearn.neighbors import KNeighborsClassifier
|
|
from torus.ml.sklearn.qnn import NeuralNetClassifier, NeuralNetRegressor
|
|
from torus.ml.sklearn.rf import RandomForestClassifier, RandomForestRegressor
|
|
from torus.ml.sklearn.svm import LinearSVC, LinearSVR
|
|
from torus.ml.sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
|
from torus.ml.sklearn.xgb import XGBClassifier, XGBRegressor
|
|
|
|
|
|
def test_get_sklearn_models():
|
|
"""List all available models in Torus ML."""
|
|
all_models = _get_sklearn_all_models()
|
|
linear_models = _get_sklearn_linear_models()
|
|
tree_models = _get_sklearn_tree_models()
|
|
neural_network_models = _get_sklearn_neural_net_models()
|
|
neighbor_models = _get_sklearn_neighbors_models()
|
|
|
|
print("All models: ")
|
|
for m in all_models:
|
|
print(f" {m}")
|
|
|
|
print("Linear models: ")
|
|
for m in linear_models:
|
|
print(f" {m}")
|
|
|
|
print("Tree models: ")
|
|
for m in tree_models:
|
|
print(f" {m}")
|
|
|
|
print("Neural net models: ")
|
|
for m in neural_network_models:
|
|
print(f" {m}")
|
|
|
|
print("Neighbors models: ")
|
|
for m in neighbor_models:
|
|
print(f" {m}")
|
|
|
|
# Check values
|
|
expected_neural_network_models = {NeuralNetClassifier, NeuralNetRegressor}
|
|
assert (
|
|
set(neural_network_models) == expected_neural_network_models
|
|
), "Please change the expected number of models if neural network models have been added"
|
|
|
|
expected_tree_models = {
|
|
DecisionTreeClassifier,
|
|
DecisionTreeRegressor,
|
|
RandomForestClassifier,
|
|
RandomForestRegressor,
|
|
XGBClassifier,
|
|
XGBRegressor,
|
|
}
|
|
assert (
|
|
set(tree_models) == expected_tree_models
|
|
), "Please change the expected number of tree models if new models have been added"
|
|
|
|
expected_linear_models = {
|
|
ElasticNet,
|
|
GammaRegressor,
|
|
Lasso,
|
|
LinearRegression,
|
|
LinearSVC,
|
|
LinearSVR,
|
|
LogisticRegression,
|
|
PoissonRegressor,
|
|
Ridge,
|
|
SGDRegressor,
|
|
SGDClassifier,
|
|
TweedieRegressor,
|
|
}
|
|
|
|
assert (
|
|
set(linear_models) == expected_linear_models
|
|
), "Please change the expected number of linear models if new models have been added"
|
|
|
|
expected_neighbor_models = {KNeighborsClassifier}
|
|
|
|
# Check number
|
|
expected = set(all_models)
|
|
obtained = (
|
|
expected_linear_models
|
|
| expected_tree_models
|
|
| expected_neural_network_models
|
|
| expected_neighbor_models
|
|
)
|
|
assert expected == obtained, (
|
|
"Please change the expected number of models if new models have been added\n"
|
|
f"Missing: {expected ^ obtained}"
|
|
)
|
|
|
|
|
|
def test_models_and_datasets():
|
|
"""Check that the tested model's configuration lists remain fixed."""
|
|
|
|
assert len(MODELS_AND_DATASETS) == 34
|
|
assert len(UNIQUE_MODELS_AND_DATASETS) == 22
|