In der Mess- und Prüftechnik PD Stefan Bosse
Universität Bremen - FB Mathematik und Informatik
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs -
Introduction to Dataflow Graph Architectures using the WorkBook
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
The entire data processing architecture can be mapped on a dataflow graph (DFG)
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
fn(→i):⎧⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪⎩→i→→oop1→i→→oop2....→i→→oopkpn(→i,σ):⎧⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪⎩→i×σ→→o×σop1→i×σ→→o×σop2....→i×σ→→o×σopkDFG(→x):→x→f1→f2→⎧⎪⎨⎪⎩f3,..f4,..f5,..→fm→→y
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
There are sequential and parallel data paths. An output port can be connected to multiple input ports → Data split. There are join nodes (demultiplexer or aggregators).
There is a separation of computation and communication.
Such DFG architectures can be easily parallelized and distributed (Web) using IP-based communication channels (e.g., using WebSockets)!
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
Data interface of a functional DFG node with input, output, and operational ports
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Machine learning
There is a object-oriented class library L that provides class constructor functions implementing DFG nodes.
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - WorkBook
The WorkBook is a Web browser application consisting of HTML/CSS content and JavaScript code.
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - WorkBook
There is a main button toolbar providing the core operations to compose, control, and exchange WorkBook projects (JSON data):
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Code Snippets
A code snippet is initially executed in the main JS loop. A code snippet consists basically of a code editor and an output console.
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Code Snippets
Control of a code snippet
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Code Snippets
A code snippet support to display modes:
To enable overlay mode, open the set-up menu and enter a value ≠ "false" in the overlay field (e.g., 1 or true) and flip the display mode with the field in the lower left corner (see previous figure).
The overlay view contains three basic buttions (Run code, stop backrgound tasks, and clear console) on the left side, import and export fields, and an optional parameter table on the right side.
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Code Snippets
A parameter table consists of key-value rows. The value can be changed by clicking in the cell. By right clicking a context menu can be opened.
p1
in the following example).Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Code Snippets
parameter { p1:'v1', _p1:['v1','v2','v3'], p2:0, p3:{a:1,b:2} }...parameter.p2=100;parameter._on = (key,val) => { print(key+' changed:'+val }if (p1=='v1') { .. }
Each time a parameter was changed (overlay mode activated and visible), the event handler will be called. The changed parameter can be forwarded to other functions.
The right-click context of each editable cell menu provides value choice lists, a generic text editor for comfortable editing of cell content, and a filesystem explorer to include file paths.
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Code Snippets
Parameter setting, import, and export statements in code snippets are not valid JS syntax (proprietary)!
import { a,b,c,d ..}var e,f,g,h,..export { e,f,g,h,.. }
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Class Library
To provide easy anc convenient access to nuemrical and ML modules, there is a class library providing:
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - Dataflow Graphs (DFG)
Example of a DFG composed of nodes generated by the class library
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
Actions provides (parameterizable) button events. The button event (via node output or action callback handler) can be connected to other nodes triggering the execution of a node method (normally preceded with a "~" character to avoid ambiguities with input port names)
import { Action, dataNode }var actionLoadData = new Action({ "label": "Load Data", "action": () => { status('Loading data table ...') }, arguments:['*'],})actionLoadData.output(dataNode,'~read') // === dataNode.read.apply(dataNode,arguments) == .read('*')
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
Currently only SQL access via sqld RPC is provided.
import {Data}var data = new Data("sql",{ "url": "localhost:9999", "database": "Iris", "table": "iris1"})await data.init()status(inspect(await data.info()))// data.read("*",index)// data.input("*",index)// data.output(node)
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
nodeA.output(nodeB,xindex?,yindex?)
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
Data can be represented in different formats (data types). Assuming data tables (columns represent the input feature and output target variables, rows represent different samples), there are two major formats:
[[]]
[{}]
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
A data splitter is used to create randomly selected partitions from the full data set, e.g., a data table. In ML, there is commonly a training set and a test set. The training set is only used for the model training process, the test set for evaluation of the model.
import {Split,dataNode}parameter {ratio:[0.5,0.5]}var splitData = new Split({ "input": "[{}]", "outputs": [ "train", "test" ], // "ratio": [0.5,0.5], "random": true, parameter:parameter,})dataNode.output(splitData)
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
Data transformation is used to convert between data formats and to apply normalization/scaling (optionally).
import {splitData, DataTransform, Print}var datatransformTrain = new DataTransform({ "input": "[{}]", "output": "{x:[[]],y:[]}", "attributes":["length","width","petal_length","petal_width"], "targets":["species"], "inputs": [ "x" ], "outputs": [ "x", "y" ], "filter": (a) => { return a }})splitData.output(datatransformTrain,null,'train')
Stefan Bosse - Maschinelles Lernen - WorkBook, WorkShell, and Dataflow Graphs - DFG Nodes
An ML model and its algorithms are parametrized. There are static and dynamic parameters. Static parameters define the structure of the model (e.g., layer of an ANN or the polynom degree of a function, or optimization parameters like the learning rate), and dynamic parameters are those that are optimized by the trainer algorithm. Parameters are set using a editable table and forwarded to the ML model implementation as data.
import {MLModelParam,mlmodelDT}parameter { features:["length","width"," petal_length","petal_width"], target:["species"], algorithm:"id3"}var mlparamDT = new MLModelParam("c45",{ "parameter": parameter, "display": false, "label": "C45/ID3"})mlparamDT.output(mlmodelDT,'params')