mlxtend Documentation

repository·master·Indexed 26 days ago

https://github.com/rasbt/mlxtend

A Python library providing machine learning extensions for data science tasks. It includes tools for ensemble methods (such as EnsembleVoteClassifier), feature selection, visualization utilities (like plot_decision_regions), frequent pattern mining, and various classifiers, regressors, and preprocessing tools.

Tokens
31.7K
Snippets
78
Records
131
Agent score
89%

What's inside mlxtend

  1. Explore mlxtend User Guides by Module

    master

    The mlxtend library provides comprehensive user guides organized by functional modules. You can find detailed documentation and usage examples for the following categories:

    • classifier: Machine learning classifiers including Adaline, EnsembleVoteClassifier, LogisticRegression, MultiLayerPerceptron, OneRClassifier, Perceptron, SoftmaxRegression, StackingClassifier, and StackingCVClassifier.
    • cluster: Clustering algorithms like Kmeans.
    • data: Example datasets such as iris_data, mnist_data, wine_data, boston_housing_data, and autompg_data.
    • evaluate: Model evaluation metrics and techniques including accuracy_score, confusion_matrix, permutation_test, bootstrap methods, and various statistical tests (e.g., mcnemar, ftest).
    • feature_extraction: Dimensionality reduction techniques like PrincipalComponentAnalysis (PCA) and LinearDiscriminantAnalysis (LDA).
    • feature_selection: Methods to select relevant features using ExhaustiveFeatureSelector or SequentialFeatureSelector.
    • frequent_patterns: Association rule mining tools like apriori, fpgrowth, and association_rules.
    • plotting: Visualization utilities for data science, including plot_decision_regions, plot_confusion_matrix, heatmap, and scatterplotmatrix.
    • preprocessing: Data transformation tools such as minmax_scaling, standardize, one-hot_encoding, and TransactionEncoder.
    • regressor: Regression models including LinearRegression and stacking regressors.
    • text: Text processing utilities like tokenizer.
    • math & utils: Mathematical helpers and general utility functions.
  2. Set up pre-commit hooks for automatic styling

    master

    The recommended way to maintain code style is to use pre-commit hooks. These will automatically run flake8, black, and isort whenever you attempt a git commit.

    1. Install development dependencies: uv sync --group dev.
    2. Install the hooks: uv run --group dev python -m pre_commit install (run this once per environment).
    uv sync --group dev
    uv run --group dev python -m pre_commit install
  3. Check and fix code style manually

    master

    To ensure your code adheres to the project's style guidelines (flake8, black, and isort) before pushing, you can run the tools manually using uv.

    1. Linting with flake8: Check for style issues.
    2. Formatting with black: Automatically format your code.
    3. Sorting imports with isort: Sort imports alphabetically using the project-specific profile.
  4. Install mlxtend using uv

    master

    To add mlxtend to a project managed by uv, use the uv add command. For a quick verification without modifying your project environment, you can use uv run with the --with flag.

    uv add mlxtend
    
    # To run a one-off command without changing your project:
    uv run --with mlxtend python -c "import mlxtend; print(mlxtend.__version__)"