summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lib/functions.py40
2 files changed, 23 insertions, 18 deletions
diff --git a/README.md b/README.md
index 3e2633d..b547471 100644
--- a/README.md
+++ b/README.md
@@ -34,3 +34,4 @@ The following variables may be set to alter the behaviour of dfatool components.
| `DFATOOL_KCONF_WITH_CHOICE_NODES` | 0, **1** | Generate enum parameters from kconfig choice nodes; ignore corresponding boolean config options. |
| `DFATOOL_KCONF_IGNORE_NUMERIC` | **0**, 1 | Ignore numeric (int/hex) configuration options. Useful for comparison with CART/DECART. |
| `DFATOOL_KCONF_IGNORE_STRING` | **0**, 1 | Ignore string configuration options. Useful for comparison with CART/DECART. |
+| `DFATOOL_FIT_LINEAR_ONLY` | **0**, 1 | Only consider linear functions (a + bx) in regression analysis. Useful for comparison with Linear Model Trees / M5. |
diff --git a/lib/functions.py b/lib/functions.py
index 86025dc..7cd06c0 100644
--- a/lib/functions.py
+++ b/lib/functions.py
@@ -8,6 +8,7 @@ regression and general handling of model functions.
from itertools import chain, combinations
import logging
import numpy as np
+import os
import re
from scipy import optimize
from .utils import is_numeric
@@ -719,24 +720,24 @@ class analytic:
lambda model_param: model_param >= 0,
2,
),
- "num0_8": ParamFunction(
- lambda reg_param, model_param: reg_param[0]
- + reg_param[1] * analytic._num0_8(model_param),
- lambda model_param: True,
- 2,
- ),
- "num0_16": ParamFunction(
- lambda reg_param, model_param: reg_param[0]
- + reg_param[1] * analytic._num0_16(model_param),
- lambda model_param: True,
- 2,
- ),
- "num1": ParamFunction(
- lambda reg_param, model_param: reg_param[0]
- + reg_param[1] * analytic._num1(model_param),
- lambda model_param: True,
- 2,
- ),
+ # "num0_8": ParamFunction(
+ # lambda reg_param, model_param: reg_param[0]
+ # + reg_param[1] * analytic._num0_8(model_param),
+ # lambda model_param: True,
+ # 2,
+ # ),
+ # "num0_16": ParamFunction(
+ # lambda reg_param, model_param: reg_param[0]
+ # + reg_param[1] * analytic._num0_16(model_param),
+ # lambda model_param: True,
+ # 2,
+ # ),
+ # "num1": ParamFunction(
+ # lambda reg_param, model_param: reg_param[0]
+ # + reg_param[1] * analytic._num1(model_param),
+ # lambda model_param: True,
+ # 2,
+ # ),
}
if safe_functions_enabled:
@@ -759,6 +760,9 @@ class analytic:
2,
)
+ if bool(int(os.getenv("DFATOOL_FIT_LINEAR_ONLY", "0"))):
+ functions = {"linear": functions["linear"]}
+
return functions
@staticmethod