18
Spark Streaming and Expert Systems James Nowell 24 May 2016

Spark Streaming and Expert Systems

Embed Size (px)

Citation preview

Page 1: Spark Streaming and Expert Systems

Spark Streaming andExpert Systems

James Nowell24 May 2016

Page 2: Spark Streaming and Expert Systems

The Problem

Expert Systems

Where Spark Fits

Overview

2

Page 3: Spark Streaming and Expert Systems

THE PROBLEM

3

Page 4: Spark Streaming and Expert Systems

Basic IoT devices don’t have much state Inferences can be made with regular conditionals

Simple Streams

4

tizen365.com

Page 5: Spark Streaming and Expert Systems

Multiple sensors Multiple streams

(sensor fusion!) Partial data Bad data Human entered data

Complex Streams

5

http://www.record-eagle.com/news/lifestyles/traverse-city-s-ice-road-trucker/article_8cb844bd-b613-586d-b7a0-974789984e1d.html

Page 6: Spark Streaming and Expert Systems

EXPERT SYSTEMS

6

Page 7: Spark Streaming and Expert Systems

AKA Production Systems, Rule Engines, Inference System CLIPS, Drools Turn a domain expert into code

Mostly deterministicTasks that are simple or procedural for an expert

Fact based reasoningIf TheseFacts then NewFacts

Rete Algorithm

What is an Expert System?

7

Page 8: Spark Streaming and Expert Systems

Determine the time for the current state

In Practice: Is it moving?

8

Page 9: Spark Streaming and Expert Systems

Calculate some basic movement information

In Practice: Is it moving?

9

Page 10: Spark Streaming and Expert Systems

Decide the truck didn’t become a space shipThe converse is also asserted elsewhere

In Practice: Is it moving?

10

Page 11: Spark Streaming and Expert Systems

Yep, the truck seems to be moving

In Practice: Is it moving?

11

Page 12: Spark Streaming and Expert Systems

Assert that the thing is, in fact, moving

In Practice: Is it moving?

12

Page 13: Spark Streaming and Expert Systems

WHERE SPARK FITS

13

Page 14: Spark Streaming and Expert Systems

Load the statePersistence mechanism varies

Generate a new state with the rules Emit events with the rules

Events are often based on state transitionsSettle the new state first

Persist it allUse a journal model

In an RDD

14

Page 15: Spark Streaming and Expert Systems

Parallelism App structure similar to any other streaming app Batch is extremely similar to streaming

THE reason to use SparkReprocess your entire corpus with the same code you use for new data

What Spark Buys Us

15

Page 16: Spark Streaming and Expert Systems

Build the rules at compile timekie-maven-plugin

Maximize condition reuse Use flag events to kill loops and aid debugging Write unit tests

LotsAnd lotsAnd lotsOf unit tests

Write fully fledged “Thing” tests

Things to Know

16

Page 17: Spark Streaming and Expert Systems

QUESTIONS?

17

Page 18: Spark Streaming and Expert Systems