inves&ga&on of the latent space of stock market...

18
Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon July 18th, 2018 GECCO 2018 Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 1

Upload: others

Post on 16-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c

ProgrammingSungjoo Ha, Sangyeop Lee, Byung-Ro Moon

July 18th, 2018

GECCO 2018

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 1

Page 2: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Mo#va#on

• Human traders trading in a stock market

• May have hard 4me explaining themselves

• Analyzing the behavior of different experts for new insights

• Different approaches may share common quali4es

• Inspect the latent space

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 2

Page 3: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Pa#ern and Rela+on

• A pa#ern is defined to be a classifier that yields a true/false result for a given stock, date tuple.

• A human expert predic>ng the next price movement is a pa?ern

• A neural network predic>ng the next price movement is a pa?ern

• A black box pa#ern is a pa?ern that we do not necessarily know the decision rules it applies.

• Given mul>ple (possibly) black box pa?erns and their results, we can create a rela.on matrix whose rows and columns correspond to pa?erns and stock, date tuples.

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 3

Page 4: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Rela%on Matrix

• Dis%nct objects can form a rela%on matrix

• Users buying certain items

• Pa7ern match results on different assets

• The collec%ve rela%onship o?en has underlying structure that is difficult to observe directly

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 4

Page 5: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Low-Rank Matrix Factoriza2on

• Uncover latent structure by low-rank matrix factoriza7on

• : Rela7on matrix between pa;ern and <stock, date> pair

• : Latent pa;ern matrix

• : Latent <stock, date> matrix

• If preference of pa;erns and characteris7cs of stock, date share common quali0es, they will be close to one another in the latent space

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 5

Page 6: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Factoriza)on and Reconstruc)on Approach

• : <pa'ern, (stock, date)> matrix

• Decisions to buy a certain stock on a certain day

• Perform matrix factoriza,on on to uncover the latent space of pa2erns

• Use GP to mimic the behavior of pa'erns using auxiliary informa,on

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 6

Page 7: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Auxiliary Informa/on

• Opening Price

• Closing Price

• Highest Price

• Lowest Price

• -day Highest Price

• -day Lowest Price

• -day Moving Average

• Upper Bollinger Band

• Lower Bollinger Band

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 7

Page 8: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Experiments

• Use 100 pa&erns mined for expected gain and frequency

• Allows us to study the difference between original pa:erns and reconstructed pa:erns

• Remove 50% of the entries in the rela<on matrix

• Apply the proposed method

• Study the behavior of reconstructed pa&erns

• Study the latent space induced by matrix factoriza<onSungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 8

Page 9: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Characteris*c of Reconstructed Tree

• The reconstruc-ons are similar in seman-cs but are different syntac-cally from the originals

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 9

Page 10: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Recovering Original Pa/ern

• If we can mimic the original behavior well enough, then it also generalizes

• Can be applied to extract decision rules from expert decisions

• Exploits how others make decisions

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 10

Page 11: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Inspec'ng the Latent Space

• We can transform a tree into a vector representa/on and vice versa

• We can study the rela+onship between two different representa/ons

• Study how geometric crossover is translated in latent vector space

• Clustering

• Analyze axis vectors

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 11

Page 12: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Tree Space and Latent Space

• Geometric opera-on in tree space

• corresponding to

• Corresponding latent space representa-on

• 80% of the -me, is inside the hypersphere created by two parents

• Usually lie within a narrow cone

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 12

Page 13: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Clustering

• Clustering for measuring diversity of a set of pa1erns

• Perform clustering to obtain a generic representa1on of a pa1ern

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 13

Page 14: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Reconstructed Pa.ern

• Reconstructed pa/ern could be used for automa4on

• Understandable

• But is a chore to interpret every 4me a new pa/ern is included

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 14

Page 15: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Latent Space Analysis

2.16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.92 1.54

• Vector representa-on of the previous pa3ern

• Sparse representa-on due to NMF

• 3/30 non-zero entries

• 3 axes with > 1.0 (axis 1, 29, and 30)

• Addi*ve representa-on due to non-nega-vity

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 15

Page 16: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Tree Interpreta*on

• Approximate tree reduc(on via

• Condi1onal subtree plots

• Path usage sta1s1cs

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 16

Page 17: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Latent Space Analysis

• Axis 1 and 30 tells us that in 120 3me-step view, price has plunged

• Axis 29 tells us that in 60 3me-step perspec3ve, price hasn't plunged

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 17

Page 18: Inves&ga&on of the Latent Space of Stock Market …shurain.net/publications/latent-space2/factorization...Inves&ga&on of the Latent Space of Stock Market Pa6erns with Gene&c Programming

Conclusion

• Using GP and low-rank matrix factoriza3on we can

• Create tree representa3on of black box pa7erns which can be used for automa;c decision making

• Inspect the latent space induced by low-rank matrix factoriza;on

Sungjoo Ha, Sangyeop Lee, Byung-Ro Moon @GECCO 2018 18