This article examines how multi-collinearity distorts causal inferences in Marketing Mix Modelling (MMM) by causing unstable and biased regression coefficients. It explores methods for detection and offers strategies to mitigate its negative effects.
Multi-collinearity, a pervasive issue where two or more independent variables in a regression model are highly correlated, poses significant challenges to causal inferences, particularly within Market…
Multi-collinearity, a pervasive issue where two or more independent variables in a regression model are highly correlated, poses significant challenges to causal inferences, particularly within Marketing Mix Modelling (MMM). This phenomenon often arises in marketing contexts due to aligned spending across channels coinciding with seasonal demand or similar percentage adjustments to budgets. Poorly specified causal graphs can further exacerbate the problem. The core issue is that multi-collinearity makes it exceedingly difficult to isolate the individual effect of each variable, leading to unstable and biased regression coefficients, inflated standard errors, and even counter-intuitive "sign flipping" of effects. Python simulations are used to vividly illustrate these detrimental impacts.
Detecting multi-collinearity involves several practical steps. Analysts should routinely examine the correlation matrix for high pairwise correlations and calculate the Variance Inflation Factor (VIF). Observing inflated standard errors in regression outputs is another strong indicator. Beyond these, a simulation-based approach is highly recommended: one can construct a data-generating process with known coefficients, then train a model to assess how accurately it recovers those pre-defined values, thereby exposing potential multi-collinearity problems.
Several strategies are proposed to address multi-collinearity. One approach is to remove one of the highly correlated variables or combine them, though this must be done carefully with consideration for the underlying causal graph. Regularization techniques, such as Ridge and Lasso regression, can also be employed; these methods add penalties to model complexity, effectively shrinking coefficients and mitigating the impact of correlation. Furthermore, Bayesian priors in Bayesian regression frameworks (like `pymc-marketing`) can introduce a form of "regularization," leading to less biased coefficients compared to standard linear regression, though careful consideration of custom priors is crucial.
Finally, a powerful long-term strategy, particularly relevant for MMM, involves implementing random budget adjustments. By introducing even small, random variations to marketing budgets at a channel level, multi-collinearity can be significantly broken, allowing for much more accurate estimation of individual channel effects. The article concludes by stressing the vital importance of data simulation with known coefficients. This essential step helps in building confidence in MMM results, identifying specific multi-collinearity issues, and designing effective randomization strategies to ensure robust and reliable causal inferences.
This repository offers a specialized toolkit for Bayesian time-series forecasting, allowing users to define custom generative models on JAX/NumPyro for comprehensive training, forecasting, and evaluation.
The `numpyro_forecast` library is a robust toolkit for Bayesian time-series forecasting, built upon the JAX/NumPyro ecosystem. It functions as a direct port of Pyro's forecasting module, specifically …
The `numpyro_forecast` library is a robust toolkit for Bayesian time-series forecasting, built upon the JAX/NumPyro ecosystem. It functions as a direct port of Pyro's forecasting module, specifically designed for users who prefer to craft their own generative models. The package provides a unified framework to manage the entire lifecycle of a forecasting model, encompassing training, inference, forecasting, and rigorous evaluation.
Key features of `numpyro_forecast` include a unified model approach for both training and forecasting, intelligently distinguishing between in-sample time latents and the future forecast horizon using a dedicated `_future` site. It supports flexible inference backends, including Stochastic Variational Inference (SVI) via `Forecaster` and Hamiltonian Monte Carlo (HMC)/NUTS through `HMCForecaster`. For robust evaluation, it offers capabilities for backtesting with rolling windows and provides both probabilistic and point metrics. The toolkit is versatile, accommodating univariate, multivariate, and hierarchical models, and adheres to Pyro's data layout conventions.
It is important to note that `numpyro_forecast` is explicitly *not* an AutoML solution. It does not provide pre-built model zoos or automated feature pipelines. Instead, its strength lies in empowering users to transform their meticulously designed custom NumPyro models into practical and scorable forecasts, offering a clear and direct pathway from model definition to actionable predictions.
The library offers two interchangeable APIs: a pure functional core (`numpyro_forecast.functional`) and an object-oriented shim (`numpyro_forecast.forecaster`), both of which produce identical results for fitting and forecasting. Installation is straightforward via PyPI, requiring Python >= 3.12, and the project adheres to high development standards with tools like `uv`, `ruff`, `ty`, and `prek`, all under an Apache-2.0 license.
This video explores how a personalized AI token burn dashboard can revolutionize your understanding and usage of AI, moving beyond mere metrics to foster imagination and improve productivity.
The presenter details the creation of an AI token burn dashboard, emphasizing that its purpose is not to brag about token usage (though he burned 800 million tokens recently) but to imagine computing …
The presenter details the creation of an AI token burn dashboard, emphasizing that its purpose is not to brag about token usage (though he burned 800 million tokens recently) but to imagine computing differently. The dashboard visualizes AI habits, allowing users to understand how they interact with AI, identify areas for improvement, and stretch their imagination. The easiest tool for this, according to the presenter, is Codex, primarily because it accurately measures token usage, unlike Claude which requires API access or approximation. He describes how he used Codex in conjunction with an open-source Tufte data visualization skill to create a custom chart.
The dashboard revealed significant insights, such as a clear shift in behavior and increased token usage when he started using Codex, leading to higher quality results. He illustrates this with an example of using "slash workflows" with Claude code and sub-agents, which consumed more tokens but yielded a comprehensive report with less effort. This highlights a crucial feedback loop: understanding token burn correlates with deploying delegated intelligence effectively and achieving better outcomes. Studies consistently show that more tokens generally lead to better results, making token burn a measurable proxy for successful AI problem-solving.
The presenter shares practical tips on how he built his dashboard with Codex, requesting features like top 10 AI usage days, a GitHub-style chart, and a logarithmic scale for historical usage. He also mentions using Codex to approximate Claude's token usage. Beyond the technical aspects, the video stresses the importance of viewing AI as 'grown, not made'—meaning its full capabilities are often unknown and must be discovered through experimentation and observation. This dashboard serves as a tool for that discovery, offering a compass for intelligence.
The broader invitation is for others to build and share their own token burn charts. This fosters public accountability and community learning, helping everyone discover new, creative uses for AI. The presenter argues that in the future, demonstrating AI usage (via token burn charts) will be as crucial as a GitHub profile for prospective employers. He also shares personal examples of how he uses AI to optimize tasks like managing emails, Slack, and organizing files, stressing that most users are far from reaching AI's full capacity. The goal is to continuously learn, adapt, and expand what's possible with AI, turning token burn into a speedometer for intelligence rather than just a cost metric.
This video explores Larry Connors' "Double Seven" trading strategy, backtesting its effectiveness over five years using Claude Code and Public's API, and discussing the process of transitioning a backtest to a live trading algorithm.
The video delves into Larry Connors' acclaimed "Double Seven" short-term trading strategy, initially developed and last backtested in 2008. The strategy is characterized by three simple rules: the ins…
The video delves into Larry Connors' acclaimed "Double Seven" short-term trading strategy, initially developed and last backtested in 2008. The strategy is characterized by three simple rules: the instrument must be above its 200-day moving average, a buy signal is triggered if it closes at a 7-day low, and a sell signal occurs when a long position closes at a 7-day high. The core objective is to determine if this strategy remains profitable today, with the presenter coding it from scratch using Claude Code and backtesting it over five years of historical data.
The process involved leveraging Claude Code effectively by providing style reference code and stating the strategy rules with extreme clarity. For data acquisition, Public's new historical API was utilized, offering five years of data across various asset classes like stocks, ETFs, and crypto. A crucial detail was splicing in Yahoo Finance data as a "warm-up" to ensure sufficient data for the 200-day moving average calculation, as Public's API currently provides five years of historical data. The video also details the straightforward setup of Public's API, including account registration, secret key generation, and exchanging it for an access token.
The backtest was conducted using a $100,000 starting capital on three ETFs (SPY, QQQ, and Gold) over a five-year period, incorporating realistic slippage and Public's zero-commission trading. Two sizing methods were compared. With **equal sizing**, each symbol received a third of the capital. This yielded a 49% total return, a 75% average win rate, a 16% max drawdown, and a 0.58 Sharpe ratio. QQQ was a strong performer, and overall, the strategy remained profitable since 2008 without any optimizations. Switching to **volatility sizing**, which scales trades based on the symbol's volatility (e.g., using ATR with a $2,000 risk per trade), significantly improved results: a 57% total return, 74% average win rate, 15% drawdown, and a 0.69 Sharpe ratio.
Transitioning from a backtest to a live trading bot is then meticulously outlined, emphasizing that the signal logic is merely 10% of the effort. Five key changes are necessary: 1. Building a **broker module** to wrap Public's API endpoints for account, portfolio, and order management. 2. Replacing the static bar loop with a **scheduler** for incremental data fetching at specific times. 3. **Trusting the broker's data** as the ultimate source of truth for positions. 4. **Persisting the bot's state to disk** (e.g., JSON) for crash recovery. 5. Implementing robust **safety rails**, including market hours checks, restart logic, a kill switch, comprehensive logging and alerts, and sophisticated handling of rejections and partial fills. This comprehensive approach highlights the complexities beyond mere signal generation in live algorithmic trading.
This text introduces a new Claude skill that enables it to "watch" any video on the internet instantly, understanding content as deeply as it processes PDFs by combining frames and audio.
This skill dramatically enhances Claude's ability to process video content by allowing it to analyze both visual frames and audio transcripts. The author highlights that traditional methods relying so…
This skill dramatically enhances Claude's ability to process video content by allowing it to analyze both visual frames and audio transcripts. The author highlights that traditional methods relying solely on transcripts often miss crucial context shown visually on screen. This new approach solves that problem by integrating visual information with spoken words.
The core of the skill operates surprisingly simply and affordably. It leverages two venerable command-line tools: `youtube-dlp` for downloading videos from over 1,000 sites (or processing local files) and `ffmpeg` for extracting screenshots (frames) and a clean audio track. The audio is then transcribed using either existing YouTube captions (free) or a service like Whisper (often free through Grok's generous tier). Claude then processes these frames and timestamped transcripts, effectively "watching" the video frame by frame and understanding the full context.
The cost efficiency is a major selling point; the processing largely occurs locally and uses free components for downloading and extraction. Transcription is often free (YouTube captions) or very inexpensive (Grok's Whisper API free tier). Even with Claude's token usage, the skill optimizes frame count for longer videos, keeping costs around $1 per run for extended content. The author emphasizes that for most users, this skill is essentially free.
Several compelling use cases are demonstrated: content research (e.g., analyzing video hooks, visual setups), debugging UI issues in screen recordings by identifying exact frame state changes, and feeding a personal "second brain" or knowledge base. This allows Claude to automatically watch competitor content, podcasts, or lectures and distill key insights directly into a searchable system like Obsidian, significantly boosting content consumption and knowledge synthesis throughput. The skill includes features like zoom flags and start/end times to focus analysis on specific video segments.
This presentation demonstrates how to leverage TensorFlow and Google Cloud Platform to analyze financial time series data and predict stock market movements, specifically focusing on predicting the S&P 500's close based on earlier global markets.
This presentation introduces a solution for applying machine learning to financial time series data using TensorFlow on Google Cloud Platform (GCP). The core motivation stems from Google's expertise i…
This presentation introduces a solution for applying machine learning to financial time series data using TensorFlow on Google Cloud Platform (GCP). The core motivation stems from Google's expertise in machine learning, GCP's robust and cost-effective compute and storage capabilities, and the growing demand for advanced analytical solutions in financial services, which often rely on large volumes of time series data. The proposed solution acts as a "force multiplier" by enabling quick deployment and iteration on complex models without significant setup overhead.
The central hypothesis explored is whether the performance of global stock markets that close earlier in the day can predict the performance of markets closing later. Specifically, the presentation aims to predict whether the S&P 500 will close up or down based on data from European and Asian markets, and North American markets from the previous day. The methodology follows a standard data science workflow: data gathering, exploration, wrangling, algorithm selection, feature engineering, and model training and testing. Key GCP services utilized are BigQuery for storing publicly available financial time series data and Cloud Datalab (a Jupyter/IPython-based environment) for interactive exploration, analysis, and visualization, both being fully managed services that minimize operational overhead.
Data exploration revealed the need for several transformations. Initial data spanning multiple orders of magnitude was scaled to highlight underlying market structures, demonstrating the global interconnectedness of financial events. Auto-correlation analysis showed strong short-term positive correlations and longer-term cyclical patterns. To prepare the data for robust machine learning, issues of non-normal distribution and inherent trend lines were addressed by converting the raw index values into "logged returns." This transformation resulted in data with similar means, no discernible trends, and no significant auto-correlations for individual markets, aligning with the efficient market hypothesis and making it suitable for predictive modeling.
For model construction, the data was split into training and testing sets, and evaluation metrics like accuracy and F1 score were defined. Two TensorFlow-based classifiers were developed: a simple linear model with softmax regression and a more sophisticated feed-forward neural network with two hidden layers. TensorFlow's graph and session concepts were briefly explained as foundational elements for defining and executing computational models. The training process involved minimizing a cross-entropy cost function through iterative adjustments of model weights and biases. The simple classifier achieved a 60% accuracy and an F1 score of 0.36 on test data, while the more complex neural network yielded a "very good score" (though specific numbers weren't provided for the latter in the summary).
In conclusion, the solution successfully demonstrated the power of combining TensorFlow's machine learning capabilities with Google Cloud Platform's managed services. The ability to rapidly acquire, transform, model, and test predictions on financial time series data, with minimal setup and maximum focus on analysis, underscores the platform's utility for financial institutions. The presenter encourages users to explore the provided notebook to replicate and experiment with the solution further.
This document details an error encountered while attempting to retrieve web content from a specified URL, preventing further analysis.
The provided text indicates an error in fetching content from the URL `https://drbenvincent.github.io/posts/baumol-cost-disease.html`. The system reported an inability to access or retrieve the inform…
The provided text indicates an error in fetching content from the URL `https://drbenvincent.github.io/posts/baumol-cost-disease.html`. The system reported an inability to access or retrieve the information from the given web address. Consequently, no actual content for analysis was obtained. The message concludes by requesting the user to verify the URL for potential typos or to offer an alternative link for another attempt.
A summary of Colin Carroll's website highlighting his work in software engineering, machine learning, and Bayesian statistics. The site includes a blog, talks, and research projects.
Colin Carroll's website presents a portfolio of his work in software engineering and mathematics, with a strong focus on machine learning and Bayesian statistics. The content is structured into a blog…
Colin Carroll's website presents a portfolio of his work in software engineering and mathematics, with a strong focus on machine learning and Bayesian statistics. The content is structured into a blog, a selection of talks, and a showcase of his research and open-source projects.
The blog features articles on various topics, including Markov Chain Monte Carlo (MCMC) methods, Hamiltonian Monte Carlo, and probabilistic programming languages. Several posts are highlighted as particularly interesting, suggesting key insights or innovative approaches. His selected talks cover a range of topics, such as scalable Bayesian workflows implemented in JAX, the benefits and strategies for adopting static typing, and methods for effectively visualizing Bayesian models.
Carroll's research and open-source contributions are significant, with notable involvement in projects like PyMC and ArviZ. He has also developed a personal project called Bayeux, focused on state-of-the-art inference methods. Furthermore, he has contributed to TensorFlow Probability and has co-authored research papers on topics such as MCMC, Bayesian neural fields, and probabilistic time series forecasting.
Beyond his primary research and open-source contributions, the site also highlights several side projects, including tools for data visualization and computational art. These projects showcase his diverse skillset and interests, demonstrating his ability to apply his technical expertise to creative and visually engaging applications.
Dr. Juan Camilo Orduz's article explores causal inference using Probabilistic Programming Languages (PPLs) like PyMC, offering a framework to address the limitations of traditional statistical methods by enabling counterfactual reasoning. The article demonstrates these concepts using the Lalonde dataset and compares OLS and GLM models for estimating the Average Treatment Effect (ATE).
The article "Introduction to Causal Inference with PPLs" by Dr. Juan Camilo Orduz explains how Probabilistic Programming Languages (PPLs) like PyMC offer a powerful framework for causal inference, add…
The article "Introduction to Causal Inference with PPLs" by Dr. Juan Camilo Orduz explains how Probabilistic Programming Languages (PPLs) like PyMC offer a powerful framework for causal inference, addressing the limitations of traditional statistical methods that often confuse correlation with causation. Causal inference seeks to answer the question, "What would have happened if things were different?".
PPLs provide several advantages for causal inference: they allow for the natural expression of causal models, rigorous quantification of uncertainty through full posterior distributions, and direct implementation of Pearl's `do` operator for counterfactual questions. They also offer flexible modeling without sacrificing interpretability.
The article uses the Lalonde dataset, which investigates the effect of a job training program on earnings, to demonstrate building causal models with PPLs. It guides users through building models that account for confounders, estimating the Average Treatment Effect (ATE) using Bayesian inference, comparing naive versus adjusted estimates, and validating models.
The approach taken in the notebook reproduces and extends ChiRho's backdoor adjustment tutorial, implementing the causal modeling strategy using PyMC. The article details steps for data preprocessing, establishing a Causal Directed Acyclic Graph (DAG), exploratory data analysis, and scaling numerical features.
The article then delves into specifying both a linear model (OLS) and a Generalized Linear Model (GLM) in PyMC for earnings prediction, including prior predictive checks, model fitting, and diagnostics. It explains ATE estimation using both the coefficient from the OLS model and the more general `do` operator, demonstrating that both methods yield consistent results.
Finally, the notebook compares the OLS and GLM models, highlighting that the GLM, which ensures non-negative earnings through a Gamma likelihood and softplus link function, provides a better fit and tighter credible intervals for the ATE estimate. The conclusion emphasizes that while traditional OLS methods suffice for basic problems, PPLs offer superior flexibility for complex models, incorporation of prior knowledge, and model calibration, especially in scenarios with non-linear relationships or unobserved confounders.
PyMC Labs introduces an end-to-end AI Innovation Lab platform that uses synthetic consumers and agentic workflows to modernize CPG product development, integrating concept generation, expert evaluation, design refinement, consumer testing, and market simulation.
The AI Innovation Lab tackles systemic challenges in CPG innovation: slow timelines, siloed workflows, disconnected consumer insights, and late-stage design decisions. It combines five core capabiliti…
The AI Innovation Lab tackles systemic challenges in CPG innovation: slow timelines, siloed workflows, disconnected consumer insights, and late-stage design decisions. It combines five core capabilities — smart brief generation, multi-agent expert evaluation, multimodal design iteration, synthetic consumer testing, and market simulation — into one integrated workflow. Validation with a major international CPG brand showed synthetic panels replicated up to 90% of purchase-intent responses in oral care versus real consumers. The platform treats design as integral rather than downstream and enables rapid pricing and market-potential testing before launch. PyMC Labs is expanding into creative testing and integrating the Lab with its MMM Insight Agent for closed-loop learning across innovation and marketing optimization.
Learn to build hybrid data workflows using DuckDB and MotherDuck, enabling local execution and cloud scalability without changing tools. The course covers setting up DuckDB, querying data, transforming data with Python, and optimizing costs.
The course "DuckDB for Data Engineers: From Local to Cloud with MotherDuck" provides practical instruction on leveraging DuckDB and MotherDuck for building hybrid data workflows. DuckDB, a lightweight…
The course "DuckDB for Data Engineers: From Local to Cloud with MotherDuck" provides practical instruction on leveraging DuckDB and MotherDuck for building hybrid data workflows. DuckDB, a lightweight OLAP engine, allows for local or embedded execution, while MotherDuck extends this functionality to a managed cloud service with shared databases and elastic compute.
The curriculum covers setting up DuckDB locally to query CSV and Parquet files, creating persistent databases, and visualizing data. Students will learn how to transform data with Python for ELT processes, including cleaning, normalizing, and deriving new metrics. A key focus is comparing local versus cloud query execution, optimizing costs, and combining local and cloud data in a single workflow.
Furthermore, the course delves into Duck Lake, a lakehouse format that provides metadata, schema evolution, and transactional guarantees for Parquet files. Participants will learn how to connect Duck Lake to S3 buckets for direct SQL querying, enhancing their ability to manage and analyze data effectively.
This tutorial offers a quickstart guide to BigQuery ML, demonstrating how to build predictive models using SQL and historical horse racing data.
This Fireship.io tutorial demonstrates how to use BigQuery ML to build predictive models without extensive data science expertise. The core example focuses on predicting horse racing outcomes using hi…
This Fireship.io tutorial demonstrates how to use BigQuery ML to build predictive models without extensive data science expertise. The core example focuses on predicting horse racing outcomes using historical data.
The tutorial begins by importing data from Kaggle into BigQuery. This involves uploading the data to Google Cloud Storage and subsequently creating a dataset and table within BigQuery to house the information. Initial SQL queries are performed, with an optional step to visualize and analyze the data further using Data Studio.
The heart of the tutorial involves building a predictive ML model using DataLab, a Python notebook environment connected to BigQuery. The tutorial walks through the process of creating, evaluating, and ultimately utilizing the trained model directly within BigQuery ML. The end result is a practical demonstration of how to leverage BigQuery ML for predictive analytics using SQL.
The speaker challenges the common perception that MLOps is universally essential for machine learning deployments. He explains MLOps as an extension of DevOps, aiming to enable operations teams to adm…
The speaker challenges the common perception that MLOps is universally essential for machine learning deployments. He explains MLOps as an extension of DevOps, aiming to enable operations teams to administer ML models, a need highlighted by the "hidden technical debt" in ML systems (Scully et al., 2015). This technical debt arises because while ML model development is rapid, long-term maintenance is complex, especially when dealing with data drift, concept drift, and ensuring consistency between training and serving environments.
However, the speaker contends that the industry's current emphasis on formalizing and automating *every* step of the ML workflow (feature engineering, data validation, deployment, etc.) leads to "automation for automation's sake." This over-automation, as depicted in cloud provider architectures, creates rigid, overly complex systems that demand significant effort to maintain, diverting resources from core ML problem-solving. The speaker argues for a "keep it simple" philosophy: the primary goal is for ops personnel to maintain models, which doesn't always require continuous, bulletproof automation. Transparent processes, occasional manual steps, and upskilling ops teams are often more pragmatic.
To address common technical debt challenges, the speaker proposes simpler, modern solutions. For example, instead of elaborate feature stores or ML pipelines for training-serving skew, pre-processing logic can be embedded directly into the ML model (the "Transform Pattern" in frameworks like Keras). For multi-step workflows, individual components, including the ML model itself, can be deployed as microservices. Data and concept drift, instead of requiring complex continuous evaluation and training systems, can often be managed effectively through scheduled retraining (e.g., monthly or quarterly), accepting minor, temporary drift as a trade-off for reduced complexity. Similarly, a monthly "from scratch build" during scheduled releases can replace continuous integration/deployment for every code change. Reproducibility can be ensured with robust version control for code, data, and models.
In conclusion, the speaker asserts that the extensive MLOps solutions prevalent today are largely unnecessary for the vast majority (99%) of ML systems. He argues that modern data processing architectures (data warehouses, data lakes) and advanced ML frameworks (PyTorch, Keras) have significantly simplified many processes and intrinsically address much of the original technical debt. The push for complex, fully automated MLOps often leads to unwarranted complexity, with successful real-world ML systems tending to favor simpler, more direct approaches that prioritize impact over exhaustive automation. Complex MLOps implementations, according to the speaker, are only warranted in a very rare minority of specific, high-stakes scenarios.
Use this portfolio as inspiration for my own portfolio.
Roy Keyes' "Data projects" page is a portfolio of personal projects demonstrating his skills in data science, machine learning, and visualization. A prominent project involves using machine learning …
Roy Keyes' "Data projects" page is a portfolio of personal projects demonstrating his skills in data science, machine learning, and visualization. A prominent project involves using machine learning to estimate radiation doses for cancer therapy, which was presented at SciPy 2017. He also gave introductory talks on neural networks and deep learning for the Houston Data Science Meetup group, indicating his teaching and communication abilities.
Keyes has also developed practical tools and libraries. "Slots," a Python library, allows users to explore multi-armed bandit strategies, while a Monte Carlo simulation tackles the dice game Klackers. These projects showcase his programming and simulation skills.
His visualization expertise is evident in projects like the D3.js visualization of Chutes and Ladders using Markov chains and the "ABQ Bikeability" map, which quantifies bikability in Albuquerque. An open-source talk on "Data Science, Big Data, and other buzzwords" suggests his ability to demystify complex topics.
Further projects include analyses of UNM graduate student salaries and medical physics articles on arXiv.org, demonstrating his analytical skills and research interests. The development of "sparkmeters," small inline graphics for information design, highlights his attention to detail and commitment to effective communication.
A review of the Cloudera Fast Forward Labs report on structural time series (STS) models, focusing on their application, interpretation, and ethical considerations. The report emphasizes the decomposition of time series into interpretable components and the use of GAMs for modeling.
The document "Structural Time Series" by Cloudera Fast Forward Labs provides a comprehensive overview of structural time series (STS) models, focusing on their interpretability and practical applicati…
The document "Structural Time Series" by Cloudera Fast Forward Labs provides a comprehensive overview of structural time series (STS) models, focusing on their interpretability and practical application. It explains that STS models represent an observed time series as a combination of explicit components such as trend, seasonality, and impact effects.
The report outlines two primary approaches to STS:
* **State Space Models:** These models view the time series as being generated by unobserved (latent) dynamics, encompassing techniques like ARIMA and the Kalman filter. Open-source tools such as `bsts` in R and TensorFlow Probability's `sts` module support this formulation.
* **Generalized Additive Models (GAMs):** This approach decomposes the time series into smooth, additive functions, each representing a distinct component. GAMs are highlighted for their scalability, ease of interpretation, and ability to handle missing or irregularly spaced data. While they might be less accurate than some autoregressive methods, GAMs can be extended with Bayesian techniques to quantify forecast uncertainty.
Key components typically found in GAM-based structural time series models include:
* **Trend:** Describes the long-term upward or downward movement in the data. This can be modeled as global, local, piecewise linear, or even saturating (e.g., using a logistic function for processes with capacity limits).
* **Seasonality:** Refers to any repeating patterns at fixed intervals, such as daily, weekly, or yearly cycles. Fourier series are employed to flexibly model these periodic effects.
* **Impact Effects:** These are discrete, often sudden, changes in the time series caused by specific events like holidays. They are modeled as constant terms active only during the relevant periods.
* **External Regressors:** The model can incorporate additional external variables, such as outdoor temperature for electricity demand, to enhance predictive power. However, this may complicate model interpretability and necessitate forecasting these external factors as well.
The report also emphasizes critical considerations for evaluating time series models:
* **Forecast Horizons:** Model evaluation should align with the intended use of the forecast, whether for short-term or long-term predictions.
* **Appropriate Validation:** Standard cross-validation methods are unsuitable for time series data due to temporal dependencies. Instead, "forward chaining" or "rolling-origin" validation techniques are recommended.
* **Baselines:** Establishing a simple, well-understood baseline model (e.g., a seasonal naive forecast) is crucial for objectively measuring the performance improvements of more complex models.
* **Evaluation Metrics:** The Mean Absolute Percentage Error (MAPE) and Mean Absolute Scaled Error (MASE) are discussed, with MASE being presented as a more robust metric that inherently scales error relative to a naive baseline, making it suitable for comparing different models.
A practical demonstration involves forecasting electricity demand in California using Facebook's open-source Prophet library. Prophet implements a GAM with piecewise linear trends, multiple seasonal components using Fourier series, and holiday effects. The report illustrates an iterative model development process, including debugging techniques like analyzing forecasts against actuals, residual plots, and autocorrelation plots to identify areas for improvement. This led to refining the model to better capture increased variance during summer months and employing a multiplicative interaction by logging the demand data, resulting in improved MAPE (6.95%) and MASE (0.89) on the holdout set.
The document underscores the value of probabilistic forecasts, enabled by Prophet's uncertainty bounds. By sampling possible future scenarios, users can answer more sophisticated, risk-related questions beyond simple point predictions, such as the probability of energy demand exceeding a certain threshold. Additionally, the report explores the use of these models for backcasting, imputing missing data, and detecting anomalies.
Ethical considerations are also addressed, advocating for the use of inherently interpretable models like GAMs, especially for high-stakes decisions, as they offer transparency without necessarily compromising accuracy. The report concludes by discussing ongoing research in time series forecasting, including automated structural component discovery and the application of transformer models for multivariate time series.
This talk explores the divide between classical statistical and modern deep learning approaches in time series forecasting, presenting Nixla's open-source efforts to bridge this gap with efficient and scalable solutions.
The speaker introduces time series forecasting as fundamental to the operational DNA of the world, with applications spanning finance, IoT, electricity, supply chains, and healthcare. The field is cha…
The speaker introduces time series forecasting as fundamental to the operational DNA of the world, with applications spanning finance, IoT, electricity, supply chains, and healthcare. The field is characterized by two distinct 'mountains' or families of methods: classical statistical forecasting and deep learning approaches. The classical tradition, championed by statisticians and econometricians (e.g., ARIMA, ETS, developed by figures like Rob Hyndman), focuses on interpretable, robust models. The deep learning side, driven by machine learning practitioners, leverages neural networks (e.g., LSTMs, Transformers) for their flexibility and scalability. These two families often view each other with skepticism, criticizing each other's shortcomings.
Nixla aims to bridge this divide with two core open-source libraries: `statsforecast` and `neuralforecast`. `statsforecast` provides extremely fast and accurate implementations of classical algorithms, designed for scalability and bridging the R to Python ecosystem gap. The speaker demonstrates its superior performance and cost-effectiveness compared to popular libraries like Prophet, emphasizing that newer is not always better. On the other hand, `neuralforecast` offers a scalable, user-friendly interface for deep learning models, highlighting advantages like improved accuracy for long horizons, simpler pipelines, and the potential for transfer learning in zero-shot scenarios.
The core of Nixla's 'bridge-building' effort lies in models like N-BEATS and N-HITS. N-BEATS was an early attempt to integrate interpretability (signal decomposition) into neural networks. However, for long-horizon forecasting, both classical and early deep learning methods struggled with accuracy and computational complexity. To address this, Nixla developed N-HITS, an architecture that combines multi-rate signal sampling and hierarchical interpolation. N-HITS significantly improves accuracy and speed for long-horizon problems, outperforming even transformer-based methods, and offers theoretical connections to Fourier transforms, enabling signal decomposition and interpretability within a neural network framework.
The talk concludes by outlining Nixla's 'Further Adventures,' including hierarchical forecasting methods for reconciling forecasts across different organizational levels and a low-latency forecasting API for developers. During the Q&A, the speaker clarifies that the libraries support cross-validation for evaluation, handle multi-seasonality (MSTL in `statsforecast`, N-HITS in `neuralforecast`), and are working on features for missing data and sparse data handling through distributional methods and wavelet transform capabilities.
Dr. Thomas Wiecki, creator of PyMC, discusses his journey into probabilistic programming, the crucial intersection of Bayesian modeling and causal inference, and how PyMC is integrating new tools like the `do` operator to solve real-world problems and enhance decision-making.
In this compelling discussion, Dr. Thomas Wiecki, the driving force behind PyMC, delves into his personal and professional journey, from childhood programming experiments to developing one of Python's…
In this compelling discussion, Dr. Thomas Wiecki, the driving force behind PyMC, delves into his personal and professional journey, from childhood programming experiments to developing one of Python's most recognized probabilistic programming frameworks. He highlights the growing synergy between Bayesian modeling and causal inference, emphasizing that what Bayesians often call the 'data generative process' is fundamentally akin to structural causal modeling. A significant recent development in PyMC is the introduction of the `do` operator, enabling users to directly express and analyze interventions, a critical component for answering structural causal questions within a Bayesian framework.
Wiecki argues that the ultimate purpose of data science is to facilitate better decision-making, not just prediction. He stresses that understanding "what causes what" is paramount for effective action, a concept that resonates deeply with non-technical stakeholders and helps convey the value of Bayesian methods more effectively than discussions about priors or uncertainty. He addresses the common fear of explicitly defining model structures, reassuring that "it's great to be wrong"—an iterative process of building, testing (e.g., with posterior predictive checks), and refining models leads to profound learning and better alignment with domain expertise. This approach contrasts sharply with black-box predictive models, which often fail to provide actionable insights or explain underlying business problems.
The conversation also explores the practical advantages of Bayesian modeling in causal contexts. Unlike frequentist approaches that may struggle with variable selection in structural models, Bayesian frameworks allow direct estimation of the complete structural model, naturally accounting for phenomena like colliders. The generative nature of Bayesian models facilitates structural discovery and hypothesis testing by allowing users to simulate data from their proposed causal graphs. Furthermore, the inherent ability of Bayesian methods to quantify both aleatoric and epistemic uncertainty provides a richer understanding of risk, which is crucial for optimizing decisions—such as allocating marketing budgets—in a manner that reflects human risk aversion.
Wiecki concludes by sharing insights on career development and innovation, advocating for following one's passion, taking calculated risks, and embracing continuous exploration. He underscores the immense value of the open-source community, where collaboration drives the boundaries of what's possible. The discussion reinforces the vision for PyMC and PyMC Labs to continue integrating advanced causal inference tools, making these powerful methodologies more accessible and impactful for solving complex, real-world problems across diverse domains.
A Python application that visualizes the implied volatility surface for options, using real-time data and the Black-Scholes model. The application provides an interactive 3D surface and adjustable parameters for customization.
The "Implied-Volatility-Surface" repository by MateuszJastrzebski21 hosts a Python application designed to visualize the implied volatility surface for SPY options. The application leverages real-time…
The "Implied-Volatility-Surface" repository by MateuszJastrzebski21 hosts a Python application designed to visualize the implied volatility surface for SPY options. The application leverages real-time SPY option data fetched from Yahoo Finance to calculate implied volatility based on the Black-Scholes model. It then presents this data as an interactive 3D surface, illustrating how implied volatility varies with both time to expiration and strike price. A live demonstration of the application is available on Streamlit.
Key features include the interactive 3D volatility surface, real-time data fetching, adjustable risk-free rate, ticker symbol input, and customizable strike price filters. The application is built with Streamlit, providing a user-friendly and responsive interface. The project utilizes several Python libraries, including Streamlit for the frontend, yfinance for financial data, NumPy and Pandas for data manipulation, SciPy for implied volatility calculations, and Plotly for 3D visualization.
The project is released under the MIT License, enabling free use, modification, and distribution. Mateusz Jastrzębski is the creator of this valuable tool for options traders and financial analysts.