Machine Learning: The logic of the Predictive system – Darmok

I want to discuss a system I created which will do the following

  1. The Machine will use the history of the event and predict the next occurrence of the event. Weighted average pressure of history will be a major factor to the predictive logic.
  2. The Machine will record the actual occurrence of the event and measure the deviation of that occurrence with its prediction.
  3. Based on the deviation the Machine will adjust the logic for the next prediction of the event
  4. The Machine will continue to learn more about the event and wrap it in a logic.

This system reminds me of the principle of a success business, there is no such thing as failure. There are projects that “do not work out” but the successful business person looks at such events as a way to learn more about the consumer, to learn about what works and what does not. The Predictive system whom I will call Darmok is not afraid to make predictions about behavior, to make “mistakes”, it sees it as an opportunity to learn more about the person or system, to grow. Darmok will adjust its logic and get better.

Meet Darmok

Actual
Year

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

Jan

500

501

502

503

504

505

506

507

508

509

Predicted
Year

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

Jan

502

503

504

505

506

507

508

509

510

511

Calculations

X

0

1

2

3

4

5

6

7

8

9

XY

0

501

1004

1509

2016

2525

3036

3549

4064

4581

X2

0

1

4

9

16

25

36

49

64

81

CyRltve

99.60159

99.6

99.6

99.6

99.6

99.6

99.6

99.6

99.6

99.6

Xs Ys X2s XYs B1 B0 YT YT2

4.5

504.5

285

22785

1

500

510

510.9961

Jane Doe grocery bill for last 10 years Month of January. Based on the history, we want to predict grocery bill for Jan of the next year 2000 (YT). Also, if computer was predicting for the last 10 years, then we want to factor in the difference between the predicted amount and the actual to arrive at a more accurate prediction, YT2.

  • The month in question for this sample is January
  • The Predicted section shows data that was manually predicted (not by Darmok) for January for each year

X – For each year in the series, so increment for each new year (first year will be 0)

XY – X * the data value for the month (Say January)

X2 – X * X or X squared

CyRltve (a measure in Percentage of the deviation between actual and predicted value for the month) – (100*actual data value of the month)/(manual predicted data value of the month)

So for a new year lets say 2000 is the new year to predict

X = 10 (we have data from 10 previous years, so 2000 the 11year will be 10, we start count from 0. This is the source of the 10 you see in formulas below)

Xs – Sum of all the previous X/10

Ys – Sum of all the previous years data for the month/10

X2s – Sum of all the X2 for January for all the previous year

XYs – Sum of all the XY for January for all the previous year

B1 = (XYs-10*Xs*Ys)/(X2s-10*POWER(X2s,2))

B0 = Ys – (B1*Xs)

YT (Predicted value for Jan 2000) = B0 + B1 *10

YT2 (Predicted value for Jan 2000 factoring in the deviation of previous actual to previous predicted) = YT + ((Sum of all CyRltve for the month)/10)/100

The future of Darmok

I plan to use Darmok in MIM/FIM and many other systems to predict behavior. I will give an example of using Darmok to predict household expenses in the next blog post.