Imagine you are the chief of security in a museum. The museum consists of some rooms that are connected via straight hallways. Imagine a floor plan like this: Now you want to place cameras in the rooms to monitor the hallways. Since the cameras can rotate, each one can cover all hallways connected to the room it’s placed in.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Robert Kübler
How Long Until You Roll Two Consecutive Sixes? Original
Zoom image will be displayed Let us take a look at a seemingly simple probabilistic problem. It goes as follows: You roll a fair standard die repeatedly, until you get two consecutive sixes. What is the expected number of rolls before the game ends? This looks like an easy one. You roll a six with probability 1/6, and if you want two sixes, that will be p = 1/36 since the rolls are independent of each other. The reciprocal value 1/p is the expected value, then, so 36. Right? Not so fast.
How Many Cards Can You Draw?
A small probability theory exercise Let us check out a small probability theory problem I stumbled upon. It goes as follows: Assume that you have a deck of n cards, numbered from 1 to n. You shuffle it and turn it face down. Now, you keep drawing cards until you get one that is smaller than the one you had before. What is the expected number of cards you will draw from the pile? As a small example, imagine we have 10 cards. The following might happen: You draw a 6.
Advanced Time Series Forecasting With sktime
Learn how to optimize model hyperparameters and even the architecture in a few lines of code In my previous article, we explored the basics of time series forecasting with sktime, looking at how to leverage this powerful library for straightforward forecasting tasks. Now, it’s time to take our journey further and dive into the advanced techniques that can help you optimize your forecasts and improve their accuracy.
Convenient Time Series Forecasting with sktime
How to make forecasting as easy as a walk in the park Ah, time series forecasting. It’s the quintessential task for many data scientists, somewhat universal across various industries. This field is so valuable because if you have a crystal ball to see some key numbers ahead of time, you can use that information to get a head start and prepare for what’s coming down the pipeline.
How to Forecast Hierarchical Time Series
A beginner’s guide to forecast reconciliation Imagine you’re a data scientist at a charming little pet shop specializing in just five products: two varieties of cat food and three types of dog food. Your mission? To help this small business flourish by accurately forecasting the weekly sales for each product. The goal is to provide a comprehensive sales forecast — total sales, as well as detailed predictions for cat food and dog food sales, and even individual product sales.
TARNet and Dragonnet: Causal Inference Between S- And T-Learners Original
Learn how to build neural networks for direct causal inference Building machine learning models is fairly easy nowadays, but often, making good predictions is not enough. On top, we want to make causal statements about interventions. Knowing with high accuracy that a customer will leave our company is good, but knowing what to do about it — for example sending a coupon — is much better. This is a bit more involved, and I explained the basics in my other article.
Easy Methods for Causal Inference
Use your favorite models in combination with meta-learners to make valid causal statements Imagine that you have built an awesome machine learning model that can forecast your target value with great accuracy. In some cases, your job might be over at this point. However, often the business does not only want to know what will happen but how to influence the outcome as well. True to the motto: Knowing the future is silver, being able to change it is golden.
Find Hidden Laws Within Your Data with Symbolic Regression Original
Automatically discover fundamental formulas like Kepler and Newton As machine learning practitioners, we usually have a dataset (X, y), and we want to find a function M— also known as a model — such that M(X) ≈ y. Typically, we do not care about the functional form of M. As far as we are concerned,our model can be a neural network, a tree-based algorithm, or something completely different — as long as the performance on the test set is good, we are happy.
Shapley Values Clearly Explained Original
Distribute the teamwork result fairly among the members When was the last time you teamed up with some buddies and achieved something great together? Whether it was winning a game, mastering a project at work, or finishing in the top 3 in a Kaggle competition. And if you can’t remember anything (poor you), what about a nice evening with your friends? Picture this: a fantastic night out, followed by sharing a taxi ride home, only to be greeted with a sizable taxi bill.
Neural Networks For Periodic Functions
When ReLU’s extrapolation capabilities are not enough Neural networks are known to be great approximators for any function — at least whenever we don’t move too far away from our dataset. Let us see what that means. Here is some data: It does not only look like a sine wave, it actually is, with some noise added. We can now train a normal feed-forward neural network having 1 hidden layer with 1000 neurons and ReLU activation. We get the following fit: It looks quite decent, apart from the edges.
Particle Swarm Optimization
The most mesmerizing way of optimizing arbitrary functions Whether we deal with machine learning, operations research, or other numerical fields, a common task we all have to do is optimizing functions. Depending on the field, some go-to methods emerged: In machine learning when training neural networks, we usually use gradient descent. This works because the functions we deal with are differentiable (at least almost everywhere — see ReLU).
Finding Closest Points Faster Than O(n²)
An interesting application of the divide-and-conquer paradigm Imagine that you work in air traffic control. To make sure that no airplanes collide, you monitor their positions and give a warning signal to the airplanes that are closest together. Since you have to conduct this check every few seconds, you want to do it automated and as fast as possible. One way to achieve your goal is by computing the distances between all pairs of airplanes and picking the ones that are closest together.
Memory-Efficient Embeddings
Creating smaller models with a new kind of embedding layer Whenever dealing with categorical data, beginners resort to one-hot encoding. This is often okay, but if you are dealing with thousands or even millions of categories, this approach becomes infeasible. This has the following reasons: Increased dimensionality: For each category, you get an additional feature. This can lead to the curse of dimensionality.
Convenient Reinforcement Learning With Stable-Baselines3
Reinforcement Learning Reinforcement learning without the boilerplate code In my previous articles about reinforcement learning, I have shown you how to implement (deep) Q-learning using nothing but a bit of numpy and TensorFlow. While this was an important step towards understanding how these algorithms work under the hood, the code tended to get lengthy — and I even merely implemented one of the most basic versions of deep Q-learning.
Convex Hulls for the Traveling Salesman Problem
ALGORITHMS Improve your tours with the convex hulls as waypoints You know what is better than convex hulls and the traveling salesman problem (TSP)? Combining these two, exactly! The idea is so simple that I will immediately give it to you. First, compute a convex hull. This is your starting tour that you can extend with methods such as greedy insertion. And that’s it already. If you do not know what any of this means, please read other introductory articles about convex hulls and the TSP.
Regret Heuristics
By Dr. Robert Kübler When creating custom algorithms for a problem we have to solve, we often start with a simple solution such as an exhaustive search, or some kind of greedy heuristic if brute-force algorithms are too slow. In this article, I want to give you another nice and general heuristic that you should have in your algorithm toolbox: a concept called regret.
Hands-On Deep Q-Learning
Reinforcement Learning Level up your agent to win more difficult games! Reinforcement Learning is one of the most fascinating fields of machine learning. Unlike supervised learning, reinforcement learning models can learn complex processes independently, even without beautifully tabulated data. For me, it is most fun to see AI agents win video games, but you can also use reinforcement learning to solve business problems.
Hands-On Deep Q-Learning
REINFORCEMENT LEARNING Reinforcement Learning is one of the most fascinating fields of machine learning. Unlike supervised learning, reinforcement learning models can learn complex processes independently, even without beautifully tabulated data. the environment your agent lives in, what decisions your agent can take, and what success and failure look like. Example of an AI agent mastering a game. Pick up a customer and bring them to the hotel. Image by the author.
A Practitioner’s Guide to Reinforcement Learning
Reinforcement Learning Take your first steps in writing game-winning AI agents In machine learning, data scientists primarily navigate the territories of supervised and unsupervised learning.
The Guide to Recommender Metrics
Evaluating a recommender system offline can be tricky Think of the YouTube main page, which displays videos that you might like, or Amazon which suggests you buy more of the products they sell. These are examples of recommender systems that try to show the things, you most likely want to interact with. Let us assume that you have built a recommender system with a method of your choice as well.
The Guide to Recommender Metrics
Think of the YouTube main page, which displays videos that you might like, or Amazon which suggests you buy more of the products they sell. These are examples of recommender systems that try to show the things, you most likely want to interact with. Let us assume that you have built a recommender system with a method of your choice as well. The question is: how do you evaluate it offline, before you put it in production and let it serve recommendations on a website?
Recommender Systems From Implicit Feedback Using TensorFlow Recommenders
When customers don’t explicitly tell you what they want Making recommendations is actually not that hard. You just have to check how your customers rated your products, for example using 1 to 5 stars, and then train a regression model on top of it. Right?
Recommender Systems From Implicit Feedback Using TensorFlow Recommenders
A typical dataset that you would like to have. Image by the author. Making recommendations is actually not that hard. You just have to check how your customers rated your products, for example using 1 to 5 stars, and then train a regression model on top of it. Right?
Improvement Heuristics for the Traveling Salesman Problem in Python
I defined the Traveling Salesman Problem (TSP) in earlier articles, such as this one: A tour starting in San Francisco, then going to Los Angeles, Sedona, the Grand Canyon, Las Vegas, and Death Valley, and back to San Francisco. Image by the author. In short: There are n cities (or other interesting locations) on a map. Solving the TSP means finding the shortest tour through all of these cities, and then returning to the start city again.
How to Optimize Your Marketing Budget
MARKETING ANALYTICS It is Time to Reap The Fruits of Your Hard Marketing Mix Model Training! Marketing mix models are a powerful tool for understanding the impact of different marketing channels on sales. By building a marketing mix model, marketers can quantify the contribution of each channel to their overall sales, and then use this information to optimize their budget allocation.
From Theory to Practice: Building a k-Nearest Neighbors Classifier
Another day, another classic algorithm: k-nearest neighbors. Like the naive Bayes classifier, it’s a rather simple method to solve classification problems. The algorithm is intuitive and has an unbeatable training time, which makes it a great candidate to learn when you just start off your machine learning career. Having said this, making predictions is painfully slow, especially for large datasets.
Theoretical Deep Dive into Linear Regression
Three Simple Things About Regression That Every Data Scientist Should Know Understanding these three things will improve how you go about linear and generalized linear modeling
Theoretical Deep Dive into Linear Regression
You can use any other prior distribution for your parameters to create more interesting regularizations. You can even say that your parameters w are normally distributed but correlated with some correlation matrix Σ. If you do the math, you will find out that we then have to optimize for some matrix Γ. Note: Γ is invertible and we have Σ⁻¹ = ΓᵀΓ. This is also called Tikhonov regularization.
Embrace Randomness For Creating Fast Algorithms
Created by the author on https://dreamstudio.ai/generate. The prompt contained "dice" but what I got were buildings and Swiss cheese, it seems. 😂 Randomized algorithms are a fascinating area of study in computer science. These algorithms use randomness to solve problems quickly and efficiently, usually outperforming deterministic algorithms.
Embrace Randomness For Creating Fast Algorithms
Are you really willing to wait for weeks for 100% certainty if you can already have 99.9% within a minute? Randomized algorithms are a fascinating area of study in computer science. These algorithms use randomness to solve problems quickly and efficiently, usually outperforming deterministic algorithms. The catch: randomized algorithms may produce incorrect results with some probability, while their deterministic counterparts never err — given they are implemented correctly.
How to Build Popularity-Based Recommenders with Polars
Recommender systems are algorithms designed to provide user recommendations based on their past behavior, preferences, and interactions. Becoming integral to various industries, including e-commerce, entertainment, and advertising, recommender systems improve user experience, increase customer retention, and drive sales.
How to Build Popularity-Based Recommenders with Polars
RECOMMENDATION SYSTEM Basic recommenders that are easy to understand and implement, as well as fast to train Recommender systems are algorithms designed to provide user recommendations based on their past behavior, preferences, and interactions. Becoming integral to various industries, including e-commerce, entertainment, and advertising, recommender systems improve user experience, increase customer retention, and drive sales.
Convenient Bayesian Marketing Mix Modeling with PyMC Marketing
Marketing Analytics A new and shiny library from the PyMC team worth trying out You can tell the importance of a topic by how many big companies are releasing software packages on it. In the field of marketing mix modeling, you can see that Google released LMMM Meta released Robyn I released mamimo 🥲 and PyMC Labs released PyMC Marketing Even better than marketing mix modeling is Bayesian marketing mix modeling, which Google’s and PyMC Labs’ libraries provide.
Gaussian Naive Bayes, Explained
The decision region of a Gaussian naive Bayes classifier. Image by the Author. I think this is a classic at the beginning of each data science career: the Naive Bayes Classifier. Or I should rather say the family of naive Bayes classifiers, as they come in many flavors. For example, there is a multinomial naive Bayes, a Bernoulli naive Bayes, and also a Gaussian naive Bayes classifier, each different in only one small detail, as we will find out.
Understanding by Implementing: Decision Tree
Image by Author Many advanced machine learning models such as random forests or gradient boosting algorithms such as XGBoost, CatBoost, or LightGBM (and even autoencoders!) rely on a crucial common ingredient: the decision tree! Without understanding decision trees, it is impossible to understand any of the aforementioned advanced bagging or gradient-boosting algorithms as well, which is a disgrace for any data scientist! So, let us demystify the inner workings of a decision tree by...
Dr. Robert Kübler
Dr. Robert Kübler, Senior Data Scientist on January 11, 2022 in By, Senior Data Scientist on January 11, 2022 in Machine Learning Learn how to build feedforward neural networks that are interpretable by design using PyTorch.
A Performant Recommender System Without Cold Start Problem
Recommendation System When collaboration and content-based recommenders merge Perhaps the most famous recommender system is the so-called matrix factorization. In this collaborative recommender, users and items are represented with an embedding, which is nothing more but a vector of numbers. The intuition is that the dot product of the user and the item embedding should result in the rating that the user would give this item.
A Performant Recommender System Without Cold Start Problem
Recommendation System When collaboration and content-based recommenders merge Perhaps the most famous recommender system is the so-called matrix factorization. In this collaborative recommender, users and items are represented with an embedding, which is nothing more but a vector of numbers. The intuition is that the dot product of the user and the item embedding should result in the rating that the user would give this item.
Introduction to Embedding-Based Recommender Systems
Learn to build a simple recommender in TensorFlow They are everywhere: these sometimes fantastic, sometimes poor, and sometimes even funny recommendations on major websites like Amazon, Netflix, or Spotify, telling you what to buy, watch or listen to next. While recommender systems are convenient for us users — we get inspired to try new things — the companies especially benefit from them.
Introduction to Embedding-Based Recommender Systems
Recommendation System Learn to build a simple matrix factorization recommender in TensorFlow They are everywhere: these sometimes fantastic, sometimes poor, and sometimes even funny recommendations on major websites like Amazon, Netflix, or Spotify, telling you what to buy, watch or listen to next. While recommender systems are convenient for us users — we get inspired to try new things — the companies especially benefit from them.
How to Test Your Unit Tests
A Brief Introduction to Mutation Testing In my last article, I talked about how unit testing is an essential aspect of the work of a data scientist because incorrect code leads to faulty analyses. One way to improve unit testing is to use property-based testing alongside example-based testing, i.e. the normal way of unit testing.
Stop Hardcoding Your Unit Tests
The work of a data scientist has many facets: they have to understand business problems, know their algorithms and statistics, and write well-documented and tested code, among other things. This is a demanding task, and very often you have to make a decision on what to prioritize, given your limited time capacity. From my experience, the coding part gets usually neglected a bit - code is prototyped in some notebook, and then at some point, it runs good enough, and that's it. It also happens to me.
Understanding by Implementing: Decision Tree
Are you really willing to wait for weeks for 100% certainty if you can already have 99.9% within a minute?
Understanding by Implementing: Decision Tree
Many advanced machine learning models such as random forests or gradient boosting algorithms such as XGBoost, CatBoost, or LightGBM (and even autoencoders!) rely on a crucial common ingredient: the decision tree! Without understanding decision trees, it is impossible to understand any of the aforementioned advanced bagging or gradient-boosting algorithms as well, which is a disgrace for any data scientist! 😁 So, let us demystify the inner workings of a decision tree by implementing one in...
Outlier Detection With Autoencoders
Autoencoder If you cannot compress it, there is probably something wrong with it A classical obstacle you stumble upon in data science and machine learning is outliers. The concept of an outlier is intuitively clear to a human, yet there is no generally meaningful mathematical definition apart from simple hacks from Stats 101 that involve the standard deviation or the interquartile range.
Papers Simplified: "Anticorrelated Noise Injection for Improved Generalization"
Learn how adding noise during gradient update helps generalize, including an implementation in TensorFlow In this article, we will check out a paper published by Antonio Orvieto, Hans Kersting, Frank Proske, Francis Bach, and Aurelien Lucchi, submitted on February 06, 2022. It is called Anticorrelated Noise Injection for Improved Generalization [1], and you can find it here. I would summarize the paper like this: Let's dive into the paper to see what a smart way compared to a not-too-smart way is.
Learning to Rank the Bayesian Way
To spice things up, let us introduce a fourth player that only played two games. new_games = pd.DataFrame({ "Player 1": [3, 3], "Player 2": [2, 2], "Player 1 wins": [1, 1] }) games = pd.concat( [games, new_games], ignore_index=True ) The player with number 3 played two times against number 2 and even won twice. So number 3 should have quite high strength as well, but we cannot say if number 3 is truly better than 2, or if it was mere luck.
Bayesian Hierarchical Marketing Mix Modeling in PyMC
Learn how to build MMMs for different countries the right way Imagine that you work in a marketing department and want to investigate if your advertising investments paid off. People who read my other articles know a way to do this: marketing mix modeling! This method is especially interesting because it also works in a cookieless world. I have also covered Bayesian marketing mix modeling, a way to get more robust models and uncertainty estimates for everything you forecast.
A Small Taste of Classical AI: Solving Search Problems
We can implement frontier differently, for example as a queue. Using this data structure, we can insert new states at the end of the list (as before) but pop elements from the start of the list (first-in-first-out or FIFO principle). An inefficient and cheap way to do this is by replacing frontier.pop() with frontier.pop(0) . However, this is a slow operation (O(n) if there are n elements in the list), and using designated data structures to implement queues is better (O(1) then).
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Robert
Contact Robert, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack