Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
336 changes: 336 additions & 0 deletions data/input/test_time_series.csv

Large diffs are not rendered by default.

Binary file added data/input/test_time_series.xlsx
Binary file not shown.
145 changes: 145 additions & 0 deletions data/input/test_ts_passengers.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
Month,Passengers
1949-01,112
1949-02,118
1949-03,132
1949-04,129
1949-05,121
1949-06,135
1949-07,148
1949-08,148
1949-09,136
1949-10,119
1949-11,104
1949-12,118
1950-01,115
1950-02,126
1950-03,141
1950-04,135
1950-05,125
1950-06,149
1950-07,170
1950-08,170
1950-09,158
1950-10,133
1950-11,114
1950-12,140
1951-01,145
1951-02,150
1951-03,178
1951-04,163
1951-05,172
1951-06,178
1951-07,199
1951-08,199
1951-09,184
1951-10,162
1951-11,146
1951-12,166
1952-01,171
1952-02,180
1952-03,193
1952-04,181
1952-05,183
1952-06,218
1952-07,230
1952-08,242
1952-09,209
1952-10,191
1952-11,172
1952-12,194
1953-01,196
1953-02,196
1953-03,236
1953-04,235
1953-05,229
1953-06,243
1953-07,264
1953-08,272
1953-09,237
1953-10,211
1953-11,180
1953-12,201
1954-01,204
1954-02,188
1954-03,235
1954-04,227
1954-05,234
1954-06,264
1954-07,302
1954-08,293
1954-09,259
1954-10,229
1954-11,203
1954-12,229
1955-01,242
1955-02,233
1955-03,267
1955-04,269
1955-05,270
1955-06,315
1955-07,364
1955-08,347
1955-09,312
1955-10,274
1955-11,237
1955-12,278
1956-01,284
1956-02,277
1956-03,317
1956-04,313
1956-05,318
1956-06,374
1956-07,413
1956-08,405
1956-09,355
1956-10,306
1956-11,271
1956-12,306
1957-01,315
1957-02,301
1957-03,356
1957-04,348
1957-05,355
1957-06,422
1957-07,465
1957-08,467
1957-09,404
1957-10,347
1957-11,305
1957-12,336
1958-01,340
1958-02,318
1958-03,362
1958-04,348
1958-05,363
1958-06,435
1958-07,491
1958-08,505
1958-09,404
1958-10,359
1958-11,310
1958-12,337
1959-01,360
1959-02,342
1959-03,406
1959-04,396
1959-05,420
1959-06,472
1959-07,548
1959-08,559
1959-09,463
1959-10,407
1959-11,362
1959-12,405
1960-01,417
1960-02,391
1960-03,419
1960-04,461
1960-05,472
1960-06,535
1960-07,622
1960-08,606
1960-09,508
1960-10,461
1960-11,390
1960-12,432
23 changes: 12 additions & 11 deletions logs/cov.out
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Name Stmts Miss Cover Missing
-----------------------------------------------------------------------------------------
/media/ph33r/Data/Project/mllib/Git/mllib/__init__.py 7 0 100%
/media/ph33r/Data/Project/mllib/Git/mllib/lib/__init__.py 7 0 100%
/media/ph33r/Data/Project/mllib/Git/mllib/lib/cluster.py 103 0 100%
/media/ph33r/Data/Project/mllib/Git/mllib/lib/knn.py 70 0 100%
/media/ph33r/Data/Project/mllib/Git/mllib/lib/model.py 44 0 100%
/media/ph33r/Data/Project/mllib/Git/mllib/lib/opt.py 157 0 100%
/media/ph33r/Data/Project/mllib/Git/mllib/lib/tree.py 79 0 100%
-----------------------------------------------------------------------------------------
TOTAL 467 0 100%
Name Stmts Miss Cover Missing
-------------------------------------------------------
mllib/__init__.py 7 0 100%
mllib/lib/__init__.py 7 0 100%
mllib/lib/cluster.py 103 0 100%
mllib/lib/knn.py 70 0 100%
mllib/lib/model.py 44 0 100%
mllib/lib/opt.py 157 0 100%
mllib/lib/timeseries.py 85 0 100%
mllib/lib/tree.py 79 0 100%
-------------------------------------------------------
TOTAL 552 0 100%
2 changes: 1 addition & 1 deletion logs/pip.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
INFO: Successfully saved requirements file in /media/ph33r/Data/Project/mllib/Git/requirements.txt
./bin/run_tests.sh: line 78: pipreqs: command not found
9 changes: 9 additions & 0 deletions logs/pylint/lib-timeseries-py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
************* Module mllib.lib.timeseries
timeseries.py:188:41: I1101: Module 'metrics' has no 'rsq' member, but source is unavailable. Consider adding this module to extension-pkg-whitelist if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
timeseries.py:189:41: I1101: Module 'metrics' has no 'mae' member, but source is unavailable. Consider adding this module to extension-pkg-whitelist if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
timeseries.py:190:42: I1101: Module 'metrics' has no 'mape' member, but source is unavailable. Consider adding this module to extension-pkg-whitelist if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
timeseries.py:191:42: I1101: Module 'metrics' has no 'rmse' member, but source is unavailable. Consider adding this module to extension-pkg-whitelist if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

4 changes: 4 additions & 0 deletions logs/pylint/tests-test_timeseries-py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

26 changes: 24 additions & 2 deletions mllib/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from lib.tree import XGBoost # noqa: F841
from lib.opt import TSP # noqa: F841
from lib.opt import Transport # noqa: F841
from lib.timeseries import TimeSeries # noqa: F841

# =============================================================================
# --- DO NOT CHANGE ANYTHING FROM HERE
Expand Down Expand Up @@ -79,6 +80,7 @@
print("Clustering\n",
"optimal k = " + str(clus_sol.optimal_k),
elapsed_time("Time", start_t),
sep,
sep="\n")
# --- GLMNet
start_t = time.time_ns()
Expand All @@ -90,6 +92,7 @@
for k, v in glm_mod.model_summary.items():
print(k, str(v).rjust(69 - len(k)))
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- KNN
start_t = time.time_ns()
Expand All @@ -99,6 +102,7 @@
for k, v in mod.model_summary.items():
print(k, str(v).rjust(69 - len(k)))
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- Random forest
start_t = time.time_ns()
Expand All @@ -110,6 +114,7 @@
for k, v in mod.model_summary.items():
print(k, str(v).rjust(69 - len(k)))
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- XGBoost
start_t = time.time_ns()
Expand All @@ -121,6 +126,7 @@
for k, v in mod.model_summary.items():
print(k, str(v).rjust(69 - len(k)))
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- Travelling salesman
start_t = time.time_ns()
Expand All @@ -131,9 +137,10 @@
lat=df_ip["lat"].tolist(),
lon=df_ip["lng"].tolist(),
debug=False)
print("\nTSP\n")
print("\nTravelling salesman problem\n")
print("Optimal value:", round(opt[1], 3))
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- Transportation
start_t = time.time_ns()
Expand All @@ -144,8 +151,23 @@
c_lon = [-102.1, -103.0, -100.3, -106.8, -103.9, -101.6, -105.2]
prob = Transport(c_loc, c_demand, c_supply, c_lat, c_lon, 1)
opt_out = prob.solve(0)
print("\nTransportation\n")
print("\nTransportation problem\n")
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- Time series
start_t = time.time_ns()
df_ip = pd.read_excel(path + "input/test_time_series.xlsx",
sheet_name="product_01")
mod = TimeSeries(df=df_ip,
y_var="y",
x_var=["cost", "stock_level", "retail_price"],
ds="ds")
op = mod.model_summary
print("\nTime series\n")
print("R-squared:", op["rsq"])
print(elapsed_time("Time", start_t),
sep,
sep="\n")
# --- EOF
print(sep, elapsed_time("Total time", start), sep, sep="\n")
Loading