-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
146 lines (122 loc) · 5.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Seoul Bike Sharing Demand Data Pipeline
# date: 2024-12-14
.PHONY: all dats preprocess eda fit evaluate clean clean-dats clean-figs clean-tables clean-models clean-reports
# Runs the entire pipeline and generates both HTML and PDF reports
all: report/rental_bike_prediction.html report/rental_bike_prediction.pdf
# Downloads raw data from UCI and writes it to the data/raw directory
dats: data/raw/SeoulBikeData.csv
# Commands for downloading the data
data/raw/SeoulBikeData.csv: scripts/data_loading_n_validation.py
python scripts/data_loading_n_validation.py \
--url="https://archive.ics.uci.edu/static/public/560/seoul+bike+sharing+demand.zip" \
--write_to=data/raw
# Splits and preprocesses the raw data into training and testing sets
preprocess: data/processed/bike_train.csv \
data/processed/bike_test.csv \
results/models/bike_preprocessor.pickle
# Commands for preprocessing
data/processed/bike_train.csv \
data/processed/bike_test.csv \
results/models/bike_preprocessor.pickle: scripts/split_n_preprocessing.py \
data/raw/SeoulBikeData.csv
python scripts/split_n_preprocessing.py \
--raw_data=data/raw/SeoulBikeData.csv \
--data_to=data/processed \
--preprocessor_to=results/models \
--seed=522
# Performs Exploratory Data Analysis (EDA) and generates plots and tables
eda: results/tables/missing_values.csv \
results/tables/summary_stats.csv \
results/figures/rented_bike_count.png \
results/figures/hourly_rental_count.png \
results/figures/season_rental_count.png \
results/figures/season_temp_count.png \
results/figures/holiday_dist.png \
results/figures/season_hourly.png \
results/figures/corr_chart.png
# Commands for EDA
results/tables/missing_values.csv \
results/tables/summary_stats.csv \
results/figures/rented_bike_count.png \
results/figures/hourly_rental_count.png \
results/figures/season_rental_count.png \
results/figures/season_temp_count.png \
results/figures/holiday_dist.png \
results/figures/season_hourly.png \
results/figures/corr_chart.png: scripts/eda.py data/processed/bike_train.csv
python scripts/eda.py \
--processed_training_data=data/processed/bike_train.csv \
--plot_to=results/figures --table_to=results/tables
# Fits the Ridge and Tree regression model for rental bike prediction
fit: results/models/ridge_pipeline.pickle \
results/models/tree_pipeline.pickle
# Commands for fitting both models
results/models/ridge_pipeline.pickle \
results/models/tree_pipeline.pickle: scripts/fit_rental_bike_prediction.py data/processed/bike_train.csv results/models/bike_preprocessor.pickle
python scripts/fit_rental_bike_prediction.py \
--training-data=data/processed/bike_train.csv \
--preprocessor=results/models/bike_preprocessor.pickle \
--pipeline-to=results/models \
--seed=522
# Evaluates the rental bike prediction models on the test data
evaluate: results/figures/prediction_error_ridge.png \
results/figures/prediction_error_tree.png \
results/tables/test_scores.csv
# Commands for evaluating both models
results/figures/prediction_error_ridge.png \
results/figures/prediction_error_tree.png \
results/tables/test_scores.csv: scripts/evaluate_rental_bike_prediction.py \
data/processed/bike_test.csv \
results/models/ridge_pipeline.pickle \
results/models/tree_pipeline.pickle
python scripts/evaluate_rental_bike_prediction.py \
--test-data=data/processed/bike_test.csv \
--pipeline-from-ridge=results/models/ridge_pipeline.pickle \
--pipeline-from-tree=results/models/tree_pipeline.pickle \
--results-to=results/tables \
--seed=522 \
--plot_to=results/figures
# This will trigger the report generation (Used in all)
report/rental_bike_prediction.html \
report/rental_bike_prediction.pdf: report/rental_bike_prediction.qmd \
report/references.bib \
results/tables/test_scores.csv \
results/tables/summary_stats.csv \
results/models/ridge_pipeline.pickle \
results/models/tree_pipeline.pickle \
results/figures/prediction_error_ridge.png \
results/figures/prediction_error_tree.png
quarto render report/rental_bike_prediction.qmd --to html
quarto render report/rental_bike_prediction.qmd --to pdf
# Removes all generated outputs from the data pipeline
clean-dats :
rm -rf data/raw/*
rm -rf data/processed/bike_train.csv \
data/processed/bike_test.csv
clean-figs :
rm -f results/figures/rented_bike_count.png \
results/figures/hourly_rental_count.png \
results/figures/season_rental_count.png \
results/figures/season_temp_count.png \
results/figures/holiday_dist.png \
results/figures/season_hourly.png \
results/figures/prediction_error_ridge.png \
results/figures/prediction_error_tree.png \
results/figures/corr_chart.png
clean-tables :
rm -f results/tables/summary_stats.csv \
results/tables/missing_values.csv \
results/tables/test_scores.csv
clean-models :
rm -f results/models/ridge_pipeline.pickle \
results/models/tree_pipeline.pickle \
results/models/bike_preprocessor.pickle
clean-reports :
rm -rf report/rental_bike_prediction.html \
report/rental_bike_prediction.pdf \
report/rental_bike_prediction_files
clean: clean-dats \
clean-figs \
clean-tables \
clean-models \
clean-reports