Predict bike rentals per hour
A bike-share operator has to decide, day by day, how many bikes to put out and when to move them: too few at the morning and evening peaks and riders find empty docks, too many on a cold quiet day and the bikes stand idle. This guide trains a Fione model that predicts how many bikes will be rented in an hour, from the date, the hour and the weather. It goes from the download of an open dataset to a curl call of the served model, and shows how to check the model on hours later than the ones it learned from, as it will be used.
This is a regression: the model predicts a number, not a yes/no answer, so its results are read as errors in bikes per hour. Starting Fione from the published images and the general serving steps are in the practical guides overview. This page shows what is particular to this use case.
The business question
In the data used here, the hours range from 1 bike rented to 977, and half of them have 142 or fewer. An operator that knows how many rentals to expect in each hour can act on it:
- put more bikes out before the busy hours, and fewer on quiet days;
- plan the trucks that move bikes between stations around the expected peaks;
- schedule repairs and maintenance in the quiet hours.
The model answers one question per hour: how many bikes will be rented? It returns a number, such as 619 for 8:00 on a working Monday in December.
Get the data
The data is the Bike Sharing dataset in the UCI Machine Learning Repository:
- Page: https://archive.ics.uci.edu/dataset/275/bike+sharing+dataset
- Creator: Hadi Fanaee-T
- DOI: 10.24432/C5W894
- Licence: Creative Commons Attribution 4.0 International (CC BY 4.0)
Attribution (UCI's citation): Fanaee-T, H. (2013). Bike Sharing [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C5W894. The Readme.txt in the download asks that publications using the data cite this paper:
- Fanaee-T, Hadi, and Gama, Joao, "Event labeling combining ensemble detectors and background knowledge", Progress in Artificial Intelligence (2013): pp. 1-15, Springer Berlin Heidelberg, doi:10.1007/s13748-013-0040-3.
What we changed: we set the hours of December 2012 aside to try predictions on (see Prepare the CSV); no value was changed.
In an empty directory:
curl -sSLO https://archive.ics.uci.edu/static/public/275/bike+sharing+dataset.zip
unzip bike+sharing+dataset.zipThe zip (279,992 bytes) holds Readme.txt, day.csv (one row per day) and hour.csv (one row per hour). This guide uses hour.csv (1,156,736 bytes): a comma-separated text file with Windows line endings, a header and 17,379 rows, 17 columns and no empty cells.
The data
According to the Readme.txt, the rows are rentals of the Capital Bikeshare system in Washington D.C., USA, in 2011 and 2012, counted per hour, with the weather and season of each hour added.
| Column | What it holds |
|---|---|
instant | The row number (1 to 17379) |
dteday | The date, such as 2011-01-01 |
season | The season, 1 to 4 (see below) |
yr | The year: 0 for 2011, 1 for 2012 |
mnth | The month, 1 to 12 |
hr | The hour, 0 to 23 |
holiday | 1 if the day is a holiday |
weekday | The day of the week: 0 for Sunday to 6 for Saturday, in this file |
workingday | 1 if the day is neither a weekend nor a holiday, otherwise 0 |
weathersit | The weather: 1 clear or partly cloudy, 2 mist or cloudy, 3 light snow or light rain, 4 heavy rain, ice pellets or snow and fog |
temp, atemp | The temperature and the feeling temperature, scaled to 0 to 1 (see below) |
hum | The humidity, divided by 100 |
windspeed | The wind speed, divided by 67 |
casual | Rentals by casual users in the hour |
registered | Rentals by registered users in the hour |
cnt | The answer: all rentals in the hour |
cnt averages 189 bikes an hour; the 2012 hours average 235 against 144 in 2011. Three rows: the first hour of the file, and 8:00 and 17:00 on a working Tuesday in June 2012:
instant,dteday,season,yr,mnth,hr,holiday,weekday,workingday,weathersit,temp,atemp,hum,windspeed,casual,registered,cnt
1,2011-01-01,1,0,1,0,0,6,0,1,0.24,0.2879,0.81,0,3,13,16
12388,2012-06-05,2,1,6,8,0,2,1,2,0.48,0.4697,0.77,0.2239,30,680,710
12397,2012-06-05,2,1,6,17,0,2,1,1,0.6,0.6212,0.43,0,86,764,850The two sources describe some columns differently. The Readme.txt gives season as 1 spring, 2 summer, 3 fall and 4 winter; the UCI page as 1 winter, 2 spring, 3 summer and 4 fall. The file agrees with the UCI page: season is 1 from 21 December to 20 March. For temp the Readme.txt says the values are degrees Celsius divided by 41, the UCI page that they are scaled from −8 to +39 °C (for atemp, divided by 50 against −16 to +50 °C). The model only learns from the numbers, so this does not change the results; but to send it weather of your own you need the file's scale, so check it first against the recorded weather of a few days in the file. The UCI page also gives 17,389 instances, while the Readme.txt and the file have 17,379 hours.
Before training, look at four things.
First, casual and registered. Whether to keep a column depends on two things: is the value known at the moment you predict, and is it computed from the outcome you are predicting? These two fail both: in every row of the file, casual plus registered equals cnt, so they are counted at the same time as the answer, and are the answer split in two. Fione flags registered: "Predicts the answer suspiciously well on its own. It may give the answer away: check that it is known at prediction time." It does not flag casual. Uncheck both. instant is only the row number; Fione unchecks it itself.
Second, the weather. weathersit, temp, atemp, hum and windspeed give the weather of each hour; the Readme.txt says it was extracted from a weather website. We read it as the weather that happened, not a forecast. When you plan the bikes for tomorrow, you only have a forecast. If so, a model trained on this data is likely to do less well on forecast weather, by as much as the forecast is off; check it on your own forecasts before you rely on it.
Third, the order in time. The rows are hours in date and hour order, and the model will predict hours later than the ones it learns from. By default, Fione checks each model on rows set aside at random, so a model is checked on hours that sit between hours it learned from. This guide tells Fione to check each model on later hours instead (see Train the model).
Fourth, missing hours. 731 days of 24 hours would make 17,544 rows; the file has 17,379, so 165 hours have no row. The sources do not say why. They fall on 76 days that have fewer than 24 rows; keep this in mind when you add up the hours of a day.
Prepare the CSV
hour.csv needs no conversion. Check it has 17,380 lines:
wc -l hour.csvThen keep some hours apart, so that you can later predict hours the model never learned from. Keep the last month: the header and the 742 hours of December 2012 in new-hours.csv, and train on the other 16,637 hours, January 2011 to November 2012, in train.csv:
grep -v ',2012-12-' hour.csv > train.csv
{ head -n 1 hour.csv; grep ',2012-12-' hour.csv; } > new-hours.csvThe hours set aside are the last rows of the file, later than every hour the model learns from. That is how a demand model is used: trained on the past, used on the next days. December 2012 includes the Christmas and New Year holidays, so it is not a typical month, which shows in Make predictions.
Keep casual, registered and cnt in both files: you will uncheck the first two in Fione, and the predictions page shows that the model does not use them.
Train the model
The setting that checks each model on later hours, Order of the rows in time, is on Training settings, not on the guided Data analysis page.
- On Projects, create a project (we named it
bike-demand) and open it. - Press Upload training data, choose
train.csvand press Upload and analyze. Data analysis shows 16,637 rows, 17 columns and 0% empty cells. - Choose Detailed under View in the account menu (your name, top right), then follow Advanced settings: every training parameter on Data analysis. Training settings opens.
- Under Column to predict, choose
cnt. Fione says "1 columns predict the answer suspiciously well on their own. They stay checked: make sure each one is known at prediction time." and "The values to predict are 0 or more and skewed. If your score is a relative error (such as RMSLE), set "Learning the target" to Logarithm." - Under Prediction type, choose Regression.
- Under Which columns should the model learn from?, Fione has unchecked
instant("Looks like an ID: every value is different, so it cannot help predict.") and checked the other 15. Uncheckcasualandregistered. Fione readsdtedayas Date; leave it checked. - Under Maximum run time (minutes), enter
10. Fione starts at 3, its recommendation for this size of data; a longer run can try more models. - Under Order of the rows in time, choose
dteday. - Keep Learning the target at As it is: we judge the model by its error in bikes, not by a relative error.
- Press Start training.

Order of the rows in time is explained under the field: "Choose a column of dates or numbers that orders the rows in time to check each model on later rows than it learned from, as when predicting the future. The earliest part is only learned from, and derived features are not tried. When other inputs move with time too (a day number, a year), the column's own number, or the year and the seconds of a date, are not used as inputs; a notice says so." So the checked Add derived features further down does not apply to this run. In our run, the training job's page (Training job on the Overview tab of Open advanced details, then See details) listed what the setting did:
validating on 5 later parts of the data in order of 'dteday'; the first part is only learned from. It holds 2,786 rows (about 4 months), and each validation part holds 2,760 to 2,790 rows (about 4 months)
So Fione cut the 23 months into 6 parts of about 4 months, in date order. Each of the other 5 parts was predicted by models that learned only from the parts before it: the first check learns from about 4 months, the last from about 19. The hours of one day always stay in the same part. Another notice said "derived features are not tried with a time column", and a third one is about dteday itself:
'dteday', the column that orders the rows in time, is not read as a number (or as the year and the seconds of a date): the rows to predict are later than all the rows the model learns from, so it would read their values as the latest period it knows. The inputs 'yr' move with it and carry the level over time
So the model does not use the year or the running date in dteday, which would be beyond anything it has seen for every later hour. It still reads the calendar in it (in Fione's code, the month, the day, the day of the week and of the year, and the week), and the growth from 2011 to 2012 comes through yr.
Read the results

In our run:
- Rating: 3 out of 5. "On rows it did not learn from, the model's predictions were typically off by about 74.2. Always guessing the average would be off by about 182."
- Guide: "Not bad! The model is useful. More data or a longer run may make it better still."
- About this model: a blend of 5 models, 189 models tried, training time 6:10.
- Most useful inputs:
hr36%,yr15%,dteday12%,mnth7%,temp7%.
For a number, the simple guess is the average: predict about 190 bikes for every hour. Its typical error is 182 bikes, the spread of cnt in train.csv. The model's typical error on the hours it did not learn from is 74 bikes. The rating is 1 − 74.2 / 182 ≈ 0.59, so the model takes away about 59% of the guess's error, in the band of 3 stars (0.4 to 0.6; How is the rating calculated? on the summary gives the formula and the bands).
Press Open advanced details and open the Metrics tab. Its figures are "Measured on rows the models did not learn from (cross-validation), for the final blend.", here "From the cross-validation predictions of 13,851 training rows.": all the hours but the first part, which is only learned from. In our run:
- RMSE 74.2: "Typical size of the error, in the column's own units. Lower is better." Here the units are bikes per hour. It squares each error before averaging, so a few large misses weigh heavily. It is the figure the rating and the summary use.
- MAE 47.5: "Average size of the error, in the column's own units. Lower is better." On average the prediction for an hour was about 48 bikes off, too high or too low.
- Median absolute error 27.5: for half of the hours the prediction was within about 28 bikes. The gap between this and the RMSE shows that most hours are predicted closely and some are far off.
- R² 0.85: "Share of the variation explained: 1 is perfect, 0 is no better than the average."
For planning, the MAE and the median are the easier figures to use: they say how many bikes the plan for one hour is typically off by. The Residuals part of the tab shows where the errors fall. In our run, for the tenth of the hours with the highest predictions (548 bikes on average), the actual rentals were on average 38 higher: the model tended to predict too low for the hours it expected to be busiest.
These figures come from later months than the models learned from. They include the early checks, where a model learned from the first four months of 2011 (88 bikes an hour on average) and predicted the months after them (190 an hour on average from May to August 2011). Make predictions checks the model on December 2012, which it never learned from.
Most useful inputs is captioned "The columns that moved the predictions most, as a share of all the columns' effect." Fione works this out on its own shortly after training (about 18 seconds after it in our run), by explaining the model's predictions on rows of the training data. The hour of the day (hr) comes first, by far: rentals rise and fall through the day. The year (yr) is second; 2012 had more rentals than 2011 (235 against 144 an hour on average); dteday (its calendar parts), the month and the temperature follow. Until that explanation is done, the summary shows a different list instead, captioned "The columns the model relied on most, as a share of all it used." and based on the training's own measure; that list stays on the Importance tab (in our run hr 55%, dteday 12%, yr 8%, workingday 8%, atemp 5%, temp 5%, and smaller shares for the rest).
To see what the order changes, we trained a second model on the same train.csv, with the same inputs and run time, but with Order of the rows in time left at Not in time (shuffled parts). Its training job said: "'dteday' holds dates, and no time_column is given, so the validation shuffles the rows. If the model will predict rows later than the ones it learns from, the score is probably better than it will be; name that column as time_column to validate on later parts". That model got 5 out of 5: "typically off by about 34.3" (MAE 20.6). Each hour it was checked on sat between hours it had learned from, often of the same day. On the hours of December 2012, which neither model learned from, it was off by 70.6 bikes typically (RMSE) and 44.1 on average (MAE): about twice what its summary said. The model trained above said 74.2 and was off by 60.9 (MAE 37.7) on the same hours. So in our run, the order in time gave the summary figure that was closer to how the model did on a later month, and the model that did better on it. Setting the order also changes more than how the models are checked: with it, derived features are not tried, while the shuffled run added some and tried 53 models, against 189. And one month is one check. Still, for a model that will predict the next days, judge it by the order in time.
Make predictions
Predict the 742 hours of December 2012 you set aside:
- On the Prediction summary, press Make predictions.
- Choose
new-hours.csvand press Upload. Fione says that "new-hours" (742 rows) has every column the model needs, and marksinstant,casual,registeredandcntas Not used by the model. Keepcntchecked under Columns in the result, so that you can compare each prediction with what happened. - Press Predict. Predictions shows 742 rows × 18 columns and Download predict_new-hours.csv.
predict is the predicted number of rentals in the hour. Some of the 742 rows in our run, by their place in the file (row 1 is midnight on 1 December):
| Row | Date and hour | Day | weathersit | predict | cnt (what happened) |
|---|---|---|---|---|---|
| 1 | 2012-12-01 0:00 | Saturday | 1 | 92 | 108 |
| 6 | 2012-12-01 5:00 | Saturday | 1 | 0 | 13 |
| 57 | 2012-12-03 8:00 | Monday, working | 1 | 619 | 731 |
| 66 | 2012-12-03 17:00 | Monday, working | 1 | 722 | 708 |
| 183 | 2012-12-08 14:00 | Saturday | 2 | 296 | 542 |
| 607 | 2012-12-26 8:00 | Wednesday, working | 3 | 322 | 31 |
Over the 742 hours, the prediction was off by 37.7 bikes on average (MAE) and 60.9 typically (RMSE); always guessing the training average of about 190 would have been off by 136 and 166. That is closer than the figures on the Metrics tab. The tab has no figure per part, so we cannot say why; two differences may play a part: the tab's figures include the early checks described above, which learned from fewer months, and December was quieter (167 bikes an hour on average) than most of the parts the tab was measured on (159 to 271 per part). Added up per day, the predicted rentals were within 5% of the real ones on 13 of the 31 days, all of them before 20 December and most of them working days. From 1 to 21 December the month's prediction was 4.9% too low in total; from 22 December on it was too high, most of all from 24 to 27 December, when about 2 to 4 times as many rentals were predicted as happened (on the 26th, 1,827 against 441). In the file only 25 December is marked as a holiday, and 24, 26 and 27 December are working days; much of the 26th also had rain or snow (weathersit 3). A model that learned from one Christmas week (2011) may not know how quiet these days are; an operator would check holiday weeks by hand.
The model never predicts fewer than 0 bikes: in Fione's code, a regression whose training values are all 0 or more has its predictions raised to 0 at the least, and 39 of the 742 hours were predicted as 0, most of them between 2:00 and 6:00. In those 39 hours, 9 bikes were rented on average, and never more than 49.
Under the table, Why these predictions shows, for the first 5 rows, the columns that moved each prediction most, in bikes. For row 1 (midnight on a Saturday) it starts from an average prediction of 190; the hour (hr, value 0) lowers it by 103, dteday raises it by 56, the month (mnth, value 12) lowers it by 44 and the temperature (temp, value 0.26) by 25, and the year (yr, value 1) raises it by 24; the other 8 columns together lower it by 7, ending at 92 (the figures are rounded).
Serve it as an API
Under Serve it from your own system, press Download the serving bundle. Unpack it into a directory of its own and run the command shown on the card there, as in the overview. Use the name of your file; for our model:
unzip fione-serving-cnt-model-2026-11-28-10-31-22.zip -d fione-serving-cnt-model-2026-11-28-10-31-22
cd fione-serving-cnt-model-2026-11-28-10-31-22
docker run --rm -p 8081:8080 -v "$PWD/model:/model:ro" ghcr.io/codelibs/fione-serving:snapshotIn another terminal, ask which columns the model expects:
curl -s localhost:8081/model{"names":["dteday","season","yr","mnth","hr","holiday","weekday","workingday","weathersit","temp","atemp","hum","windspeed","cnt"],
"domains":[null,null,null,null,null,null,null,null,null,null,null,null,null,null],
"responseColumn":"cnt","category":"Regression","nclasses":1,"nfeatures":13, ...}instant, casual and registered are not among the names: the model does not use them. Send rows 57 and 66 of new-hours.csv, 8:00 and 17:00 on Monday 3 December 2012:
curl -s -X POST localhost:8081/invocations -H 'Content-Type: application/json' -d '{"instances":[{"dteday":"2012-12-03","season":4,"yr":1,"mnth":12,"hr":8,"holiday":0,"weekday":1,"workingday":1,"weathersit":1,"temp":0.36,"atemp":0.3788,"hum":0.93,"windspeed":0},{"dteday":"2012-12-03","season":4,"yr":1,"mnth":12,"hr":17,"holiday":0,"weekday":1,"workingday":1,"weathersit":1,"temp":0.52,"atemp":0.5,"hum":0.63,"windspeed":0.1045}]}'{"predictions":[{"value":619.0162944578326},{"value":721.8032242143528}]}value is the predicted number of rentals: about 619 and 722, the same as predict for these rows under Make predictions. An operator's system would send the calendar and the weather forecast for each coming hour, and plan its bikes from the answers.
yr only holds 0 and 1 in the file, and Fione reads it as Category. In our run, the same Monday 8:00 dated 2 December 2013 gave 615 with yr 1 and 628 with yr 2: the model has never seen a year after 2012, so it cannot know how many rentals 2013 brings. To predict a later year, train again on data that includes it.
In our run, sending the numbers as strings such as "8", holiday, workingday and yr as JSON true/false, or adding instant, casual, registered and cnt to a row gave the same values; leaving out dteday or weathersit gave an error for that row ("missing columns").
From an AI tool
AI tools such as Claude and Codex can do the same through Fione's MCP endpoint: upload the CSV, train, read the results and predict. Ask the tool to leave casual and registered out of the inputs and to order the rows in time by dteday; propose_training_config takes it as time_column. Called directly over MCP for our dataset, the proposal left instant out by itself but kept casual and registered (it warned that registered "predicts the target on its own") and left time_column empty. As the file of December had already been uploaded for prediction, it also warned that the dates in dteday of the data to predict are all later than those of the training rows, and that setting time_column to it validates later rows after earlier ones. Check both before you train. For a few hours, the predict tool takes rows like the two above and returns predict for each. Called directly over MCP for the model trained above, it returned the same values as the API above (619.0 and 721.8). How to connect a client and what to ask is in Run the AutoML loop from an AI tool with MCP, the proposal in Proposals, and the predict tool in Predicting new rows.