Subject of the issue
When a detector calls stack() on another detector's serialized state, it overwrites its own learned data with the peer's instead of merging the two
from_binary returns None, which gets compared to a detector instance, so the error is:
IncompatibleFed Instances are incompatible
Your environment
0.5.3
Steps to reproduce
# stack() on another detectors to_binary() output overwrites the local detector's state and then raises.
# using detectmatelibrary 0.5.3
import detectmatelibrary.schemas as schemas
from detectmatelibrary.detectors.new_value_detector import NewValueDetector
CONFIG = {"detectors": {"NewValueDetector": {
"method_type": "new_value_detector",
"auto_config": False,
"params": {},
"events": {1: {"i": {"params": {},
"variables": [{"pos": 0, "name": "user", "params": {}}]}}},
}}}
def train(*users):
d = NewValueDetector(config=CONFIG)
for u in users:
d.train(schemas.ParserSchema({
"parserType": "t", "EventID": 1, "template": "t", "variables": [u],
"logID": "1", "parsedLogID": "1", "parserID": "p", "log": "l",
"logFormatVariables": {},
}))
return d
a = train("A", "B")
b = train("C", "D")
print("A:", a.persistency.get_event_data(1)["user"].unique_set)
print("B:", b.persistency.get_event_data(1)["user"].unique_set)
try:
a.stack(b.to_binary())
except Exception as e:
print("raised:", type(e).__name__, e)
print("A after:", a.persistency.get_event_data(1)["user"].unique_set, ", expected ['A', 'B', 'C', 'D']")
output:
A: {'B', 'A}
B: {'D', 'C'}
raised: IncompatibleFed Instances are incompatible
A after: {'D, 'C'} -- expected ['A', 'B', 'C', 'D']
Expected behaviour
state should not be overwritten but merged?
Actual behaviour
Tell us what happens instead
Subject of the issue
When a detector calls stack() on another detector's serialized state, it overwrites its own learned data with the peer's instead of merging the two
from_binary returns None, which gets compared to a detector instance, so the error is:
IncompatibleFed Instances are incompatible
Your environment
0.5.3
Steps to reproduce
output:
Expected behaviour
state should not be overwritten but merged?
Actual behaviour
Tell us what happens instead