sacred my runs
This commit is contained in:
parent
5e4ac37a43
commit
d4912c0bdc
6
ium_s434766/my_runs/1/config.json
Normal file
6
ium_s434766/my_runs/1/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"batch_size": 16,
|
||||
"learning_rate": 0.001,
|
||||
"num_epochs": 15,
|
||||
"seed": 397973104
|
||||
}
|
4
ium_s434766/my_runs/1/cout.txt
Normal file
4
ium_s434766/my_runs/1/cout.txt
Normal file
@ -0,0 +1,4 @@
|
||||
INFO - ium_s434766 - Running command 'my_main'
|
||||
INFO - ium_s434766 - Started run with ID "1"
|
||||
INFO - train - Batch size = 16 Epochs = 15
|
||||
INFO - train - Last loss = 0.32308459281921387
|
1
ium_s434766/my_runs/1/metrics.json
Normal file
1
ium_s434766/my_runs/1/metrics.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
67
ium_s434766/my_runs/1/run.json
Normal file
67
ium_s434766/my_runs/1/run.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"artifacts": [],
|
||||
"command": "my_main",
|
||||
"experiment": {
|
||||
"base_dir": "/home/przemek/ium_434766",
|
||||
"dependencies": [
|
||||
"numpy==1.20.1",
|
||||
"pandas==1.2.4",
|
||||
"sacred==0.8.2",
|
||||
"scikit-learn==0.24.1",
|
||||
"torch==1.8.1"
|
||||
],
|
||||
"mainfile": "sacred-pytorch1.py",
|
||||
"name": "ium_s434766",
|
||||
"repositories": [],
|
||||
"sources": [
|
||||
[
|
||||
"sacred-pytorch1.py",
|
||||
"_sources/sacred-pytorch1_37f3ae3f09d3a85faa1cb43617a6d59e.py"
|
||||
]
|
||||
]
|
||||
},
|
||||
"heartbeat": "2021-05-16T16:01:49.590955",
|
||||
"host": {
|
||||
"ENV": {},
|
||||
"cpu": "Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz",
|
||||
"hostname": "OwczarPC",
|
||||
"os": [
|
||||
"Linux",
|
||||
"Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.29"
|
||||
],
|
||||
"python_version": "3.8.5"
|
||||
},
|
||||
"meta": {
|
||||
"command": "my_main",
|
||||
"options": {
|
||||
"--beat-interval": null,
|
||||
"--capture": null,
|
||||
"--comment": null,
|
||||
"--debug": false,
|
||||
"--enforce_clean": false,
|
||||
"--file_storage": null,
|
||||
"--force": false,
|
||||
"--help": false,
|
||||
"--loglevel": null,
|
||||
"--mongo_db": null,
|
||||
"--name": null,
|
||||
"--pdb": false,
|
||||
"--print-config": false,
|
||||
"--priority": null,
|
||||
"--queue": false,
|
||||
"--s3": null,
|
||||
"--sql": null,
|
||||
"--tiny_db": null,
|
||||
"--unobserved": false,
|
||||
"COMMAND": null,
|
||||
"UPDATE": [],
|
||||
"help": false,
|
||||
"with": false
|
||||
}
|
||||
},
|
||||
"resources": [],
|
||||
"result": null,
|
||||
"start_time": "2021-05-16T16:01:49.507065",
|
||||
"status": "COMPLETED",
|
||||
"stop_time": "2021-05-16T16:01:49.589890"
|
||||
}
|
6
ium_s434766/my_runs/2/config.json
Normal file
6
ium_s434766/my_runs/2/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"batch_size": 16,
|
||||
"learning_rate": 0.001,
|
||||
"num_epochs": 15,
|
||||
"seed": 9915532
|
||||
}
|
5
ium_s434766/my_runs/2/cout.txt
Normal file
5
ium_s434766/my_runs/2/cout.txt
Normal file
@ -0,0 +1,5 @@
|
||||
INFO - ium_s434766 - Running command 'my_main'
|
||||
INFO - ium_s434766 - Started run with ID "2"
|
||||
INFO - train - Batch size = 16 Epochs = 15
|
||||
INFO - train - Last loss = 0.29651644825935364
|
||||
INFO - ium_s434766 - Completed after 0:00:00
|
1
ium_s434766/my_runs/2/metrics.json
Normal file
1
ium_s434766/my_runs/2/metrics.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
63
ium_s434766/my_runs/2/run.json
Normal file
63
ium_s434766/my_runs/2/run.json
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"artifacts": [],
|
||||
"command": "my_main",
|
||||
"experiment": {
|
||||
"base_dir": "/home/przemek/ium_434766",
|
||||
"dependencies": [
|
||||
"numpy==1.20.1",
|
||||
"pandas==1.2.4",
|
||||
"sacred==0.8.2",
|
||||
"scikit-learn==0.24.1",
|
||||
"torch==1.8.1"
|
||||
],
|
||||
"mainfile": "sacred-pytorch1.py",
|
||||
"name": "ium_s434766",
|
||||
"repositories": [],
|
||||
"sources": [
|
||||
[
|
||||
"sacred-pytorch1.py",
|
||||
"_sources/sacred-pytorch1_37f3ae3f09d3a85faa1cb43617a6d59e.py"
|
||||
]
|
||||
]
|
||||
},
|
||||
"heartbeat": "2021-05-16T16:01:49.672141",
|
||||
"host": {
|
||||
"ENV": {},
|
||||
"cpu": "Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz",
|
||||
"hostname": "OwczarPC",
|
||||
"os": [
|
||||
"Linux",
|
||||
"Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.29"
|
||||
],
|
||||
"python_version": "3.8.5"
|
||||
},
|
||||
"meta": {
|
||||
"command": "my_main",
|
||||
"options": {
|
||||
"--beat-interval": null,
|
||||
"--capture": null,
|
||||
"--comment": null,
|
||||
"--debug": false,
|
||||
"--enforce_clean": false,
|
||||
"--file_storage": null,
|
||||
"--force": false,
|
||||
"--help": false,
|
||||
"--loglevel": null,
|
||||
"--mongo_db": null,
|
||||
"--name": null,
|
||||
"--pdb": false,
|
||||
"--print-config": false,
|
||||
"--priority": null,
|
||||
"--queue": false,
|
||||
"--s3": null,
|
||||
"--sql": null,
|
||||
"--tiny_db": null,
|
||||
"--unobserved": false
|
||||
}
|
||||
},
|
||||
"resources": [],
|
||||
"result": null,
|
||||
"start_time": "2021-05-16T16:01:49.643954",
|
||||
"status": "COMPLETED",
|
||||
"stop_time": "2021-05-16T16:01:49.670359"
|
||||
}
|
6
ium_s434766/my_runs/3/config.json
Normal file
6
ium_s434766/my_runs/3/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"batch_size": 16,
|
||||
"learning_rate": 0.001,
|
||||
"num_epochs": 15,
|
||||
"seed": 400864859
|
||||
}
|
4
ium_s434766/my_runs/3/cout.txt
Normal file
4
ium_s434766/my_runs/3/cout.txt
Normal file
@ -0,0 +1,4 @@
|
||||
INFO - ium_s434766 - Running command 'my_main'
|
||||
INFO - ium_s434766 - Started run with ID "3"
|
||||
INFO - train - Batch size = 16 Epochs = 15
|
||||
INFO - train - Last loss = 0.8644022345542908
|
1
ium_s434766/my_runs/3/metrics.json
Normal file
1
ium_s434766/my_runs/3/metrics.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
67
ium_s434766/my_runs/3/run.json
Normal file
67
ium_s434766/my_runs/3/run.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"artifacts": [],
|
||||
"command": "my_main",
|
||||
"experiment": {
|
||||
"base_dir": "/home/przemek/ium_434766",
|
||||
"dependencies": [
|
||||
"numpy==1.20.1",
|
||||
"pandas==1.2.4",
|
||||
"sacred==0.8.2",
|
||||
"scikit-learn==0.24.1",
|
||||
"torch==1.8.1"
|
||||
],
|
||||
"mainfile": "sacred-pytorch1.py",
|
||||
"name": "ium_s434766",
|
||||
"repositories": [],
|
||||
"sources": [
|
||||
[
|
||||
"sacred-pytorch1.py",
|
||||
"_sources/sacred-pytorch1_e0e75cc8f994d35ec0d404b605721131.py"
|
||||
]
|
||||
]
|
||||
},
|
||||
"heartbeat": "2021-05-16T16:02:13.422226",
|
||||
"host": {
|
||||
"ENV": {},
|
||||
"cpu": "Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz",
|
||||
"hostname": "OwczarPC",
|
||||
"os": [
|
||||
"Linux",
|
||||
"Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.29"
|
||||
],
|
||||
"python_version": "3.8.5"
|
||||
},
|
||||
"meta": {
|
||||
"command": "my_main",
|
||||
"options": {
|
||||
"--beat-interval": null,
|
||||
"--capture": null,
|
||||
"--comment": null,
|
||||
"--debug": false,
|
||||
"--enforce_clean": false,
|
||||
"--file_storage": null,
|
||||
"--force": false,
|
||||
"--help": false,
|
||||
"--loglevel": null,
|
||||
"--mongo_db": null,
|
||||
"--name": null,
|
||||
"--pdb": false,
|
||||
"--print-config": false,
|
||||
"--priority": null,
|
||||
"--queue": false,
|
||||
"--s3": null,
|
||||
"--sql": null,
|
||||
"--tiny_db": null,
|
||||
"--unobserved": false,
|
||||
"COMMAND": null,
|
||||
"UPDATE": [],
|
||||
"help": false,
|
||||
"with": false
|
||||
}
|
||||
},
|
||||
"resources": [],
|
||||
"result": null,
|
||||
"start_time": "2021-05-16T16:02:13.390881",
|
||||
"status": "COMPLETED",
|
||||
"stop_time": "2021-05-16T16:02:13.420375"
|
||||
}
|
6
ium_s434766/my_runs/4/config.json
Normal file
6
ium_s434766/my_runs/4/config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"batch_size": 16,
|
||||
"learning_rate": 0.001,
|
||||
"num_epochs": 15,
|
||||
"seed": 562374018
|
||||
}
|
4
ium_s434766/my_runs/4/cout.txt
Normal file
4
ium_s434766/my_runs/4/cout.txt
Normal file
@ -0,0 +1,4 @@
|
||||
INFO - ium_s434766 - Running command 'my_main'
|
||||
INFO - ium_s434766 - Started run with ID "4"
|
||||
INFO - train - Batch size = 16 Epochs = 15
|
||||
INFO - train - Last loss = 0.2932703197002411
|
1
ium_s434766/my_runs/4/metrics.json
Normal file
1
ium_s434766/my_runs/4/metrics.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
65
ium_s434766/my_runs/4/run.json
Normal file
65
ium_s434766/my_runs/4/run.json
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"artifacts": [
|
||||
"stroke.pth"
|
||||
],
|
||||
"command": "my_main",
|
||||
"experiment": {
|
||||
"base_dir": "/home/przemek/ium_434766",
|
||||
"dependencies": [
|
||||
"numpy==1.20.1",
|
||||
"pandas==1.2.4",
|
||||
"sacred==0.8.2",
|
||||
"scikit-learn==0.24.1",
|
||||
"torch==1.8.1"
|
||||
],
|
||||
"mainfile": "sacred-pytorch1.py",
|
||||
"name": "ium_s434766",
|
||||
"repositories": [],
|
||||
"sources": [
|
||||
[
|
||||
"sacred-pytorch1.py",
|
||||
"_sources/sacred-pytorch1_e0e75cc8f994d35ec0d404b605721131.py"
|
||||
]
|
||||
]
|
||||
},
|
||||
"heartbeat": "2021-05-16T16:02:13.502327",
|
||||
"host": {
|
||||
"ENV": {},
|
||||
"cpu": "Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz",
|
||||
"hostname": "OwczarPC",
|
||||
"os": [
|
||||
"Linux",
|
||||
"Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.29"
|
||||
],
|
||||
"python_version": "3.8.5"
|
||||
},
|
||||
"meta": {
|
||||
"command": "my_main",
|
||||
"options": {
|
||||
"--beat-interval": null,
|
||||
"--capture": null,
|
||||
"--comment": null,
|
||||
"--debug": false,
|
||||
"--enforce_clean": false,
|
||||
"--file_storage": null,
|
||||
"--force": false,
|
||||
"--help": false,
|
||||
"--loglevel": null,
|
||||
"--mongo_db": null,
|
||||
"--name": null,
|
||||
"--pdb": false,
|
||||
"--print-config": false,
|
||||
"--priority": null,
|
||||
"--queue": false,
|
||||
"--s3": null,
|
||||
"--sql": null,
|
||||
"--tiny_db": null,
|
||||
"--unobserved": false
|
||||
}
|
||||
},
|
||||
"resources": [],
|
||||
"result": null,
|
||||
"start_time": "2021-05-16T16:02:13.476148",
|
||||
"status": "COMPLETED",
|
||||
"stop_time": "2021-05-16T16:02:13.501265"
|
||||
}
|
BIN
ium_s434766/my_runs/4/stroke.pth
Normal file
BIN
ium_s434766/my_runs/4/stroke.pth
Normal file
Binary file not shown.
@ -0,0 +1,85 @@
|
||||
import torch
|
||||
import sys
|
||||
import torch.nn.functional as F
|
||||
from torch import nn
|
||||
from sklearn.metrics import accuracy_score, mean_squared_error
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from sacred import Experiment
|
||||
from sacred.observers import FileStorageObserver
|
||||
|
||||
np.set_printoptions(suppress=False)
|
||||
|
||||
ex = Experiment("ium_s434766", interactive=False, save_git_info=False)
|
||||
ex.observers.append(FileStorageObserver("ium_s434766/my_runs"))
|
||||
|
||||
@ex.config
|
||||
def my_config():
|
||||
num_epochs = 15
|
||||
batch_size = 16
|
||||
learning_rate = 0.001
|
||||
|
||||
class LogisticRegressionModel(nn.Module):
|
||||
def __init__(self, input_dim, output_dim):
|
||||
super(LogisticRegressionModel, self).__init__()
|
||||
self.linear = nn.Linear(input_dim, output_dim)
|
||||
self.sigmoid = nn.Sigmoid()
|
||||
def forward(self, x):
|
||||
out = self.linear(x)
|
||||
return self.sigmoid(out)
|
||||
|
||||
@ex.capture
|
||||
def train(num_epochs, batch_size, learning_rate, _log):
|
||||
data_train = pd.read_csv("data_train.csv")
|
||||
data_test = pd.read_csv("data_test.csv")
|
||||
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
|
||||
|
||||
x_train = data_train[FEATURES].astype(np.float32)
|
||||
y_train = data_train['stroke'].astype(np.float32)
|
||||
|
||||
x_test = data_test[FEATURES].astype(np.float32)
|
||||
y_test = data_test['stroke'].astype(np.float32)
|
||||
|
||||
fTrain = torch.from_numpy(x_train.values)
|
||||
tTrain = torch.from_numpy(y_train.values.reshape(2945,1))
|
||||
|
||||
fTest= torch.from_numpy(x_test.values)
|
||||
tTest = torch.from_numpy(y_test.values)
|
||||
|
||||
|
||||
input_dim = 6
|
||||
output_dim = 1
|
||||
info_params = "Batch size = " + str(batch_size) + " Epochs = " + str(num_epochs)
|
||||
_log.info(info_params)
|
||||
model = LogisticRegressionModel(input_dim, output_dim)
|
||||
|
||||
criterion = torch.nn.BCELoss(reduction='mean')
|
||||
optimizer = torch.optim.SGD(model.parameters(), lr = learning_rate)
|
||||
|
||||
for epoch in range(num_epochs):
|
||||
# print ("Epoch #",epoch)
|
||||
model.train()
|
||||
optimizer.zero_grad()
|
||||
# Forward pass
|
||||
y_pred = model(fTrain)
|
||||
# Compute Loss
|
||||
loss = criterion(y_pred, tTrain)
|
||||
# print(loss.item())
|
||||
# Backward pass
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
|
||||
info_loss = "Last loss = " + str(loss.item())
|
||||
_log.info(info_loss)
|
||||
y_pred = model(fTest)
|
||||
# print("predicted Y value: ", y_pred.data)
|
||||
|
||||
torch.save(model.state_dict(), 'stroke.pth')
|
||||
|
||||
|
||||
@ex.automain
|
||||
def my_main(num_epochs, batch_size, learning_rate, _run):
|
||||
train()
|
||||
|
||||
r = ex.run()
|
||||
ex.add_artifact("stroke_model/stroke.pth")
|
@ -0,0 +1,85 @@
|
||||
import torch
|
||||
import sys
|
||||
import torch.nn.functional as F
|
||||
from torch import nn
|
||||
from sklearn.metrics import accuracy_score, mean_squared_error
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from sacred import Experiment
|
||||
from sacred.observers import FileStorageObserver
|
||||
|
||||
np.set_printoptions(suppress=False)
|
||||
|
||||
ex = Experiment("ium_s434766", interactive=False, save_git_info=False)
|
||||
ex.observers.append(FileStorageObserver("ium_s434766/my_runs"))
|
||||
|
||||
@ex.config
|
||||
def my_config():
|
||||
num_epochs = 15
|
||||
batch_size = 16
|
||||
learning_rate = 0.001
|
||||
|
||||
class LogisticRegressionModel(nn.Module):
|
||||
def __init__(self, input_dim, output_dim):
|
||||
super(LogisticRegressionModel, self).__init__()
|
||||
self.linear = nn.Linear(input_dim, output_dim)
|
||||
self.sigmoid = nn.Sigmoid()
|
||||
def forward(self, x):
|
||||
out = self.linear(x)
|
||||
return self.sigmoid(out)
|
||||
|
||||
@ex.capture
|
||||
def train(num_epochs, batch_size, learning_rate, _log):
|
||||
data_train = pd.read_csv("data_train.csv")
|
||||
data_test = pd.read_csv("data_test.csv")
|
||||
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
|
||||
|
||||
x_train = data_train[FEATURES].astype(np.float32)
|
||||
y_train = data_train['stroke'].astype(np.float32)
|
||||
|
||||
x_test = data_test[FEATURES].astype(np.float32)
|
||||
y_test = data_test['stroke'].astype(np.float32)
|
||||
|
||||
fTrain = torch.from_numpy(x_train.values)
|
||||
tTrain = torch.from_numpy(y_train.values.reshape(2945,1))
|
||||
|
||||
fTest= torch.from_numpy(x_test.values)
|
||||
tTest = torch.from_numpy(y_test.values)
|
||||
|
||||
|
||||
input_dim = 6
|
||||
output_dim = 1
|
||||
info_params = "Batch size = " + str(batch_size) + " Epochs = " + str(num_epochs)
|
||||
_log.info(info_params)
|
||||
model = LogisticRegressionModel(input_dim, output_dim)
|
||||
|
||||
criterion = torch.nn.BCELoss(reduction='mean')
|
||||
optimizer = torch.optim.SGD(model.parameters(), lr = learning_rate)
|
||||
|
||||
for epoch in range(num_epochs):
|
||||
# print ("Epoch #",epoch)
|
||||
model.train()
|
||||
optimizer.zero_grad()
|
||||
# Forward pass
|
||||
y_pred = model(fTrain)
|
||||
# Compute Loss
|
||||
loss = criterion(y_pred, tTrain)
|
||||
# print(loss.item())
|
||||
# Backward pass
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
|
||||
info_loss = "Last loss = " + str(loss.item())
|
||||
_log.info(info_loss)
|
||||
y_pred = model(fTest)
|
||||
# print("predicted Y value: ", y_pred.data)
|
||||
|
||||
torch.save(model.state_dict(), 'stroke.pth')
|
||||
|
||||
|
||||
@ex.automain
|
||||
def my_main(num_epochs, batch_size, learning_rate, _run):
|
||||
train()
|
||||
|
||||
r = ex.run()
|
||||
ex.add_artifact("stroke.pth")
|
@ -82,4 +82,4 @@ def my_main(num_epochs, batch_size, learning_rate, _run):
|
||||
train()
|
||||
|
||||
r = ex.run()
|
||||
ex.add_artifact("stroke_model/stroke.pth")
|
||||
ex.add_artifact("stroke.pth")
|
BIN
stroke.pth
BIN
stroke.pth
Binary file not shown.
Loading…
Reference in New Issue
Block a user