Introduction
WeatherFit is an algorithm that recommends U.S. cities based on an individual’s ideal weather conditions. Users input their preferences for various weather variables, including ideal values, acceptable ranges, and importance levels. The algorithm evaluates 300 cities across all 12 months, providing detailed rankings by city, state, and month.
The motivation for creating WeatherFit came from my desire to identify cities that align with my personal weather ideals. The project began by gathering weather data from Weather Spark and Bestplaces, then developing an algorithm capable of comparing user preferences to month-specific city data.
Data Collection
Weather data was collected for 300 U.S. cities, ensuring an evenly-distributed balance of location, population size, and state representation. The dataset includes monthly averages for nine weather variables:
- High temperature
- Low temperature
- Cloud cover
- Days with precipitation
- Rainfall (in inches)
- Snowfall (in inches)
- Humidity
- Wind speed
- Sunlight
United States map showing the 300 cities in the WeatherFit dataset
User Input
A Google Form was created to gather user preferences. For each weather variable, users provide:
- Their ideal value.
- Thresholds for “too high” and “too low” values.
- Importance level on a 0-10 scale.
Each factor has several references, giving context for users
Two additional inputs are collected:
- Variance: A 0-10 scale indicating desired seasonal variation. Variance is calculated by using the variation of monthly data for a specific city compared to the average.
- Outdoor Score: A 0-10 scale indicating time spent outdoors. This determines the weighting of perceived versus real temperature in calculations.
Calculation
The algorithm processes user data in five steps:
- Difference Calculation
For each weather variable, the absolute difference between a city’s monthly value and the user’s ideal is calculated. Values outside the user’s acceptable range are penalized non-linearly using variable-specific exponents.
The formula used to calculate the absolute difference for cloud cover
- Normalization
All calculated differences are converted into z-scores to standardize across variables, allowing comparability regardless of scale. - Weighting and Aggregation
Z-scores are multiplied by the user-defined importance levels. Adjustments for Outdoor Score are applied, influencing the weighting of perceived versus real temperature. The weighted z-scores are summed for each city and month.
The formula used for perceived temperature
- Monthly and Annual Scores
Monthly scores are adjusted for the number of days in each month. The sum of monthly scores produces an overall score for each city. - Rankings and Visualizations
Cities are ranked from 1 to 300 by overall score and by month. State rankings are derived by averaging scores for cities within each state. Additionally, z-scores are calculated again to make visualizing the data easier.
All requested cities are graphed to visualize the compatibility throughout a year
An example summary I send to everyone who fills out the form
Limitations
Dataset Size
The dataset is limited to 300 cities, potentially overlooking less populated or geographically diverse regions. Expanding the dataset would improve accuracy.
Global Expansion Challenges
WeatherFit was initially planned to be international, but incorporating international cities would require substantial effort due to varying data availability, accuracy, and representation. For instance, achieving equal coverage for Russia would require approximately 540 cities.
Future Directions
Expanding the Dataset
Adding more U.S. cities, with a goal of 500, would enhance equal geographic representation.
HomeFit
WeatherFit is the foundational step for creating HomeFit, an algorithm that ranks cities based on various living conditions. HomeFit would integrate WeatherFit’s data with additional variables, such as cost of living, job opportunities, crime rates, and demographic factors, to provide city residence recommendations.
If you would like your personal WeatherFit results, feel free to email me at [email protected] and I will send the form.
Leave a Reply