<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by TradingScience on Medium]]></title>
        <description><![CDATA[Stories by TradingScience on Medium]]></description>
        <link>https://medium.com/@science4trading?source=rss-b8e9c11d947a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by TradingScience on Medium</title>
            <link>https://medium.com/@science4trading?source=rss-b8e9c11d947a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 23:00:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@science4trading/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Best books for How I Got Started with TensorFlow and Keras in Python]]></title>
            <link>https://medium.com/@science4trading/getting-started-with-tensorflow-and-keras-in-python-f04bd24aae89?source=rss-b8e9c11d947a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f04bd24aae89</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[keras]]></category>
            <dc:creator><![CDATA[TradingScience]]></dc:creator>
            <pubDate>Tue, 14 May 2024 15:24:01 GMT</pubDate>
            <atom:updated>2024-05-18T17:20:43.046Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5EhRoR47z2MSg_au3Tgdxg.png" /></figure><p>TensorFlow and Keras are two powerful tools for building machine learning models in Python. TensorFlow is an open-source library for numerical computation and machine learning, while Keras is an open-source software library that provides a Python interface for artificial neural networks, making it easier to work with TensorFlow. Here’s a guide to getting started with these tools, along with a comparison of some the best books I used to get up to speed quickly with the tools and technologies.</p><h3>Starting with the Basics of TensorFlow and Keras</h3><ol><li>Installation</li></ol><p>First, you need to install TensorFlow and Keras. This can be done using pip:</p><pre>pip install tensorflow</pre><p>Keras is included in TensorFlow 2.x, so you don’t need to install it separately.</p><p>2. Import TensorFlow and Keras into your script</p><pre>import tensorflow as tf<br>from tensorflow import keras</pre><p>3. Creating a Simple Model</p><p>Define a basic sequential model:</p><pre>model = keras.Sequential([<br>    keras.layers.Dense(128, activation=&#39;relu&#39;, input_shape=(784,)),<br>    keras.layers.Dense(10, activation=&#39;softmax&#39;)<br>])</pre><p>And Compile the model:</p><pre>model.compile(optimizer=&#39;adam&#39;,<br>              loss=&#39;sparse_categorical_crossentropy&#39;,<br>              metrics=[&#39;accuracy&#39;])</pre><p>For more details on optimizers and learnings rates, see my prior article here… <a href="https://medium.com/p/b4e9fcdad989">https://medium.com/p/b4e9fcdad989</a></p><p>4. Then Train the Model</p><pre>model.fit(train_images, train_labels, epochs=5)</pre><p>5. Finally, Evaluate the Model</p><pre>test_loss, test_acc = model.evaluate(test_images, test_labels)<br>print(&#39;\nTest accuracy:&#39;, test_acc)</pre><h3>Book Summaries and Comparisons</h3><p>Here’s a look at some recommended books for learning TensorFlow and Keras, each providing unique perspectives and depth.</p><h4>1. Deep Learning with TensorFlow and Keras — Third Edition: Build and deploy supervised, unsupervised, deep, and reinforcement learning models</h4><ul><li>Authors: Amita Kapoor, Antonio Gulli, Sujit Pal</li><li>Summary: This book is comprehensive, covering a wide range of topics including supervised and unsupervised learning, deep learning, and reinforcement learning models. It provides practical examples and projects to help readers understand how to build and deploy models effectively.</li><li>Key Features:</li><li>Step-by-step instructions for building various models.</li><li>Practical case studies.</li><li>Coverage of both TensorFlow and Keras.</li><li>Suitable for both beginners and experienced practitioners.</li></ul><p><a href="https://www.amazon.com/Deep-Learning-TensorFlow-Keras-reinforcement/dp/1803232919?crid=1BTYR6W0V532V&amp;dib=eyJ2IjoiMSJ9.0Jm1bLoXUBA_cK-tar7HW0S6GDy9--bFKA481Xgz0bwBeIIVggM3vJJZKaGsYOe_bwIO5EDPf5CqsdHV4EdmM61Mq4mqaWn6VCtQE7hmXNWWmetHOtw5nZRWwLp7BXssYSZt7-pJ7rFwrO3OMaRFY3pypvpwsrk1aaZuWuGl0UEUZ1wrmXWHtGgRIwjfbNsJRDlfpF6o07XJsAWrxJjiHIcRJMJBUW-jFAgYBnrhyiWtvDRhufviHLG7yR0nY23vhQ5-_qfYFjILWgeppJg8PlzswHtWGG5t_tlsD49JPZE.Qg6iXEocZ9nmRc3CK4q12xaV4dtEkrusOfYa91_djx4&amp;dib_tag=se&amp;keywords=tensorflow+2&amp;qid=1715695516&amp;sprefix=tensorflow%2Caps%2C108&amp;sr=8-1-spons&amp;sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&amp;psc=1&amp;linkCode=ll1&amp;tag=thistlebroo02-20&amp;linkId=3809956f61124a23641b8c69a66a0225&amp;language=en_US&amp;ref_=as_li_ss_tl">Deep Learning with TensorFlow and Keras - Third Edition: Build and deploy supervised, unsupervised, deep, and reinforcement learning models</a></p><h4>2. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems (3rd Edition)</h4><ul><li>Author: Aurélien Géron</li><li>Summary: This book is well-known for its hands-on approach to machine learning. It covers essential concepts, tools, and techniques for building intelligent systems, emphasizing practical applications with extensive code examples.</li><li>Key Features:</li><li>Detailed introduction to machine learning concepts.</li><li>Practical exercises and examples.</li><li>Comprehensive coverage of Scikit-Learn, Keras, and TensorFlow.</li><li>Ideal for readers who prefer a hands-on approach to learning.</li></ul><p><a href="https://www.amazon.com/Hands-Machine-Learning-Scikit-Learn-TensorFlow/dp/1098125975?crid=2Q06N1GQGJYTR&amp;dib=eyJ2IjoiMSJ9.5l5en5Ds9T5UGDIzKrrcK43x00fgtsYV-zt4Yee0auBOxG30CzQjVd5lSJYqaOP-oNV6wnL9eM-z7fNNVS2YPtST91KsG6d2C7ezGS6HXaBfgiI6ytLSkwoR36v6Oe7aFnXIg6IohvZ4XH3DS9eALBuEhhX8pUVkY07qYzAc2nxWTwhzcX5XxU_1A1WtYfg7DCjrIsxiNArD-xvSWHEcBkDl_6yTbkXweJmZG--BbNA.A980T1CgiRXsgMsX9OOgWlh4Aje31eMB_zjArXlTanA&amp;dib_tag=se&amp;keywords=tensorflow+keras&amp;qid=1715696212&amp;sprefix=tensorflow+keras%2Caps%2C111&amp;sr=8-1&amp;linkCode=ll1&amp;tag=thistlebroo02-20&amp;linkId=c038c2335e51f530add1b44d307521b4&amp;language=en_US&amp;ref_=as_li_ss_tl">Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems</a></p><h4>3. Python Machine Learning: Machine Learning and Deep Learning with Python, scikit-learn, and TensorFlow 2 (3rd Edition)</h4><ul><li>Authors: Sebastian Raschka, Vahid Mirjalili</li><li>Summary: This book is an excellent resource for both machine learning and deep learning. It provides a thorough introduction to the core principles and implementations using Python, Scikit-Learn, and TensorFlow 2.</li><li>Key Features:</li><li>Comprehensive coverage of both ML and DL.</li><li>Focus on practical implementation and examples.</li><li>Includes coverage of TensorFlow 2.</li><li>Suitable for beginners and intermediate learners.</li></ul><p><a href="https://www.amazon.com/Python-Machine-Learning-scikit-learn-TensorFlow/dp/1789955750?crid=GEXS1I9IDIGT&amp;dib=eyJ2IjoiMSJ9.gV0KwzpjaNbsAP2FUYE7ad_-M-Jw74dItgvxu4JB8K6XODAjUpjRnAzLd4aDFi8mY6EPzvl3zOc6FlOKsoGstLgqrUvmkVlCfU0t0TzdcODoEXEEjTXCyOsZK8OPioY2gRZkCalGFwHwDQyIesBAcq_--_n7XKZwjgA0pezxxA0NxBmEgRnAwlR2uA_UicRaLuulI6PMvBDEpXN6xdrbBte6leHA80A5-l6wdmxhZXk.G7PPoiB6yxMzCj8vnMLZ9QJw647GxmEgZ6yhH5T2K4M&amp;dib_tag=se&amp;keywords=tensorflow+2+machine+learning&amp;qid=1715696523&amp;sprefix=tensorflow+2+machine+learning%2Caps%2C202&amp;sr=8-1&amp;linkCode=ll1&amp;tag=thistlebroo02-20&amp;linkId=55397dfeab8c329ba650f061a7725e6e&amp;language=en_US&amp;ref_=as_li_ss_tl">Python Machine Learning: Machine Learning and Deep Learning with Python, scikit-learn, and TensorFlow 2</a></p><h4>4. TensorFlow 2 Pocket Reference: Building and Deploying Machine Learning Models</h4><ul><li>Author: KC Tung</li><li>Summary: This book is a concise reference guide to TensorFlow 2, focusing on building and deploying machine learning models. It’s a handy resource for quick look-ups and provides practical insights into using TensorFlow 2 effectively.</li><li>Key Features:</li><li>Concise and easy-to-use reference format.</li><li>Practical tips and best practices.</li><li>Focus on TensorFlow 2.</li><li>Ideal for developers needing a quick reference guide.</li></ul><p><a href="https://www.amazon.com/TensorFlow-Pocket-Reference-Building-Deploying/dp/1492089184?crid=1BTYR6W0V532V&amp;dib=eyJ2IjoiMSJ9.0Jm1bLoXUBA_cK-tar7HW0S6GDy9--bFKA481Xgz0bwBeIIVggM3vJJZKaGsYOe_bwIO5EDPf5CqsdHV4EdmM61Mq4mqaWn6VCtQE7hmXNWWmetHOtw5nZRWwLp7BXssYSZt7-pJ7rFwrO3OMaRFY3pypvpwsrk1aaZuWuGl0UEUZ1wrmXWHtGgRIwjfbNsJRDlfpF6o07XJsAWrxJjiHIcRJMJBUW-jFAgYBnrhyiWtvDRhufviHLG7yR0nY23vhQ5-_qfYFjILWgeppJg8PlzswHtWGG5t_tlsD49JPZE.Qg6iXEocZ9nmRc3CK4q12xaV4dtEkrusOfYa91_djx4&amp;dib_tag=se&amp;keywords=tensorflow+2&amp;qid=1715695974&amp;sprefix=tensorflow%2Caps%2C108&amp;sr=8-3&amp;linkCode=ll1&amp;tag=thistlebroo02-20&amp;linkId=a9d41736912f24c050e7a2d67b848b6d&amp;language=en_US&amp;ref_=as_li_ss_tl">TensorFlow 2 Pocket Reference: Building and Deploying Machine Learning Models</a></p><h3>Conclusion</h3><p>Starting with TensorFlow and Keras in Python is a rewarding journey that opens up vast opportunities in machine learning and artificial intelligence. The books mentioned above provide valuable resources for learners at different stages. Whether you prefer a comprehensive guide, a hands-on approach, or a quick reference, there’s a book to suit your needs. Happy modeling!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f04bd24aae89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best books for getting started in Quant Finance with Python]]></title>
            <link>https://medium.com/@science4trading/best-books-for-getting-started-in-quant-finance-with-python-0885196bc37b?source=rss-b8e9c11d947a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0885196bc37b</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[quant]]></category>
            <dc:creator><![CDATA[TradingScience]]></dc:creator>
            <pubDate>Thu, 23 Nov 2023 19:00:12 GMT</pubDate>
            <atom:updated>2024-02-16T14:19:50.993Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*BB1Py6rwDYtKt--p31N-UQ.jpeg" /></figure><p>The integration of technology into the landscape of finance has become indispensable, giving rise to a field known as quantitative finance. This discipline combines mathematical modeling, statistical analysis, and computational techniques to gain insights into financial markets and make informed investment decisions. For those intrigued by the intersection of finance and technology, Python has emerged as a powerful tool for quantitative analysis. This article introduces four leading books that provide excellent beginner and intermediate coverage of this intersection of quant finance and Python.</p><p><strong>#1. Python for Finance Cookbook: Over 80 powerful recipes for effective financial data analysis, 2nd Edition</strong></p><p>In this new edition of the Python for Finance Cookbook, you will explore classical quantitative finance approaches to data modeling, such as GARCH, CAPM, factor models, as well as modern machine learning and deep learning solutions.</p><p>You will use popular Python libraries that, in a few lines of code, provide the means to quickly process, analyze, and draw conclusions from financial data. In this new edition, more emphasis was put on exploratory data analysis to help you visualize and better understand financial data. While doing so, you will also learn how to use Streamlit to create elegant, interactive web applications to present the results of technical analyses.</p><p>What you will learn:</p><ul><li>Preprocess, analyze, and visualize financial data</li><li>Explore time series modeling with statistical (exponential smoothing, ARIMA) and machine learning models</li><li>Uncover advanced time series forecasting algorithms such as Meta’s Prophet</li><li>Use Monte Carlo simulations for derivatives valuation and risk assessment</li><li>Explore volatility modeling using univariate and multivariate GARCH models</li><li>Investigate various approaches to asset allocation</li><li>Learn how to approach ML-projects using an example of default prediction</li><li>Explore modern deep learning models such as Google’s TabNet, Amazon’s DeepAR and NeuralProphet</li></ul><p>Contents include Acquiring Financial Data, Data Preprocessing, Visualizing Financial Time Series, Exploring Financial Time Series Data, Technical Analysis and Building Interactive Dashboards, Time Series Analysis and Forecasting, Machine Learning-Based Approaches to Time Series Forecasting, Multi-Factor Models, Modeling Volatility with GARCH Class Models, Monte Carlo Simulations in Finance, Asset Allocation, Backtesting Trading Strategies, Applied Machine Learning: Identifying Credit Default, Advanced Concepts for Machine Learning Projects, Deep Learning in Finance.</p><p><a href="https://www.amazon.com/Python-Finance-Cookbook-effective-financial/dp/1803243198/ref=sr_1_1?crid=U1PGIDLC5PTG&amp;amp&amp;keywords=python+quant+finance&amp;amp&amp;qid=1700762066&amp;amp&amp;sprefix=quant+python%252Caps%252C112&amp;amp&amp;sr=8-1&amp;_encoding=UTF8&amp;tag=thistlebroo02-20&amp;linkCode=ur2&amp;linkId=1d51aa8fb0dcb9dfbd7ba37ce684b5a3&amp;camp=1789&amp;creative=9325">Python for Finance Cookbook: Over 80 powerful recipes for effective financial data analysis, 2nd Edition</a></p><p><strong>#2. Python for Finance: Analyze Big Financial Data</strong></p><p>This hands-on guide helps both developers and quantitative analysts get started with Python, and guides you through the most important aspects of using Python for quantitative finance.</p><p>Using practical examples through the book, author Yves Hilpisch also shows you how to develop a full-fledged framework for Monte Carlo simulation-based derivatives and risk analytics, based on a large, realistic case study. Much of the book uses interactive IPython Notebooks, with topics that include:</p><ul><li><strong>Fundamentals:</strong> Python data structures, NumPy array handling, time series analysis with pandas, visualization with matplotlib, high performance I/O operations with PyTables, date/time information handling, and selected best practices</li><li><strong>Financial topics:</strong> mathematical techniques with NumPy, SciPy and SymPy such as regression and optimization; stochastics for Monte Carlo simulation, Value-at-Risk, and Credit-Value-at-Risk calculations; statistics for normality tests, mean-variance portfolio optimization, principal component analysis (PCA), and Bayesian regression</li><li><strong>Special topics:</strong> performance Python for financial algorithms, such as vectorization and parallelization, integrating Python with Excel, and building financial applications based on Web technologies</li></ul><p><a href="https://www.amazon.com/Python-Finance-Analyze-Financial-Data/dp/1491945281/ref=sr_1_6?crid=U1PGIDLC5PTG&amp;amp&amp;keywords=python+quant+finance&amp;amp&amp;qid=1700762066&amp;amp&amp;sprefix=quant+python%252Caps%252C112&amp;amp&amp;sr=8-6&amp;_encoding=UTF8&amp;tag=thistlebroo02-20&amp;linkCode=ur2&amp;linkId=31cb51c490d397677ec7b97284bcd423&amp;camp=1789&amp;creative=9325">Python for Finance: Analyze Big Financial Data</a></p><p><strong>#3. Quant_Py: Python for Quantitative Finance</strong></p><p>This comprehensive guide is designed to master the Python programming language and its application in financial analysis.</p><p>Key Lessons:</p><ul><li><strong>Master Python Basics:</strong> Learn Python syntax, data structures, and libraries to lay a strong foundation.</li><li><strong>Financial Data Analysis</strong>: Dive deep into Pandas to manipulate and analyze financial data.</li><li><strong>Visualization Techniques</strong>: Harness Matplotlib and Seaborn to visualize complex financial metrics.</li><li><strong>Risk Management</strong>: Utilize statistical measures and portfolio optimization techniques to manage risk effectively.</li><li><strong>Trading Strategies</strong>: Create and backtest trading algorithms with real-world data.</li><li><strong>Probability and Simulation</strong>: Explore Monte Carlo simulation and other probabilistic methods for financial modeling.</li><li><strong>Tackling Overfitting</strong>: Learn how to manage the risk of overfitting in your financial models through techniques like Lasso Regression.</li></ul><p>Whether you’re a beginner eager to learn Python from scratch or a seasoned professional looking to expand your toolkit, this book offers a deep dive into the key concepts, techniques, and Python libraries that will empower you to make informed financial decisions.</p><p>From the foundations of Python syntax and data structures to the complexities of portfolio optimization and risk management, each chapter unravels the intricacies of finance through Python’s versatile capabilities. Learn how to analyze and visualize financial data, implement trading strategies, and backtest their performance. Understand the nuances of financial modeling, from regression analysis to managing the ever-present shadow of risk.</p><p>But this book is not just about theory; it’s a hands-on manual packed with real-world examples, code snippets, and practical exercises. By the end of your journey, you’ll not only appreciate the profound impact Python has on finance but also be equipped to navigate the ever-evolving landscape of quantitative analysis.</p><p>Go beyond the numbers; decode the language of finance with Python. Your journey into the world of quantitative finance starts here.</p><p><a href="https://www.amazon.com/Quant_Py-Quantitative-Ryan-William-Barrett/dp/B0CK3M4VX3/ref=sr_1_4?crid=U1PGIDLC5PTG&amp;amp&amp;keywords=python+quant+finance&amp;amp&amp;qid=1700762066&amp;amp&amp;sprefix=quant+python%252Caps%252C112&amp;amp&amp;sr=8-4&amp;_encoding=UTF8&amp;tag=thistlebroo02-20&amp;linkCode=ur2&amp;linkId=8a4ceea0dba445d6eb5e2973253b9373&amp;camp=1789&amp;creative=9325">Quant_Py: Python for Quantitative Finance</a></p><p><strong>#4. Machine Learning for Algorithmic Trading: Predictive models to extract signals from market and alternative data for systematic trading strategies with Python, 2nd Edition</strong></p><p>Leverage machine learning to design and back-test automated trading strategies for real-world markets using pandas, TA-Lib, scikit-learn, LightGBM, SpaCy, Gensim, TensorFlow 2, Zipline, backtrader, Alphalens, and pyfolio.</p><p>This revised and expanded second edition enables you to build and evaluate sophisticated supervised, unsupervised, and reinforcement learning models.</p><p>This book introduces end-to-end machine learning for the trading workflow, from the idea and feature engineering to model optimization, strategy design, and backtesting. It illustrates this by using examples ranging from linear models and tree-based ensembles to deep-learning techniques from cutting edge research.</p><p>This edition shows how to work with market, fundamental, and alternative data, such as tick data, minute and daily bars, SEC filings, earnings call transcripts, financial news, or satellite images to generate tradeable signals. It illustrates how to engineer financial features or alpha factors that enable an ML model to predict returns from price data for US and international stocks and ETFs. It also shows how to assess the signal content of new features using Alphalens and SHAP values and includes a new appendix with over one hundred alpha factor examples.</p><p>By the end, you will be proficient in translating ML model predictions into a trading strategy that operates at daily or intraday horizons, and in evaluating its performance.</p><p>What you will learn:</p><ul><li>Leverage market, fundamental, and alternative text and image data</li><li>Research and evaluate alpha factors using statistics, Alphalens, and SHAP values</li><li>Implement machine learning techniques to solve investment and trading problems</li><li>Backtest and evaluate trading strategies based on machine learning using Zipline and Backtrader</li><li>Optimize portfolio risk and performance analysis using pandas, NumPy, and pyfolio</li><li>Create a pairs trading strategy based on cointegration for US equities and ETFs</li><li>Train a gradient boosting model to predict intraday returns using AlgoSeek’s high-quality trades and quotes data</li></ul><p><a href="https://www.amazon.com/Machine-Learning-Algorithmic-Trading-alternative/dp/1839217715/ref=sr_1_9?crid=U1PGIDLC5PTG&amp;amp&amp;keywords=python+quant+finance&amp;amp&amp;qid=1700762066&amp;amp&amp;sprefix=quant+python%252Caps%252C112&amp;amp&amp;sr=8-9&amp;_encoding=UTF8&amp;tag=thistlebroo02-20&amp;linkCode=ur2&amp;linkId=8dda2a4a46d93e84de76217bfd549364&amp;camp=1789&amp;creative=9325">Machine Learning for Algorithmic Trading: Predictive models to extract signals from market and alternative data for systematic trading strategies with Python, 2nd Edition</a></p><p>I hope you enjoy the process of learning more about Quant Finance with Python as much I do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0885196bc37b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Stockstats and Performance of Some Key Indicators]]></title>
            <link>https://medium.com/@science4trading/introduction-to-stockstats-and-performance-of-some-key-indicators-d1af7274dde?source=rss-b8e9c11d947a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1af7274dde</guid>
            <category><![CDATA[stocks]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[TradingScience]]></dc:creator>
            <pubDate>Fri, 11 Aug 2023 17:20:31 GMT</pubDate>
            <atom:updated>2023-08-11T17:20:31.673Z</atom:updated>
            <content:encoded><![CDATA[<p>The world of finance has seen a surge in the use of data-driven techniques for market analysis and stock prediction. Python, being a versatile language, offers a plethora of libraries tailored for this purpose. One such library that has gained prominence in the stock market analysis domain is ‘stockstats’. In this article, we will dive deep into this library and evaluate the performance of some of its key indicators, namely, RSI (Relative Strength Index), MACD (Moving Average Convergence Divergence), and WR (Williams %R).</p><p><strong>Stockstats: A Brief Introduction</strong></p><p>Stockstats is a Python library designed to facilitate stock data manipulation. It streamlines the process of calculating common stock indicators, sparing analysts and traders the need to implement these algorithms from scratch. Given a stock price data frame, this library can easily append new indicators as new columns. A primary advantage of stockstats is that it’s built on top of Pandas, making data manipulation seamless.</p><p><strong>Setting Up Stockstats</strong></p><p>To start using stockstats, it’s essential to install it first. Using pip:</p><pre>pip install stockstats</pre><p>Once installed, simply import the library and use it on a pandas dataframe with your stock data. Here is a simple example importing historical data for AAPL using the <strong>yfinance</strong> library:</p><pre>import yfinance as yf<br>import pandas as pd<br>from stockstats import StockDataFrame<br>import matplotlib.pyplot as plt<br><br>ticker_symbol = &quot;AAPL&quot;<br><br>stock_data = yf.Ticker(ticker_symbol)<br>df = stock_data.history(period=&quot;1y&quot;)<br><br>stock = StockDataFrame.retype(df)</pre><p><strong>Diving into the Indicators</strong></p><p>1. <strong>RSI (Relative Strength Index):</strong><br>RSI is a momentum oscillator that measures the speed and change of price movements. RSI oscillates between 0 and 100 and is used to gauge overbought or oversold conditions. Generally, an RSI above 70 indicates an overbought condition, while below 30 indicates oversold.</p><p>To get the RSI using stockstats:</p><pre>stock[&#39;rsi_14&#39;] # 14 is the commonly used period</pre><p>2. <strong>MACD (Moving Average Convergence Divergence):</strong><br>MACD is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price — the MACD line and the signal line. When the MACD crosses above the signal line, it suggests a buying signal, and vice versa.</p><p>Using stockstats, fetching the MACD line and signal line is straightforward:</p><pre>stock[&#39;macd&#39;] # This is the MACD line<br>stock[&#39;macds&#39;] # This is the signal line</pre><p>3. <strong>WR (Williams %R):</strong><br>The Williams %R is a momentum indicator that oscillates between 0 and -100. It is used to identify overbought and oversold conditions. A value above -20 is generally considered overbought, while a value below -80 indicates oversold.</p><p>To compute the Williams %R:</p><pre>stock[&#39;wr_14&#39;] # 14 again is a commonly used period</pre><p><strong>Performance Comparison</strong></p><p>Evaluating the performance of these indicators is essential before incorporating them into any trading strategy.</p><p>- <strong>RSI</strong>: Provides clearer signals in trending markets, particularly during prolonged overbought or oversold conditions. However, in sideways markets, the RSI can produce many false signals. The plot of RSI for AAPL for 1 year of historical data is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQr-GJDx4MU3HhcXW6L5bA.jpeg" /></figure><p>- <strong>MACD</strong>: Being a trend-following indicator, MACD excels in strong trending markets, either bullish or bearish. It provides less reliable signals during consolidation periods. The MACD plot for the same period follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5iF5Ij8bxLXRlXuXCmuOHg.jpeg" /></figure><p>- <strong>Williams %R</strong>: Similar to the RSI, it can produce clear overbought and oversold signals. The challenge lies in distinguishing between temporary retracements and actual reversals. A matching plot of Williams %R follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4PBSH4RmpGX70oqDux28pw.jpeg" /></figure><p><strong>Final Thoughts</strong></p><p>While Stockstats offers a fantastic array of technical indicators, it’s essential to understand the underlying nature of each. It’s also worth noting that no single indicator can guarantee profitable trades. Often, a combination of indicators, supplemented by other forms of analysis, provides the best results. Remember always to backtest any strategies before live trading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1af7274dde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Optimizers and Learning Rates in TensorFlow]]></title>
            <link>https://medium.com/@science4trading/understanding-optimizers-and-learning-rates-in-tensorflow-b4e9fcdad989?source=rss-b8e9c11d947a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4e9fcdad989</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[learning-rate]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[optimization-algorithms]]></category>
            <dc:creator><![CDATA[TradingScience]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 19:48:11 GMT</pubDate>
            <atom:updated>2023-08-09T19:48:11.256Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*qZUHoCVIvvNLWQI84xed2Q.jpeg" /></figure><p>In the world of deep learning and TensorFlow, the model training process hinges on iteratively adjusting model weights to minimize a predefined loss. Two primary elements govern this adjustment: the <strong>optimizer</strong> and the <strong>learning rate</strong>. Let’s delve into their roles and differentiate between them in the context of the TensorFlow model <strong>compile</strong> function.</p><p><strong>The Optimizer:</strong></p><p>An optimizer dictates the update mechanism of the model’s weights. TensorFlow offers a plethora of optimizers, each suited to different scenarios. Some popular choices include:</p><p>- <strong>SGD (Stochastic Gradient Descent):</strong> A straightforward optimizer, it updates the weights by moving in the direction of the negative gradient of the loss.</p><p>- <strong>Momentum:</strong> An enhancement to SGD, it considers the previous weight update direction to introduce a momentum-like effect, ensuring smoother weight updates.</p><p>- <strong>Adagrad (Adaptive Gradient Algorithm):</strong> Adagrad adjusts the learning rate for each parameter based on the historical gradient information. Parameters associated with frequently occurring features get a reduced learning rate, and those with infrequent features receive a higher learning rate.</p><p>- <strong>RMSprop (Root Mean Square Propagation): </strong>RMSprop seeks to address Adagrad’s aggressive, monotonically decreasing learning rate. It does this by using a moving average of the squared gradient to normalize the gradient.</p><p>- <strong>Adam (Adaptive Moment Estimation): </strong>This optimizer combines ideas from both Momentum and RMSprop. It maintains an exponential moving average of both the gradient (first moment) and the squared gradient (second moment).</p><p>Choosing the right optimizer often depends on the nature of the problem and the data. For example, Adam is popular for its adaptability, making it a go-to choice for many.</p><p><strong>The Learning Rate:</strong></p><p>Learning rate, often denoted as `lr`, is a scalar that determines the magnitude of the weight updates. Essentially, it controls how large or small the step is towards the optimal weights during each iteration. If too large, the model might overshoot the optimal weights, and if too small, the model might converge too slowly or get stuck in a local minimum.</p><p>Often, researchers and developers will experiment with various learning rates or use a learning rate scheduler to adaptively adjust it during training. For example, increasing the learning rate in early epochs, then slowing the learning rate in later epochs. It’s crucial to find a balance that ensures efficient convergence without causing unstable training dynamics.</p><p><strong>Short code snippet example:</strong></p><pre>optimizer = Adam(learning_rate=0.001)<br>model.compile(optimizer=optimizer,<br>              loss=&#39;binary_crossentropy&#39;,<br>              metrics=[&#39;accuracy&#39;])</pre><p><strong>In Summary:</strong></p><p>While the optimizer determines the mechanism of the weight updates, the learning rate controls the magnitude of these updates. Together, they play a pivotal role in the training dynamics of a TensorFlow model. Choosing the right combination can mean the difference between a highly accurate model and one that fails to converge. Experimentation and understanding the nuances of both are key to successful deep learning endeavors.</p><p>Learn more about Tensorflow <a href="https://www.amazon.com/gp/search?ie=UTF8&amp;tag=thistlebrook-20&amp;linkCode=ur2&amp;linkId=f343798b288e35f0375eb90831659730&amp;camp=1789&amp;creative=9325&amp;index=books&amp;keywords=tensorflow">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4e9fcdad989" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>