Building a City Recommender 🔨 for Nomads ✈️

Part 1: From Zero to First Recommendations

The backstory

I often find it hard to decide where I want to travel next. I don’t want to go to places I already know, and the places I don’t know – well, I don’t know them. It seems best to just trust what my friends recommend. But I still often think: Can’t I solve this problem with some data and machine learning?

Solve it with data, data, data – not

So my first idea was: I’ll just collect a ton of data on different cities:

So the cities grouped in the same clusters as the cities I already like are the cities I should travel to next.

But I had a gut feeling that this plan wouldn’t work out. Why?

  1. The data is not human enough. What I’m interested in is what a city will feel like to me. Is that kind information really in quantitative city data?
  2. When I travel, I don’t look for cities that are just like the cities I went to in the past. A similarity search probably won’t find the surprising recommendations that I’m looking for.

So I put the idea aside for a while.

The missing piece

Last month, I decided to go to Cape Town for a few weeks. It wasn’t easy to pick a destination, and during my research I often went to NomadList to get some inspiration. And I noticed something I hadn’t seen before: The members on NomadList have public profiles. And the public profiles include their travel histories.

Actual detailed travel histories for thousands of digital nomads!!

This I can use! It’s exactly the kind of data I need. I find the Nomads whose taste is most similar to mine and simply look at which cities they went to.

But doing all that by hand is a bit of a stretch – I don’t want to manually look through thousands of Nomads. So I’ll use a collaborative filtering algorithm.

A quick recap on recommenders

The 2 basic types of recommendation algorithms

A recommender is the kind of software that Netflix or Spotify’s Discover Weekly uses to give you personalised recommendations. It learns from what you’ve clicked, liked, watched, or listened to in the past, and then recommends things that fit your taste.

There are many different kinds of recommendation algorithms, but most of them are built on these two basic types:

  1. Algorithms that use data about the thing you want recommendations for: What other cities have a similar data signature to the cities I like? This is how I first looked at it, but I was afraid that approach would just produce obvious, boring recommendations.
  2. Algorithms based on what other people liked: Based on the cities other people with similar taste have visited, what cities would I like?

The first kind is called a content based recommender and the second is collaborative filtering.

The beauty of collaborative filtering

Collaborative filtering algorithms are so elegant! Why?

  1. It’s simple. The collaborative filtering algorithm only needs one input: the places other people liked. It doesn’t need any data at all about the cities themselves.
  2. It uses the knowledge implied in the travel histories. Each travel history is the outcome of a string of decisions made* by a person. They used their experiences, advice from friends, data from research, and intuition to come to these decisions.
  3. This is why a collaborative filtering algorithm can give recommendations that are both surprising and accurate. Those are the kinds of recommendations I’m looking for – cities that are me, even though they might not be similar to a place I’ve been before in any obvious way.

Getting those travel histories

So I simply went through all the pages on NomadList. Whenever my software encountered a member page, it saved their travel history.

I can’t guarantee I got all the member pages, but I think I did. I found 3,640.

Looks good so far!

A quick look at the data

There are 1,152 members who don’t have any trips on their member page. Including them won’t help our recommender, so I removed them.

I now have 2,488 Nomads remaining, with a total of 36,822 trips recorded. And there are 4,247 unique cities included in those trips.

This is what the data looks like now:

Let’s make some recommendations!

Now let’s train a collaborative filtering algorithm on the data. I’m using LightFM – it’s a powerful recommender library in Python.

Running the algorithm and training a model takes about 10 seconds. Now I have a recommender that’s ready to make some recommendations!

Let’s try it!

First I’m going to write down a few cities I like, say Berlin, Nuremberg, Barcelona, and Cape Town.

  • Berlin Germany
  • Cape Town South Africa
  • Barcelona Spain
  • Nuremberg Germany

I give this data as input to the recommender, and then it calculates how much it thinks I will like each of the 4,247 cities in the dataset.

How does the recommender make recommendations?

  1. It calculates the similarity between my taste and each of the NomadList members in the dataset, based on the cities we each traveled to.
  2. By paying more attention to the members who have similar taste and less attention to those with different taste, it makes a list of cities I might like.
  3. It gives each city a score that sums up how often that city would have been recommended by the Nomads with similar taste to mine.

It’s as if I just asked two thousand friends for advice and then pooled their answers, paying more attention to advice from friends who share my taste.

So what did the recommender recommend to me? Here are the top 10 cities:

Not bad! But we’re not done. A single test run is not enough. Next, we need to make sure our recommendations are actually good. Stay tuned for Part 2: Improving the Recommendations.

What do we know about recommenders?

Our machine learning team at Data Revenue recently spent a lot of time getting to know recommendation engines. We built:

  • An elegant tactic recommender for – they even published a blog post on the project;
  • A huge movie recommender for the largest media conglomerate in Europe;
  • A hotel recommender for a big German travel site.

We know quite a bit about recommenders now – how to build them, scale them, and use them in production. If you have any questions, don’t hesitate! Write to me at m.schmitt [at]

Energy Transmission

Anticipating and Preventing Power Grid Failure

Massive power outages cause chaos for the general public, and they cost utility providers roughly $49 billion a year.

This wouldn’t be much of a problem if massive power outages were rare, but outages affecting more than 50,000 people have increased dramatically in recent years. This means utility companies need to find new ways of anticipating and managing these outages.

These days, smart grids are producing massive amounts of data, which means predicting and managing outages is easier than ever. Unlike traditional power grids, which are one-directional (meaning they only transmit power in one direction), smart grids are two-directional. They can capture data from every possible source in the grid at the same time as they’re providing electricity. They collect and monitor data from sources like smart meters, IoT devices, and power generation stations, providing a clear, real-time look at power usage.

Machine learning can use this data to anticipate and prevent massive power outages in the grid. Machine learning helps identify non-obvious patterns in the data that can be a precursor to grid failure, which helps maintenance teams preempt failure.

Balancing the Grid

Balancing the grid — making sure energy supply matches energy demand — is one of the most important jobs a transmission operator has. But renewable energy sources depend heavily on the weather, making them harder to predict.

Transmission operators spend millions each year fixing planning mistakes that lead to producing too much or too little power. In hybrid systems — which rely on both renewable energy sources and fossil fuels to generate electricity — these mistakes have to be corrected at the last minute by buying more energy or compensating power plants for the excess.

Machine learning is the most accurate method available to forecast the output of renewable energy. Advanced methods, like Long Short-Term Neural Networks (LSTMs), can weigh the many factors involved — wind, temperature, sunlight, and humidity forecasts — and make the best predictions. This saves money for operators and preserves resources for power plants.

Preventing Blackouts and Brownouts With Real-time Monitoring and AI Prediction

Power grids have a lot of obstacles to overcome in providing continuous energy to customers. Weather patterns, usage, internal failure, even wildcard incidents like lightning strikes and interference from wild animals can all affect power delivery.

Machine learning is increasingly being used to help predict potential brownout and blackout conditions. By feeding historical data into the AI and running Monte Carlo simulations to predict potential outcomes, grid operators can use machine learning to identify conditions that could lead to grid failure. And they can act accordingly.

Sensors like phase measurement units (PMU) and smart meters can provide usage information in real-time. When combined with both historical and simulation data, AI can help mitigate potential grid failure, using techniques like grid balancing and demand response optimization. Incidents that would otherwise have affected millions of people can be contained to a smaller area and fixed faster for less money.

Differentiate Power System Disturbances from Cyber Attacks

Cyber attacks are increasingly used to target important infrastructure, like shutting down hospitals with Ransomware attacks (when attackers break into the system and lock legitimate users out until a ransom is paid). With utility grids, a cyber attack can have widespread consequences and affect millions of users.

Detecting these attacks is critical.

Developers are using machine learning to differentiate between a fault (a short-circuit, for example) or a disturbance (such as line maintenance) in the grid and an intelligent cyber attack (like a data injection).

Since deception is a huge component of these attacks, the model needs to be trained to look for suspicious activity – things like malicious code or bots – that get left behind after the deception has occurred.

One such method uses feature extraction with Symbolic Dynamic Filtering (an information theory-based pattern recognition tool) to discover causal interactions between the subsystems, without overburdening computer systems. In testing, it accurately detected 99% of cyber attacks, with a true-positive rate of 98% and a false-positive rate of less than 2%. This low false-positive rate is significant because false alarms are one of the biggest concerns in detecting cyber attacks.

Balance Supply and Demand

Utility providers are looking for ways to better predict power usage while maintaining maintaining energy supply at all times. This becomes critical when renewable power sources (like solar or wind) are introduced into the grid.

Because these renewable power sources rely on elements beyond human control (like the weather), utility providers know they can’t always rely on renewables for continuous production. Knowing precisely when demand levels will peak allows utility providers to connect to secondary power sources (like conventionally generated electricity) to bolster the available resources and ensure constant service provision.

More and more utility providers are turning to machine learning for help. We can feed historical data into machine learning algorithms -- like Support Vector Machines (SVM) -- to accurately forecast energy usage and ensure sufficient levels and constant supply.

Detect Power Grid Faults

Current methods for detecting faults in the grid consume a lot of unnecessary time and resources. This creates a situation where power transmission is interrupted and customers are without electricity while faults are first located, then fixed.  

Machine learning can find faults quickly and more accurately helping you minimize service interruption for your customers.. Support Vector Machines (SVM) are combined with Discrete Wavelet Transformation (DWT) to locate faults in the lines using a traveling wave-based location method.

When we apply  DWT (a form of numerical and functional analysis that captures both frequency and location information) to the transient voltage recorded on the transmission line, we can determine the location of the fault by calculating aerial and ground mode voltage wavelets. So far, this method has detected fault inception angles, fault locations, loading levels, and non-linear high-impedance faults for both aerial and underground transmission lines.

Detect Non-Technical Power Grid Losses

In the energy world, “non-technical losses” means energy theft or fraud from the system.

There are two common types of non-technical losses. The first is when a customer uses more energy than the meter reports. The second involves rogue connections stealing energy from paying customers. To pull off this theft or fraud, bad actors can bypass smart meters completely or insert chips into the system that change how meters track energy use. Meter readers can also be bribed to report lower numbers (though thanks to smart meters, this is increasingly hard to do).

Because these non-technical losses cost $96 billion annually, utility providers are turning to machine learning to combat the problem.

We can help utility providers mine historical customer data to discover irregularities that indicate theft or fraud. These can be things like unusual spikes in usage, differences between reported and actual usage, and even evidence of equipment tampering.

Energy Distribution

Better Predict Energy Demand

Accurately predicting customers’ energy needs is critical for any utility provider. To date, we haven’t found an adequate solution for bulk energy storage, which means energy needs to be transmitted and consumed almost as soon as it’s produced.

We're using machine learning to increase the accuracy of these predictions. Historical energy use data, weather forecasts, and the types of businesses or buildings operating on a given day all play a role in determining how much energy is used.

For example, a hot summer day mid-week means more energy usage because office buildings run air conditioning at a high capacity. Weather forecasts and historical data can help identify those patterns in time to prevent rolling blackouts caused by air conditioners in the summer.

Machine Learning finds complicated patterns in the various influencing factors (such as day, time, predicted wind and solar radiation, major sports events, past demand, mean demand, air temperature, moisture and pressure, wind direction, day of the week, etc.) to explain the development of demand. Because machine learning finds more intricate patterns, its predictions are more accurate. This means energy distributors can increase efficiency and decrease costs when they buy energy – without having to make expensive adjustments.

Energy Generation

Predict Turbine Malfunction

Wind is a great renewable energy source, but wind turbine maintenance is notoriously expensive. It accounts for up to 25% of the cost per kWh. And fixing problems after they occur can be even more expensive.

Machine learning can help you get ahead of this problem. The goal is to reduce maintenance costs by catching problems before the turbine malfunctions. This is particularly important when wind farms are located in hard-to-access places, such as the middle of the ocean, which makes repair costs even higher.

Real-time data gathered with Supervisory Control and Data Acquisition (SCADA) can help identify possible malfunctions in the system far enough in advance to prevent failure.

For example, data from sensors found within the turbines – such as oil, grease, and vibration sensors – have been used to train machine learning models to identify precursors to failure, such as low levels of lubricant.

This method can train machine learning models to predict failures up to 60 days in advance.

Consumption / Retail

Accurately Predict Energy Prices

As personal power generation (using solar or wind power) gets easier and cheaper, consumers and businesses are increasingly producing their own power.

Personal power generation allows people to make, consume, and store their own energy. Depending on where they live, they may even be able to sell surplus power back to the local power utility.

Machine learning can help find the best time to produce, store, or sell this energy. Ideally, energy should be consumed or stored when prices are low and sold back to the grid when prices are high.

By looking at historical data, usage trends, and weather forecasts, machine learning models have made accurate predictions on an hourly basis. People with personal and business energy generation systems can use these predictions to make strategic decisions about whether to use, store, or sell their energy.

For example, Adaptive Neural Fuzzy Inference System (ANFIS) has been used to predict short-term wind patterns for wind power generation. This allows producers to maximize energy production and sell it when energy prices are at their peak.

Reduce Customer Churn

In open energy markets, where customers have a choice of utility providers, understanding which customers are going to churn out can be critical. Churn rates, which is the percentage of customers who stop using your service in a year, can be as high as 25%. Being able to predict churn and stay ahead of it is essential to survival.

Machine learning is helping utility owners predict when a customer is getting ready to churn out. By using techniques such as Cross-industry Standard Process for Data Mining (CRISP-DM), AdaBoost, and Support Vector Machines, as well as historical usage data, utility providers can identify key indicators of whether or not a customer is going to churn. These indicators include things like customer satisfaction, employment status, energy consumption, home ownership or rental status. A change in any of these can indicate a customer is getting ready to terminate their service.

When these indicators are identified far enough in advance, it’s possible to avoid churn by working with customers to solve any problems they’re experiencing.

Energy Trading

Predict Energy Prices

Just like natural gas and oil, wholesale energy is a market commodity. So naturally it's important for traders to be aware of market fluctuations and pricing when it comes to buying and selling energy.

To help make sense of the massive amounts of data used to make trading decisions, traders are increasingly turning to machine learning.

A mix of statistical analysis and machine learning can help commodity traders make better predictions. Classical statistical analysis techniques like time series analysis, Seasonal Autoregressive Integrated Moving Average (SARIMA), and regression models are used to deal with the data. And machine learning makes connections between the various data points.

What’s more, machine learning trains itself to make increasingly accurate predictions using the constant flow of real-time data.

Keep reading

No items found.
No blog posts found.