API: ML & importance
MLModels
NEExT.ml_models.MLModels trains and evaluates a model on graph embeddings. The
framework’s train_ml_model wraps it; use the class directly for
extra control over model_name and test_size.
MLModels(
graph_collection,
embeddings,
model_type="classifier", # "classifier" | "regressor"
model_name="xgboost", # "xgboost" | "random_forest"
balance_dataset=False,
compute_feature_importance=False,
sample_size=5,
test_size=0.3,
random_state=42,
n_jobs=-1,
parallel_backend="process", # "process" | "thread"
)
compute() -> dict # metric lists, e.g. {"accuracy": [...]} or {"rmse": [...]} XGBoost is used when available, otherwise scikit-learn’s random forest. See ML models.
FeatureImportance
NEExT.ml_models.FeatureImportance ranks structural features. The framework’s
compute_feature_importance wraps it (passing n_iterations as the
internal sample_size).
FeatureImportance(
graph_collection,
features,
algorithm, # "supervised_greedy" | "supervised_fast" | "unsupervised"
embedding_algorithm="approx_wasserstein",
random_state=42,
n_iterations=5,
n_jobs=-1,
parallel_backend="process",
)
compute() -> pandas.DataFrame See Feature importance.