RuleFit is a predictive modeling algorithm that generates a sparse linear model by combining two distinct feature types: the original input features and a set of binary rules extracted from the nodes of an ensemble of decision trees. The algorithm first trains a tree ensemble, such as a gradient boosted tree or random forest, and then decomposes each tree into a collection of conjunctive rules representing paths from the root to a leaf. These rules, along with the original features, become inputs to a LASSO-regularized linear model, which automatically selects the most predictive rules while shrinking irrelevant coefficients to zero.
Glossary
RuleFit

What is RuleFit?
RuleFit is an algorithm that creates a sparse linear model combining simple, interpretable rules generated from decision trees with original features to provide both predictive accuracy and model transparency.
The resulting model balances the high accuracy of tree ensembles with the intrinsic interpretability of a linear model. Each selected rule is a human-readable conditional statement, such as 'transaction_amount > 10,000 AND account_age < 30 days,' making it ideal for generating adverse action reason codes in regulated financial fraud detection. By controlling the sparsity penalty, compliance officers can tune the trade-off between model complexity and explainability, ensuring that anomaly scores are auditable and justifiable to regulators while maintaining robust detection of sophisticated fraud patterns.
Key Features of RuleFit
RuleFit creates a sparse linear model that combines tree-derived decision rules with original features, balancing predictive accuracy with full model transparency for high-stakes fraud detection.
Sparse Linear Combination
RuleFit constructs a generalized linear model where the predictors are both the original input features and a set of binary rule indicators extracted from decision tree ensembles. The model applies L1 (Lasso) regularization during training, which drives many coefficients to exactly zero. This produces a sparse final model—typically retaining only 15-50 of the most predictive rules and features—making the entire decision function auditable without sacrificing the non-linear pattern detection of tree-based methods.
Tree-Derived Rule Generation
Rules are harvested from an ensemble of gradient boosted trees or random forests. Each node in a tree translates to a conjunctive rule:
- Rule format: IF (feature_A <= threshold) AND (feature_B > value) THEN rule_fires = 1
- Rule depth: Typically limited to 2-4 splits to maintain interpretability
- Rule diversity: Hundreds of candidate rules are generated, then the Lasso selects only the most globally predictive subset This approach captures non-linear interactions and threshold effects that linear models alone miss.
Feature Importance Ranking
Because the final model is a linear combination, the absolute coefficient value of each rule or feature directly quantifies its contribution to the prediction. This provides:
- Global importance: Which rules and features matter most across all predictions
- Local importance: For any single transaction, the fired rules with non-zero coefficients explain exactly why a specific score was assigned
- Directionality: Positive coefficients push toward fraud, negative toward legitimate This eliminates the need for post-hoc explanation tools like SHAP or LIME for the final model.
Winzorization of Feature Inputs
To handle outlier transactions common in financial data, RuleFit applies winsorization to original features before rule generation. Extreme values beyond specified percentiles (e.g., 1st and 99th) are capped rather than removed. This prevents:
- Rule fragmentation: Outliers creating overly specific, low-coverage rules
- Coefficient instability: Single extreme transactions distorting the Lasso penalty
- Overfitting: The model memorizing rare anomalies instead of learning generalizable fraud patterns
Interaction Detection Without Specification
Unlike traditional regression where interaction terms must be explicitly engineered, RuleFit automatically discovers feature interactions through the tree ensemble. A single rule like IF (transaction_amount > $10,000) AND (account_age_days < 30) captures a two-way interaction. The Lasso then selects only the interactions that improve predictive performance. This is critical for fraud detection where contextual anomalies—combinations of otherwise normal values—are the primary signal.
Base Learner Integration
The final model includes both rule terms and linear terms for original features, allowing it to:
- Capture non-linearities through rules derived from tree splits
- Retain linear relationships where a simple monotonic effect exists (e.g., higher transaction amount linearly increases risk)
- Handle mixed signal types: Rules excel at threshold-based categorical patterns; linear terms handle continuous gradients This dual representation ensures the model is neither unnecessarily complex where a linear relationship suffices nor blind to interactions where they matter.
Frequently Asked Questions
Clear, technical answers to the most common questions about the RuleFit algorithm, its mechanics, and its role in building transparent, high-performance fraud detection models.
RuleFit is a predictive modeling algorithm that creates a sparse linear model combining two component types: a set of simple, interpretable decision rules extracted from tree ensembles, and the original raw input features. It works in two stages. First, a tree ensemble (typically a gradient boosted tree model) is trained to capture complex, non-linear relationships and interactions. From this ensemble, a large number of candidate rules are generated by traversing paths from the root to terminal nodes. Second, a sparse linear model (often Lasso or L1-regularized logistic regression) is fit on a feature matrix that includes both the original features and the binary rule features. The L1 regularization automatically selects the most predictive rules and features, driving most coefficients to zero. The final model is a weighted sum of the surviving rules and linear terms, making it both accurate and interpretable.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core techniques that make complex fraud detection models transparent and auditable, enabling compliance and trust in high-stakes financial decisions.
SHAP (SHapley Additive exPlanations)
A game-theoretic framework that assigns each feature an importance value for a particular prediction. SHAP values unify several attribution methods to explain any model's output.
- Key Benefit: Consistent and theoretically grounded feature attribution.
- Fraud Use Case: Explains exactly why a specific transaction was flagged by quantifying the contribution of features like transaction amount, time, and device ID.
- Relation to RuleFit: Both provide interpretable output, but SHAP is a post-hoc method for black-box models, while RuleFit generates an inherently interpretable sparse linear model of rules.
LIME (Local Interpretable Model-agnostic Explanations)
A technique that explains any classifier's prediction by approximating it locally with an interpretable surrogate model (e.g., a linear model) around a specific prediction.
- Mechanism: Perturbs the input instance, observes prediction changes, and fits a simple, explainable model to the local neighborhood.
- Fraud Use Case: Generates human-readable explanations for a single high-risk transaction, showing which features pushed it over the threshold.
- Contrast with RuleFit: LIME provides local fidelity for a single instance; RuleFit provides a global, sparse linear model combining rules and original features.
Explainable Boosting Machine (EBM)
A glass-box model that learns interpretable feature functions for each input using cyclic gradient boosting. EBM predictions are exact, modular, and human-readable.
- Key Property: The contribution of each feature is an additive shape function that can be plotted and inspected independently.
- Fraud Use Case: Provides a fully auditable model where compliance officers can see the exact effect of a velocity check or a beneficiary mismatch on the final risk score.
- Synergy with RuleFit: Both are inherently interpretable, additive models. RuleFit uses tree-derived rules as features; EBM learns smooth functions per feature.
Counterfactual Explanations
A method that explains a model's decision by identifying the minimal changes to an input instance's features that would alter the prediction to a desired outcome.
- Example: 'If the transaction amount were $200 lower and the device was previously authenticated, the transaction would not have been flagged.'
- Fraud Use Case: Provides actionable guidance to customers or investigators on how to remediate a blocked transaction.
- Complement to RuleFit: RuleFit's rules define the decision boundary; counterfactuals show the shortest path across that boundary.
Partial Dependence Plots (PDP)
A global, model-agnostic visualization showing the marginal effect of one or two features on the predicted outcome, averaged over all other features.
- Insight Provided: Reveals the direction and shape of a feature's relationship with the target (e.g., linear, monotonic, non-linear).
- Fraud Use Case: Visualizes how the probability of fraud changes as the transaction amount increases, holding all else constant on average.
- Limitation: Can be misleading when features are highly correlated, a problem addressed by Accumulated Local Effects (ALE) plots.
Permutation Feature Importance
A model inspection technique that measures the decrease in model performance when a single feature's values are randomly shuffled, breaking its relationship with the target.
- Interpretation: A large drop in performance indicates high importance; no drop suggests the feature is not used by the model.
- Fraud Use Case: Identifies which signals (e.g., IP geolocation, transaction velocity) are most critical for the model's detection accuracy.
- Contrast with RuleFit: RuleFit performs automatic feature selection via LASSO regularization, while permutation importance is a post-hoc analysis tool.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us