{"id":10205,"library":"rusket","title":"Rusket","description":"Rusket is an ultra-fast Python library designed for building recommender engines (collaborative filtering) and performing market basket analysis (association rules). It leverages Rust for its core computational logic, offering significant performance advantages, especially with large datasets. The current version is 0.1.90, and it is under active development with a focus on speed and efficiency.","status":"active","version":"0.1.90","language":"en","source_language":"en","source_url":"https://github.com/bmsuisse/rusket.git","tags":["recommender-systems","market-basket-analysis","rust","performance","data-science","machine-learning"],"install":[{"cmd":"pip install rusket","lang":"bash","label":"Install Rusket"}],"dependencies":[],"imports":[{"symbol":"Recommender","correct":"from rusket import Recommender"},{"symbol":"MarketBasketAnalyzer","correct":"from rusket import MarketBasketAnalyzer"}],"quickstart":{"code":"import pandas as pd\nfrom rusket import MarketBasketAnalyzer\n\n# Sample transactional data for Market Basket Analysis\ndata = {\n    'transaction_id': [1, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6],\n    'item_id': ['Apple', 'Banana', 'Orange', 'Apple', 'Grape', 'Banana', 'Orange', 'Apple', 'Banana', 'Grape', 'Milk', 'Bread', 'Eggs', 'Milk', 'Cheese', 'Butter']\n}\ndf = pd.DataFrame(data)\n\n# Initialize and fit the Market Basket Analyzer\n# Lower min_support/min_confidence for small sample data to ensure rules are found\nmba = MarketBasketAnalyzer(min_support=0.01, min_confidence=0.01)\n\nmba.fit(df, transaction_col='transaction_id', item_col='item_id')\n\n# Get association rules\nrules = mba.get_rules()\nprint(\"Generated Association Rules (first 5):\")\nif not rules.empty:\n    print(rules.head())\nelse:\n    print(\"No rules found. Try adjusting min_support or min_confidence.\")","lang":"python","description":"This example demonstrates how to use `MarketBasketAnalyzer` to find association rules from a pandas DataFrame of transactional data. It initializes the analyzer, fits it to the data using specified transaction and item columns, and then retrieves the generated rules."},"warnings":[{"fix":"Always pin to specific minor versions (`rusket==0.1.90`) in production environments and review release notes carefully when upgrading.","message":"As Rusket is currently in early development (version 0.1.x), its API is subject to change without strict backward compatibility guarantees. Expect potential breaking changes between minor versions (e.g., 0.1.x to 0.2.x) until a stable 1.0 release.","severity":"breaking","affected_versions":"All versions < 1.0.0"},{"fix":"Ensure your DataFrame columns match the `transaction_col`/`user_col` and `item_col` arguments provided to the `fit` method. For best performance, ensure data types are optimized (e.g., integers for IDs).","message":"Rusket requires input data as a pandas DataFrame with explicitly named columns for transaction/user and item IDs. Incorrect column names or data types will lead to errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the official GitHub repository for common issues or open a new issue with a minimal reproducible example if you suspect a Rust-level problem. Ensure your system meets the basic requirements for Rust binaries (e.g., up-to-date glibc on Linux).","message":"While Rusket provides Pythonic interfaces, its core logic is implemented in Rust. If you encounter unexpected performance issues or unhandled exceptions that aren't typical Python errors, it might be related to the underlying Rust implementation. Error messages might sometimes be less verbose than pure Python errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure you have activated the correct virtual environment (if any) and run `pip install rusket`.","cause":"The `rusket` library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'rusket'"},{"fix":"Verify that the column names in your DataFrame exactly match the strings passed to the `transaction_col`, `item_col`, or `user_col` arguments in the `fit` method. Use `df.columns` to inspect available columns.","cause":"The column name specified for `transaction_col` (or `item_col`, `user_col`) does not exist in the input pandas DataFrame.","error":"ValueError: transaction_col 'wrong_transaction_id' not found in DataFrame."},{"fix":"Reduce the values for `min_support` and/or `min_confidence` when initializing `MarketBasketAnalyzer`. For very small datasets, these values might need to be very low (e.g., 0.01 for both).","cause":"This is not an error but a common message when `MarketBasketAnalyzer.get_rules()` returns an empty DataFrame. It indicates that no itemsets met the specified `min_support` and `min_confidence` thresholds in your dataset, likely due to a sparse dataset or too-high thresholds.","error":"No association rules found. Try lowering min_support or min_confidence."}]}