{"id":635,"date":"2018-11-19T19:20:43","date_gmt":"2018-11-19T18:20:43","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=635"},"modified":"2020-11-21T22:22:50","modified_gmt":"2020-11-21T21:22:50","slug":"investor-and-machine-learning-mllib-and-dl4j","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/","title":{"rendered":"Investor and Machine Learning (MLlib and DL4J)"},"content":{"rendered":"<p>In this Blog we demonstrate how <a href=\"https:\/\/www.pschatzmann.ch\/home\/category\/quantitative-trading\/\">Investor<\/a> can be used together with <a href=\"https:\/\/deeplearning4j.org\/\">DL4j<\/a>\u00a0and Spark&#8217;s <a href=\"https:\/\/spark.apache.org\/docs\/latest\/ml-guide.html\">MLlib<\/a>.<\/p>\n<p>In general the idea is to use the stock history data in order to predict an increase or decrease of the stock value with the help of Machine Learning. We will demonstrate how we can use Indicators to define the machine learning model and how to evaluate the models and finally to check the result using the Investor framework.<\/p>\n<p>Here is the table of content:<\/p>\n<ul>\n<li>Loading of Stock Data using Investor<\/li>\n<li>Definition of a DL4J Iterator using Investor Indicators<\/li>\n<li>Training and Evaluation of a DL4J Classification net<\/li>\n<li>Training and Evaluation of a MLlib RandomForestClassifier<\/li>\n<li>Training and Evaluation of a MLlib NaiveBayes Classifier<\/li>\n<li>Setup of a\u00a0Investor Strategy using the Predictions as input<\/li>\n<li>Evaluation of the Machine Learning Trading Strategy using the Investor framework<\/li>\n<li>We calculate the return of the BuyAndHoldStrategy as a Baseline<\/li>\n<\/ul>\n<p>The link to the Jupyter Scala Workbook\u00a0using the BeakerX kernel can be found in this\u00a0<a href=\"https:\/\/nbviewer.jupyter.org\/gist\/pschatzmann\/e4bb844069d3ee5ad0c3a99e1f1462ab\">Gist<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Blog we demonstrate how Investor can be used together with DL4j\u00a0and Spark&#8217;s MLlib. In general the idea is to use the stock history data in order to predict an increase or decrease of the stock value with the help of Machine Learning. We will demonstrate how we can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[14,13],"tags":[],"class_list":["post-635","post","type-post","status-publish","format-standard","hentry","category-machine-learning","category-quantitative-trading"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Investor and Machine Learning (MLlib and DL4J) - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Investor and Machine Learning (MLlib and DL4J) - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"In this Blog we demonstrate how Investor can be used together with DL4j\u00a0and Spark&#8217;s MLlib. In general the idea is to use the stock history data in order to predict an increase or decrease of the stock value with the help of Machine Learning. We will demonstrate how we can [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-19T18:20:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-21T21:22:50+00:00\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Investor and Machine Learning (MLlib and DL4J)\",\"datePublished\":\"2018-11-19T18:20:43+00:00\",\"dateModified\":\"2020-11-21T21:22:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/\"},\"wordCount\":178,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"articleSection\":[\"Machine Learning\",\"Quantitative Trading\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/\",\"name\":\"Investor and Machine Learning (MLlib and DL4J) - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"datePublished\":\"2018-11-19T18:20:43+00:00\",\"dateModified\":\"2020-11-21T21:22:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2018\\\/11\\\/19\\\/investor-and-machine-learning-mllib-and-dl4j\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Investor and Machine Learning (MLlib and DL4J)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Investor and Machine Learning (MLlib and DL4J) - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/","og_locale":"en_US","og_type":"article","og_title":"Investor and Machine Learning (MLlib and DL4J) - Phil Schatzmann","og_description":"In this Blog we demonstrate how Investor can be used together with DL4j\u00a0and Spark&#8217;s MLlib. In general the idea is to use the stock history data in order to predict an increase or decrease of the stock value with the help of Machine Learning. We will demonstrate how we can [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/","og_site_name":"Phil Schatzmann","article_published_time":"2018-11-19T18:20:43+00:00","article_modified_time":"2020-11-21T21:22:50+00:00","author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Investor and Machine Learning (MLlib and DL4J)","datePublished":"2018-11-19T18:20:43+00:00","dateModified":"2020-11-21T21:22:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/"},"wordCount":178,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"articleSection":["Machine Learning","Quantitative Trading"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/","url":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/","name":"Investor and Machine Learning (MLlib and DL4J) - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"datePublished":"2018-11-19T18:20:43+00:00","dateModified":"2020-11-21T21:22:50+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2018\/11\/19\/investor-and-machine-learning-mllib-and-dl4j\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Investor and Machine Learning (MLlib and DL4J)"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=635"}],"version-history":[{"count":1,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/635\/revisions"}],"predecessor-version":[{"id":2212,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/635\/revisions\/2212"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}