Machine Learning: Das Ende der Businesslogik?



Softwarearchitektur Meetup, Hamburg, Januar 2019

Oliver Zeigermann / @DJCordhose / embarc GmbH

http://bit.ly/hh-arch-ml

Programmer's approach: Code Rules by Hand


if age < 25:
    if speed > 140:
        return red # young people, fast cars: high risk
    else:
        return yellow # young people: medium risk
            

if age > 75:
    return red # old people: high risk
            

if miles_per_year > 30:
    return red # a lot of driving: high risk
if miles_per_year > 20:
    return yellow #  a bit of driving: medium risk
            

return green # otherwise: low risk
            

https://colab.research.google.com/github/djcordhose/ai/blob/master/notebooks/sklearn/classic-code.ipynb

Different Approach




  • 0 - red: many accidents
  • 1 - green: few or no accidents
  • 2 - yellow: in the middle

Looking at the problem from the perspective of our data

Let's check: Is the data we have any good?

Would we able to rank me (47) for a car having 100 mph top speed, driving 10k miles per year?

Manual Classification - red

Manual Classification - yellow

Manual Classification - green

Decision Bounaries

Code in Scikit-learn

Training


from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier()
clf.fit(X_train, y_train)
            

Prediction


y_pred = clf.predict(input)
        
https://scikit-learn.org/stable/modules/classes.html
https://colab.research.google.com/github/djcordhose/ai/blob/master/notebooks/sklearn/overview.ipynb

Decision Trees

Up to 70% accuracy on unknown data

Code using Keras High Level API

Network Setup


model = keras.Sequential()

model.add(Dense(100, name='hidden1', activation='relu', input_dim=3))
model.add(Dense(100, name='hidden2', activation='relu'))
model.add(Dense(3, name='softmax', activation='softmax'))

The Issue: Overfitting

Training Score

Test Score

Training and test scores clearly divert

Code in TensorFlow using Keras API

Model


model.add(Dense(units=50, input_dim=3))
model.add(Dense(units=3, activation='softmax'))
model.compile(loss='categorical_crossentropy')
                    

Training


model.fit(X_train, y_train, epochs=1000, batch_size=1000)
                    

Prediction


y_pred = model.predict([[100, 47, 10]])
        
https://colab.research.google.com/github/djcordhose/ai/blob/master/notebooks/tensorflow/nn-training.ipynb

There is no general AI

Consciousness or autonomous learning
does not exit in machines

AI and machine learning is not like super-humans

Wrap-Up

  • Machine Learning can learn from existing data and generalize from it
  • Sometimes, it can be an alternative to explicit, classic business logic
  • No machine has common knowledge of the world, though
  • "Can the AI not handle this?" is thus never a reasonable question
  • "the AI" does not exist
  • Machine Learning is an engineering effort. There is no strong AI that you just throw a problem at and it will solve it automatically. Dr. Sebastian Wieczorek, Head of AI @SAP

Softwarearchitektur Meetup - Machine Learning: Das Ende der Businesslogik?

Oliver Zeigermann / @DJCordhose / embarc GmbH
http://bit.ly/hh-arch-ml