Overview
The develop module provides debug and development utilities for the InterpretML package, including functions for enabling debug mode, collecting system diagnostics, configuring logging, and managing internal development options.
Description
This module serves as the development/debugging interface for the InterpretML package:
- debug_mode: Activates package-wide debug mode. It registers a log file, writes system diagnostics, and loads native libraries in debug mode. Can only be called once per session.
- register_log: Registers a logging handler that writes to a file or stream (such as
sys.stderr or sys.stdout). Uses WatchedFileHandler for file-based logging with a formatted output including timestamp, filename, line number, and function name.
- debug_info: Collects comprehensive debug information including the package version, show server status, static system info, and dynamic system info. Returns a dictionary.
- print_debug_info: Pretty-prints the debug information dictionary as formatted JSON.
- static_system_info: Gathers machine architecture, OS version, Python version, CPU count, and memory totals using the
platform and psutil packages.
- dynamic_system_info: Gathers runtime metrics including CPU utilization, CPU frequency, virtual memory usage, and swap memory usage.
- get_option / set_option: Get and set internal development options stored in the
_develop_options dictionary. These options control advanced EBM training behavior such as intercept rounds, learning rate scaling, categorical handling, acceleration flags, and boosting options.
Usage
Use debug_mode when diagnosing issues with InterpretML or when the package authors request diagnostic information. Use register_log to capture detailed logs during model training. Use get_option/set_option for advanced tuning of internal EBM development parameters (not recommended for general use).
Code Reference
Source Location
Signature
def debug_mode(log_filename="log.txt", log_level="INFO", native_debug=True):
def register_log(filename, level="DEBUG"):
def debug_info():
def print_debug_info(file=None):
def static_system_info():
def dynamic_system_info():
def get_option(name):
def set_option(name, value):
Import
from interpret.develop import debug_mode, register_log, debug_info, print_debug_info
from interpret.develop import get_option, set_option
I/O Contract
debug_mode
| Name |
Type |
Required |
Description
|
| log_filename |
str or stream |
No |
Filepath to log to, or sys.stderr/sys.stdout (default "log.txt")
|
| log_level |
str |
No |
Logging level such as "INFO" or "DEBUG" (default "INFO")
|
| native_debug |
bool |
No |
Whether to load debug versions of native libraries (default True)
|
| Name |
Type |
Description
|
| handler |
logging.Handler |
The logging handler that was registered
|
register_log
| Name |
Type |
Required |
Description
|
| filename |
str or stream |
Yes |
Filepath to log to, or sys.stderr/sys.stdout
|
| level |
str |
No |
Logging level (default "DEBUG")
|
| Name |
Type |
Description
|
| handler |
logging.Handler |
The logging handler that was registered
|
debug_info
| Name |
Type |
Description
|
| debug_dict |
dict |
Dictionary containing version, server status, static and dynamic system info
|
get_option / set_option
| Name |
Type |
Required |
Description
|
| name |
str |
Yes |
Name of the development option
|
| value |
varies |
Yes (set_option only) |
Value to set for the option
|
Development Options
The module exposes the following internal options via get_option/set_option:
| Option |
Default |
Description
|
| n_intercept_rounds_initial |
25 |
Initial intercept calibration rounds
|
| n_intercept_rounds_final |
100 |
Final intercept calibration rounds
|
| intercept_learning_rate |
0.25 |
Learning rate for intercept updates
|
| cat_l2 |
0.0 |
L2 regularization for categorical features
|
| learning_rate_scale |
1.0 |
Scaling factor for the learning rate
|
| allow_float_interactions |
False |
Whether to allow floating-point interaction terms
|
| purify_boosting |
False |
Whether to purify during boosting
|
| purify_result |
False |
Whether to purify the final result
|
| randomize_initial_feature_order |
True |
Randomize initial feature ordering
|
| randomize_greedy_feature_order |
True |
Randomize feature order during greedy selection
|
Usage Examples
Enable Debug Mode
from interpret.develop import debug_mode
handler = debug_mode(log_filename="interpret_debug.txt", log_level="DEBUG")
Print System Diagnostics
from interpret.develop import print_debug_info
print_debug_info()
Register Custom Log Handler
import sys
from interpret.develop import register_log
handler = register_log(sys.stderr, level="INFO")
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.