This commit is contained in:
parent
2fc7824953
commit
c0668627a8
@ -29,7 +29,7 @@ class LogisticRegressionModel(nn.Module):
|
|||||||
return self.sigmoid(out)
|
return self.sigmoid(out)
|
||||||
|
|
||||||
@ex.capture
|
@ex.capture
|
||||||
def train(num_epochs, batch_size, learning_rate, _run):
|
def train(num_epochs, batch_size, learning_rate, _log):
|
||||||
data_train = pd.read_csv("data_train.csv")
|
data_train = pd.read_csv("data_train.csv")
|
||||||
data_test = pd.read_csv("data_test.csv")
|
data_test = pd.read_csv("data_test.csv")
|
||||||
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
|
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
|
||||||
@ -50,7 +50,7 @@ def train(num_epochs, batch_size, learning_rate, _run):
|
|||||||
input_dim = 6
|
input_dim = 6
|
||||||
output_dim = 1
|
output_dim = 1
|
||||||
info_params = "Batch size = " + str(batch_size) + " Epochs = " + str(num_epochs)
|
info_params = "Batch size = " + str(batch_size) + " Epochs = " + str(num_epochs)
|
||||||
_run.info(info_params)
|
_log.info(info_params)
|
||||||
model = LogisticRegressionModel(input_dim, output_dim)
|
model = LogisticRegressionModel(input_dim, output_dim)
|
||||||
|
|
||||||
criterion = torch.nn.BCELoss(reduction='mean')
|
criterion = torch.nn.BCELoss(reduction='mean')
|
||||||
@ -70,7 +70,7 @@ def train(num_epochs, batch_size, learning_rate, _run):
|
|||||||
optimizer.step()
|
optimizer.step()
|
||||||
|
|
||||||
info_loss = "Last loss = " + str(loss.item())
|
info_loss = "Last loss = " + str(loss.item())
|
||||||
_run.info(info_loss)
|
_log.info(info_loss)
|
||||||
y_pred = model(fTest)
|
y_pred = model(fTest)
|
||||||
print("predicted Y value: ", y_pred.data)
|
print("predicted Y value: ", y_pred.data)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class LogisticRegressionModel(nn.Module):
|
|||||||
return self.sigmoid(out)
|
return self.sigmoid(out)
|
||||||
|
|
||||||
@ex.capture
|
@ex.capture
|
||||||
def train(num_epochs, batch_size, learning_rate, _run):
|
def train(num_epochs, batch_size, learning_rate, _log):
|
||||||
data_train = pd.read_csv("data_train.csv")
|
data_train = pd.read_csv("data_train.csv")
|
||||||
data_test = pd.read_csv("data_test.csv")
|
data_test = pd.read_csv("data_test.csv")
|
||||||
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
|
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
|
||||||
@ -51,7 +51,7 @@ def train(num_epochs, batch_size, learning_rate, _run):
|
|||||||
input_dim = 6
|
input_dim = 6
|
||||||
output_dim = 1
|
output_dim = 1
|
||||||
info_params = "Batch size = " + str(batch_size) + " Epochs = " + str(num_epochs)
|
info_params = "Batch size = " + str(batch_size) + " Epochs = " + str(num_epochs)
|
||||||
_run.info(info_params)
|
_log.info(info_params)
|
||||||
model = LogisticRegressionModel(input_dim, output_dim)
|
model = LogisticRegressionModel(input_dim, output_dim)
|
||||||
|
|
||||||
criterion = torch.nn.BCELoss(reduction='mean')
|
criterion = torch.nn.BCELoss(reduction='mean')
|
||||||
@ -71,7 +71,7 @@ def train(num_epochs, batch_size, learning_rate, _run):
|
|||||||
optimizer.step()
|
optimizer.step()
|
||||||
|
|
||||||
info_loss = "Last loss = " + str(loss.item())
|
info_loss = "Last loss = " + str(loss.item())
|
||||||
_run.info(info_loss)
|
_log.info(info_loss)
|
||||||
y_pred = model(fTest)
|
y_pred = model(fTest)
|
||||||
print("predicted Y value: ", y_pred.data)
|
print("predicted Y value: ", y_pred.data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user