SWBlocks-DecisionTree

Software Blocks DecisionTree Library

License

License

Categories

Categories

Cassandra Data Databases
GroupId

GroupId

org.swblocks.decisiontree
ArtifactId

ArtifactId

persistence-cassandra
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

SWBlocks-DecisionTree
Software Blocks DecisionTree Library
Project URL

Project URL

https://github.com/jpmorganchase/swblocks-decisiontree
Source Code Management

Source Code Management

https://github.com/jpmorganchase/swblocks-decisiontree.git

Download persistence-cassandra

How to add to project

<!-- https://jarcasting.com/artifacts/org.swblocks.decisiontree/persistence-cassandra/ -->
<dependency>
    <groupId>org.swblocks.decisiontree</groupId>
    <artifactId>persistence-cassandra</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.swblocks.decisiontree/persistence-cassandra/
implementation 'org.swblocks.decisiontree:persistence-cassandra:1.1.0'
// https://jarcasting.com/artifacts/org.swblocks.decisiontree/persistence-cassandra/
implementation ("org.swblocks.decisiontree:persistence-cassandra:1.1.0")
'org.swblocks.decisiontree:persistence-cassandra:jar:1.1.0'
<dependency org="org.swblocks.decisiontree" name="persistence-cassandra" rev="1.1.0">
  <artifact name="persistence-cassandra" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.swblocks.decisiontree', module='persistence-cassandra', version='1.1.0')
)
libraryDependencies += "org.swblocks.decisiontree" % "persistence-cassandra" % "1.1.0"
[org.swblocks.decisiontree/persistence-cassandra "1.1.0"]

Dependencies

runtime (6)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.25
org.swblocks.decisiontree : core jar 1.1.0
org.swblocks.decisiontree : change jar 1.1.0
com.datastax.cassandra : cassandra-driver-core jar 3.1.1
com.datastax.cassandra : cassandra-driver-extras jar 3.1.0
com.google.guava : guava jar 18.0

Project Modules

There are no modules declared in this project.

License Build Status

swblocks-decisiontree

Overview

swblocks-decisiontree library is a high performance, highly flexible service which evaluates inputs to a set of rules to identify one and only one output rule which in term results in a set of outputs. It can be used to model complex conditional processing within an application.
Example:

Rule Input1: Day of week Input2: Outstanding Work Input3: Boss's mood Output 1: Leave Time Output2: After Work
1 Monday * * 5 pm Pick up children
2 * Low * 6:45 pm Go to gym
3 Thursday * Good 6:30 pm Go to pub
4 Friday * * 5 pm Party time
5 * * * 7 pm Go home
6 * * Angry 10 pm More work

The rules are evaluated based on the precedence of matched data from left to right. A matching value gives a 1 and a wildcard match a 0, the highest value is picked. In this example the employees life after work on certain days takes precedence over the boss. If the following input values are sent in:
Inputs: Day of Week: Monday, Outstanding Work: High, Boss's mood: Angry
This matches rules 1, 5 and 6. Rule 1 gives 100, Rule 5 gives 000 and Rule 6 gives 001, rule 1 is picked.
Output: Leave Time: 5pm, After Work: Pick up children

If the order of the columns are changed to make the Boss's mood higher importance, then this gives.

Rule Input1: Boss's Mode Input2: Outstanding Work Input3: Day of week Output 1: Leave Time Output2: After Work
1 * * Monday 5 pm Pick up children
2 * Low * 6:45 pm Go to gym
3 Good * Thursday 6:30 pm Go to pub
4 * * Friday 5 pm Party time
5 * * * 7 pm Go home
6 Angry * * 10 pm More work


If the same inputs are sent in:
Inputs: Day of Week: Monday, Outstanding Work: High, Boss's mood: Angry
This matches rules 1, 5 and 6. Rule 1 gives 001, Rule 5 gives 000 and Rule 6 gives 100, rule 6 is picked.
Output: Leave Time: 10pm, After Work: More work

### Data Types The Decision Tree supports a number of different types of definitions of data * Strings, the normal type inputs provide an exact match against the input. * Regular Expressions, standard regular expressions match against the input. * Groups, combinations of other all data types, including other groups matching any against the input. * Integer Ranges, matches any integer input within the range, inclusive at the minimum and exclusive at the maximum. * Date Ranges, matches any date within the range.

Structure of code

The code is in a multi-module structure project structure.

Core

The Core project contains the main algorithms for the tree building and construction.

Change

The Change project provides an API to modify a DecisionTree in an audited and controlled manor.

Persistence-json-jackson

A persistence module for writing and reading using a JSON structure and the Jackson JSON code.

Persistence-cassandra

A persistence module for writing and reading using Cassandra as a storage.

Examples

A set of example code to demonstrate usage of the DecisionTree.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See the LICENSE file for additional license information

Java Build

The project is built with Gradle using this build.gradle file.

You require the following to build swblocks-decisiontree:

Default target provides a full clean, build, and install into local maven repository

org.swblocks.decisiontree

J.P. Morgan Chase

Versions

Version
1.1.0
1.0.1