Added tensorflow and change dockerfile
This commit is contained in:
parent
bbe8adec6b
commit
82523ae1ba
@ -6,8 +6,10 @@ RUN apt-get install -y python3-pip
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./stats.py ./
|
||||
COPY ./tensor.py ./
|
||||
COPY requirements.txt ./
|
||||
|
||||
RUN pip3 install -r ./requirements.txt
|
||||
|
||||
CMD python3 stats.py
|
||||
CMD python3 stats.py
|
||||
CMD python3 tensor.py
|
20309
country_vaccinations.csv
20309
country_vaccinations.csv
File diff suppressed because it is too large
Load Diff
127
prediction_output.txt
Normal file
127
prediction_output.txt
Normal file
@ -0,0 +1,127 @@
|
||||
total_vaccinations people_vaccinated people_fully_vaccinated ... people_vaccinated_per_hundred people_fully_vaccinated_per_hundred daily_vaccinations_per_million
|
||||
84 3049.0 2438.0 611.0 ... 0.08 0.02 88.0
|
||||
238 15269.0 9781.0 4484.0 ... 12.66 5.80 7416.0
|
||||
440 265724.0 249372.0 16352.0 ... 0.55 0.04 259.0
|
||||
441 279602.0 254456.0 25146.0 ... 0.56 0.06 249.0
|
||||
442 288064.0 258876.0 29188.0 ... 0.57 0.06 246.0
|
||||
|
||||
[5 rows x 9 columns]
|
||||
Epoch 1/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 7676630.5000 - mean_absolute_error: 7676630.5000
2/2 [==============================] - 1s 164ms/step - loss: 5961069.5000 - mean_absolute_error: 5961069.5000 - val_loss: 1725398.7500 - val_mean_absolute_error: 1725398.7500
|
||||
Epoch 2/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 5299832.0000 - mean_absolute_error: 5299832.0000
2/2 [==============================] - 0s 19ms/step - loss: 4120319.6667 - mean_absolute_error: 4120319.6667 - val_loss: 434534.8125 - val_mean_absolute_error: 434534.8125
|
||||
Epoch 3/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 700024.2500 - mean_absolute_error: 700024.2500
2/2 [==============================] - 0s 39ms/step - loss: 1600838.5833 - mean_absolute_error: 1600838.5833 - val_loss: 372188.5938 - val_mean_absolute_error: 372188.5938
|
||||
Epoch 4/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 877540.5625 - mean_absolute_error: 877540.5625
2/2 [==============================] - 0s 18ms/step - loss: 1097719.6042 - mean_absolute_error: 1097719.6042 - val_loss: 867738.6250 - val_mean_absolute_error: 867738.6250
|
||||
Epoch 5/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 2417741.5000 - mean_absolute_error: 2417741.5000
2/2 [==============================] - 0s 19ms/step - loss: 2006790.1667 - mean_absolute_error: 2006790.1667 - val_loss: 565531.6250 - val_mean_absolute_error: 565531.6250
|
||||
Epoch 6/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1596502.5000 - mean_absolute_error: 1596502.5000
2/2 [==============================] - 0s 21ms/step - loss: 1416937.3333 - mean_absolute_error: 1416937.3333 - val_loss: 355957.2500 - val_mean_absolute_error: 355957.2500
|
||||
Epoch 7/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 2203131.5000 - mean_absolute_error: 2203131.5000
2/2 [==============================] - 0s 21ms/step - loss: 1693002.0000 - mean_absolute_error: 1693002.0000 - val_loss: 457820.4062 - val_mean_absolute_error: 457820.4062
|
||||
Epoch 8/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 2212300.7500 - mean_absolute_error: 2212300.7500
2/2 [==============================] - 0s 20ms/step - loss: 1803748.2500 - mean_absolute_error: 1803748.2500 - val_loss: 353270.5625 - val_mean_absolute_error: 353270.5625
|
||||
Epoch 9/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 2045295.2500 - mean_absolute_error: 2045295.2500
2/2 [==============================] - 0s 19ms/step - loss: 1666998.4167 - mean_absolute_error: 1666998.4167 - val_loss: 456352.3125 - val_mean_absolute_error: 456352.3125
|
||||
Epoch 10/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1038113.1875 - mean_absolute_error: 1038113.1875
2/2 [==============================] - 0s 19ms/step - loss: 1382889.2292 - mean_absolute_error: 1382889.1458 - val_loss: 506587.6562 - val_mean_absolute_error: 506587.6562
|
||||
Epoch 11/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1382150.1250 - mean_absolute_error: 1382150.1250
2/2 [==============================] - 0s 19ms/step - loss: 1484738.6250 - mean_absolute_error: 1484738.6250 - val_loss: 335040.9375 - val_mean_absolute_error: 335040.9375
|
||||
Epoch 12/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 442784.1875 - mean_absolute_error: 442784.1875
2/2 [==============================] - 0s 20ms/step - loss: 1007372.2292 - mean_absolute_error: 1007372.1458 - val_loss: 332617.4375 - val_mean_absolute_error: 332617.4375
|
||||
Epoch 13/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1771269.2500 - mean_absolute_error: 1771269.2500
2/2 [==============================] - 0s 19ms/step - loss: 1405508.2500 - mean_absolute_error: 1405508.2500 - val_loss: 413237.7500 - val_mean_absolute_error: 413237.7500
|
||||
Epoch 14/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1423864.2500 - mean_absolute_error: 1423864.2500
2/2 [==============================] - 0s 22ms/step - loss: 1375758.5833 - mean_absolute_error: 1375758.5833 - val_loss: 321141.3438 - val_mean_absolute_error: 321141.3438
|
||||
Epoch 15/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 470926.6250 - mean_absolute_error: 470926.6250
2/2 [==============================] - 0s 19ms/step - loss: 949873.1250 - mean_absolute_error: 949873.1250 - val_loss: 323380.1562 - val_mean_absolute_error: 323380.1562
|
||||
Epoch 16/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1510985.2500 - mean_absolute_error: 1510985.2500
2/2 [==============================] - 0s 23ms/step - loss: 1302573.8333 - mean_absolute_error: 1302573.8333 - val_loss: 413662.9688 - val_mean_absolute_error: 413662.9688
|
||||
Epoch 17/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1573781.7500 - mean_absolute_error: 1573781.7500
2/2 [==============================] - 0s 18ms/step - loss: 1380691.3333 - mean_absolute_error: 1380691.3333 - val_loss: 324099.6250 - val_mean_absolute_error: 324099.6250
|
||||
Epoch 18/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1448823.3750 - mean_absolute_error: 1448823.3750
2/2 [==============================] - 0s 21ms/step - loss: 1240958.3750 - mean_absolute_error: 1240958.3750 - val_loss: 332228.4062 - val_mean_absolute_error: 332228.4062
|
||||
Epoch 19/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1551623.6250 - mean_absolute_error: 1551623.6250
2/2 [==============================] - 0s 19ms/step - loss: 1200543.8333 - mean_absolute_error: 1200543.8333 - val_loss: 361183.7500 - val_mean_absolute_error: 361183.7500
|
||||
Epoch 20/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 569368.2500 - mean_absolute_error: 569368.2500
2/2 [==============================] - 0s 19ms/step - loss: 990733.2500 - mean_absolute_error: 990733.2500 - val_loss: 336409.0312 - val_mean_absolute_error: 336409.0312
|
||||
Epoch 21/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1519000.3750 - mean_absolute_error: 1519000.3750
2/2 [==============================] - 0s 24ms/step - loss: 1192645.5417 - mean_absolute_error: 1192645.5417 - val_loss: 695579.3125 - val_mean_absolute_error: 695579.3125
|
||||
Epoch 22/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1924370.8750 - mean_absolute_error: 1924370.8750
2/2 [==============================] - 0s 19ms/step - loss: 1694547.9583 - mean_absolute_error: 1694547.9583 - val_loss: 579635.5000 - val_mean_absolute_error: 579635.5000
|
||||
Epoch 23/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1090154.3750 - mean_absolute_error: 1090154.3750
2/2 [==============================] - 0s 19ms/step - loss: 1237068.2917 - mean_absolute_error: 1237068.2917 - val_loss: 338165.7500 - val_mean_absolute_error: 338165.7500
|
||||
Epoch 24/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1416364.7500 - mean_absolute_error: 1416364.7500
2/2 [==============================] - 0s 19ms/step - loss: 1132604.8750 - mean_absolute_error: 1132604.8750 - val_loss: 318366.4375 - val_mean_absolute_error: 318366.4375
|
||||
Epoch 25/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1544175.8750 - mean_absolute_error: 1544175.8750
2/2 [==============================] - 0s 20ms/step - loss: 1224863.4583 - mean_absolute_error: 1224863.4583 - val_loss: 452281.5625 - val_mean_absolute_error: 452281.5625
|
||||
Epoch 26/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1782579.0000 - mean_absolute_error: 1782579.0000
2/2 [==============================] - 0s 18ms/step - loss: 1504688.4167 - mean_absolute_error: 1504688.4167 - val_loss: 443007.0312 - val_mean_absolute_error: 443007.0312
|
||||
Epoch 27/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1162287.5000 - mean_absolute_error: 1162287.5000
2/2 [==============================] - 0s 19ms/step - loss: 1302917.1667 - mean_absolute_error: 1302917.1667 - val_loss: 320481.0000 - val_mean_absolute_error: 320481.0000
|
||||
Epoch 28/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1612289.5000 - mean_absolute_error: 1612289.5000
2/2 [==============================] - 0s 19ms/step - loss: 1271554.6667 - mean_absolute_error: 1271554.6667 - val_loss: 385278.8750 - val_mean_absolute_error: 385278.8750
|
||||
Epoch 29/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1395841.7500 - mean_absolute_error: 1395841.7500
2/2 [==============================] - 0s 19ms/step - loss: 1277284.2500 - mean_absolute_error: 1277284.2500 - val_loss: 300888.1875 - val_mean_absolute_error: 300888.1875
|
||||
Epoch 30/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1202591.1250 - mean_absolute_error: 1202591.1250
2/2 [==============================] - 0s 20ms/step - loss: 1134274.2917 - mean_absolute_error: 1134274.2917 - val_loss: 325781.4688 - val_mean_absolute_error: 325781.4688
|
||||
Epoch 31/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 661265.0625 - mean_absolute_error: 661265.0625
2/2 [==============================] - 0s 19ms/step - loss: 1016421.6042 - mean_absolute_error: 1016421.6042 - val_loss: 353492.4688 - val_mean_absolute_error: 353492.4688
|
||||
Epoch 32/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1591155.3750 - mean_absolute_error: 1591155.3750
2/2 [==============================] - 0s 19ms/step - loss: 1239793.2083 - mean_absolute_error: 1239793.2083 - val_loss: 359100.2188 - val_mean_absolute_error: 359100.2188
|
||||
Epoch 33/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 808328.2500 - mean_absolute_error: 808328.2500
2/2 [==============================] - 0s 21ms/step - loss: 1039190.6667 - mean_absolute_error: 1039190.6667 - val_loss: 348413.0938 - val_mean_absolute_error: 348413.0938
|
||||
Epoch 34/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 782810.7500 - mean_absolute_error: 782810.7500
2/2 [==============================] - 0s 19ms/step - loss: 1048635.5000 - mean_absolute_error: 1048635.5000 - val_loss: 322682.6875 - val_mean_absolute_error: 322682.6875
|
||||
Epoch 35/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1393856.6250 - mean_absolute_error: 1393856.6250
2/2 [==============================] - 0s 21ms/step - loss: 1152652.8333 - mean_absolute_error: 1152652.8333 - val_loss: 378382.9688 - val_mean_absolute_error: 378382.9688
|
||||
Epoch 36/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1634352.7500 - mean_absolute_error: 1634352.7500
2/2 [==============================] - 0s 19ms/step - loss: 1275270.8333 - mean_absolute_error: 1275270.8333 - val_loss: 357441.0312 - val_mean_absolute_error: 357441.0312
|
||||
Epoch 37/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 522431.5625 - mean_absolute_error: 522431.5625
2/2 [==============================] - 0s 20ms/step - loss: 856654.4375 - mean_absolute_error: 856654.4375 - val_loss: 383844.2500 - val_mean_absolute_error: 383844.2500
|
||||
Epoch 38/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1112097.2500 - mean_absolute_error: 1112097.2500
2/2 [==============================] - 0s 18ms/step - loss: 1140928.5833 - mean_absolute_error: 1140928.5833 - val_loss: 308890.8125 - val_mean_absolute_error: 308890.8125
|
||||
Epoch 39/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1396550.0000 - mean_absolute_error: 1396550.0000
2/2 [==============================] - 0s 18ms/step - loss: 1157512.6667 - mean_absolute_error: 1157512.6667 - val_loss: 475381.6562 - val_mean_absolute_error: 475381.6562
|
||||
Epoch 40/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1889031.5000 - mean_absolute_error: 1889031.5000
2/2 [==============================] - 0s 20ms/step - loss: 1458477.3333 - mean_absolute_error: 1458477.3333 - val_loss: 438683.0938 - val_mean_absolute_error: 438683.0938
|
||||
Epoch 41/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1633943.2500 - mean_absolute_error: 1633943.2500
2/2 [==============================] - 0s 19ms/step - loss: 1369526.5833 - mean_absolute_error: 1369526.5833 - val_loss: 629599.3750 - val_mean_absolute_error: 629599.3750
|
||||
Epoch 42/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1192811.7500 - mean_absolute_error: 1192811.7500
2/2 [==============================] - 0s 20ms/step - loss: 1415090.9167 - mean_absolute_error: 1415090.9167 - val_loss: 490708.5625 - val_mean_absolute_error: 490708.5625
|
||||
Epoch 43/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1101619.8750 - mean_absolute_error: 1101619.8750
2/2 [==============================] - 0s 19ms/step - loss: 1115088.4583 - mean_absolute_error: 1115088.4583 - val_loss: 383952.4062 - val_mean_absolute_error: 383952.4062
|
||||
Epoch 44/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1406772.8750 - mean_absolute_error: 1406772.8750
2/2 [==============================] - 0s 18ms/step - loss: 1261550.7083 - mean_absolute_error: 1261550.7083 - val_loss: 712067.9375 - val_mean_absolute_error: 712067.9375
|
||||
Epoch 45/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1262245.0000 - mean_absolute_error: 1262245.0000
2/2 [==============================] - 0s 19ms/step - loss: 1677962.8333 - mean_absolute_error: 1677962.9167 - val_loss: 361587.1250 - val_mean_absolute_error: 361587.1250
|
||||
Epoch 46/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 407892.2188 - mean_absolute_error: 407892.2188
2/2 [==============================] - 0s 20ms/step - loss: 719201.3646 - mean_absolute_error: 719201.3229 - val_loss: 544281.3125 - val_mean_absolute_error: 544281.3125
|
||||
Epoch 47/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 2059337.5000 - mean_absolute_error: 2059337.5000
2/2 [==============================] - 0s 21ms/step - loss: 1625181.0833 - mean_absolute_error: 1625181.0833 - val_loss: 742801.3125 - val_mean_absolute_error: 742801.3125
|
||||
Epoch 48/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 2169220.2500 - mean_absolute_error: 2169220.2500
2/2 [==============================] - 0s 18ms/step - loss: 1868214.0000 - mean_absolute_error: 1868214.0000 - val_loss: 686543.9375 - val_mean_absolute_error: 686543.9375
|
||||
Epoch 49/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 1705340.5000 - mean_absolute_error: 1705340.5000
2/2 [==============================] - 0s 20ms/step - loss: 1644617.3333 - mean_absolute_error: 1644617.3333 - val_loss: 363351.9062 - val_mean_absolute_error: 363351.9062
|
||||
Epoch 50/50
|
||||
1/2 [==============>...............] - ETA: 0s - loss: 363015.6875 - mean_absolute_error: 363015.6875
2/2 [==============================] - 0s 18ms/step - loss: 858701.3125 - mean_absolute_error: 858701.3125 - val_loss: 432268.9688 - val_mean_absolute_error: 432268.9688
|
||||
[[5.3556664e+04]
|
||||
[6.2673328e+07]
|
||||
[3.1875232e+04]
|
||||
[5.8609130e+06]
|
||||
[1.2883354e+02]
|
||||
[1.5984141e+07]
|
||||
[9.9183394e+05]
|
||||
[5.0937570e+06]
|
||||
[8.1551306e+05]
|
||||
[1.7867736e+05]
|
||||
[1.8573296e+06]
|
||||
[1.7717861e+04]
|
||||
[2.1812611e+08]
|
||||
[9.2281578e+04]
|
||||
[1.0874774e+07]
|
||||
[5.2226612e+05]
|
||||
[2.5650620e+06]
|
||||
[6.0649496e+04]
|
||||
[2.4859479e+04]]
|
@ -3,4 +3,5 @@ matplotlib==3.3.4
|
||||
numpy==1.19.5
|
||||
pandas==1.1.5
|
||||
sklearn==0.0
|
||||
tensorflow==2.5.0rc1
|
||||
wget==3.2
|
42
tensor.py
Normal file
42
tensor.py
Normal file
@ -0,0 +1,42 @@
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import tensorflow as tf
|
||||
import sys
|
||||
from tensorflow import keras
|
||||
from sklearn.metrics import r2_score, mean_squared_error
|
||||
from math import sqrt
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn import preprocessing
|
||||
# Importing the dataset
|
||||
|
||||
url = 'https://git.wmi.amu.edu.pl/s434804/ium_434804/raw/branch/master/country_vaccinations.csv'
|
||||
wget.download(url, out='country_vaccinations.csv', bar=None)
|
||||
|
||||
df = pd.read_csv('country_vaccinations.csv').dropna()
|
||||
dataset = df.iloc[:, 3:-3]
|
||||
sys.stdout=open("prediction_output.txt","w")
|
||||
print(dataset.head())
|
||||
dataset = df.groupby(by=["country"], dropna=True).sum()
|
||||
X = dataset.loc[:,dataset.columns != "daily_vaccinations"]
|
||||
y = dataset.loc[:,dataset.columns == "daily_vaccinations"]
|
||||
|
||||
# Splitting the dataset into the Training set and Test set
|
||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 42)
|
||||
|
||||
# Feature Scaling
|
||||
model = keras.Sequential([
|
||||
keras.layers.Dense(512,input_dim = X_train.shape[1],kernel_initializer='normal', activation='relu'),
|
||||
keras.layers.Dense(512,kernel_initializer='normal', activation='relu'),
|
||||
keras.layers.Dense(256,kernel_initializer='normal', activation='relu'),
|
||||
keras.layers.Dense(256,kernel_initializer='normal', activation='relu'),
|
||||
keras.layers.Dense(128,kernel_initializer='normal', activation='relu'),
|
||||
keras.layers.Dense(1,kernel_initializer='normal', activation='linear'),
|
||||
])
|
||||
|
||||
model.compile(loss='mean_absolute_error', optimizer='adam', metrics=['mean_absolute_error'])
|
||||
|
||||
model.fit(X_train, y_train, epochs=50, validation_split = 0.3)
|
||||
|
||||
prediction = model.predict(X_test)
|
||||
print(prediction)
|
||||
sys.stdout.close()
|
Loading…
Reference in New Issue
Block a user