コード例 #1
0
def create_graph():
    """Create a graph which prints hello for each even number x in the input stream,
    using a conditional RuleBasedModel node and a HelloPrinter h1.Action."""
    graph = h1.Graph()
    graph.start()\
        .add(h1.Decision(RuleBasedModel(), result_field="predictions"))\
        .add(yes=HelloPrinter(), no=h1.NoOp())
    graph.end()
    return graph
コード例 #2
0
ファイル: graph.py プロジェクト: vmintam/h1st
def create_autocyber_graph():
    graph = h1.Graph()
    graph.start()\
        .add(WindowGenerator())\
        .add(h1.Decision(MsgFreqEventDetectorModel().load(), decision_field="WindowInAttack"))\
        .add(yes=GradientBoostingMsgClassifierModel().load(),
            no=NoOp())
    graph.end()
    return graph
コード例 #3
0
ファイル: AutoCyberTutorial.py プロジェクト: tvanh/h1st
m.train(data)

m.stats

# Don't run automatically this easily overwite latest version in AHT's computer,
# I need to use correct version in the tutorial notebooks
# m.persist()

from AutomotiveCybersecurity.graph import WindowGenerator

df = pd.read_csv(data["test_attack_files"][0])
df.columns = [
    'Timestamp', 'Label', 'CarSpeed', 'SteeringAngle', 'YawRate', 'Gx', 'Gy'
]

graph = h1.Graph()
graph.start()\
     .add(WindowGenerator())\
     .add(m)
graph.end()
results = graph.predict({"df": df})

results["event_detection_results"]

from AutomotiveCybersecurity.models.gradient_boosting_msg_classifier import GradientBoostingMsgClassifierModel

m2 = GradientBoostingMsgClassifierModel()
data = m2.load_data(20)
prepared_data = m2.prep_data(data)

m2.train(prepared_data)