pypi lofo-importance 0.4.0
v0.4.0

2 hours ago

v0.4.0

Modernizes lofo-importance with PEP 621 packaging, leaner core dependencies, joblib-based parallelism, Rich table output, full type annotations, and improved default model inference (#67).

Highlights & New Features

  • Rich summary table in plot_importance: Added kind="table" to render a color-coded Rich table with mean ± std importance and per-fold min / med / max summaries. plot_importance now also returns the created Matplotlib Axes or Rich Table.
  • joblib parallelism: Replaced the custom multiprocessing.Pool/Queue implementation with joblib.Parallel, adding support for n_jobs=-1 (all CPUs) in both LOFOImportance and FLOFOImportance.
  • Deterministic parallel FLOFO: FLOFOImportance.get_importance now derives per-feature random seeds from random_state and avoids shared DataFrame mutation, making parallel and sequential runs produce matching results.
  • Improved default model inference: infer_model now uses sklearn.utils.multiclass.type_of_target to detect both binary and multiclass classification targets (string/categorical targets and low-cardinality integer targets) while keeping high-cardinality integer targets as regression. Default LightGBM models now use verbose=-1 and guard min_child_samples to be at least 1.
  • Full type annotations (PEP 561): Added type hints across the codebase, exported __all__ and lofo.__version__, and included lofo/py.typed.

Packaging & Dependencies

  • Migrated to pyproject.toml: Replaced setup.py, requirements.txt, and MANIFEST.in with PEP 621 metadata in pyproject.toml.
  • Removed networkx dependency: Replaced networkx connected components in Dataset auto-grouping with scipy.sparse.csgraph.connected_components.
  • Optional extras ([all] and [dev]): Moved lightgbm, matplotlib, and rich to optional dependencies with clear ImportError messages if missing:
    pip install lofo-importance          # core dependencies only
    pip install "lofo-importance[all]"   # includes lightgbm, matplotlib, rich

Improvements & Fixes

  • Matplotlib compatibility: Updated plot_importance(..., kind="box") to adapt to newer Matplotlib boxplot parameter names (orientation / tick_labels vs vert / labels).
  • Deterministic feature ordering: Dataset now preserves input order for ungrouped features and returns sorted lists when auto_group_threshold=0.0.
  • Consistent sparse output: Dataset.getX converts horizontally stacked sparse feature groups to csr_matrix (.tocsr()).
  • More specific exceptions: Replaced generic Exception raises with TypeError and ValueError in Dataset and FLOFOImportance.
  • Docs & tests: Updated README.md, LOFOImportance Example.ipynb, and CI workflow; added test coverage for plotting, multiclass inference, missing LightGBM errors, n_jobs=-1, and parallel FLOFO equivalence.

Migration Notes

  • Python 3.9+ required: Minimum supported Python version is now 3.9 (tested up to 3.13).
  • lightgbm is no longer installed by default: If you rely on the default LightGBM model (model=None) or plot_importance, install pip install "lofo-importance[all]" (or install lightgbm / matplotlib / rich individually).

Don't miss a new lofo-importance release

NewReleases is sending notifications on new releases.