model output
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from orm import db_session, engine, Base, ins
|
||||
from orm import Experiment, Sample, Product, Firm
|
||||
from sqlalchemy.exc import OperationalError
|
||||
from sqlalchemy import text
|
||||
import yaml
|
||||
import random
|
||||
import numpy as np
|
||||
@@ -72,7 +73,7 @@ class ControllerDB:
|
||||
print(f'Inserted {n_exp} experiments for exp {idx_scenario}!')
|
||||
|
||||
def add_experiment_1(self, idx_exp, lst_lambda, is_eliminated, flt_beta_developed,
|
||||
tariff_percentage_1: float, tariff_percentage_2: float):
|
||||
tariff_percentage_1, tariff_percentage_2):
|
||||
lst_exp = []
|
||||
for lambda_tier in lst_lambda:
|
||||
e = Experiment(idx_exp=idx_exp,
|
||||
@@ -156,16 +157,16 @@ class ControllerDB:
|
||||
db_session.commit()
|
||||
print(f"Reset the task id {res.id} flag from 0 to -1")
|
||||
else:
|
||||
Base.metadata.create_all()
|
||||
Base.metadata.create_all(bind=engine)
|
||||
self.init_tables()
|
||||
print(f"All tables are just created and initialized for exp: {self.db_name_prefix}.")
|
||||
|
||||
def prepare_list_sample(self):
|
||||
res = db_session.execute(f'''SELECT count(*) FROM {self.db_name_prefix}_sample s,
|
||||
{self.db_name_prefix}_experiment e WHERE s.e_id=e.id and e.idx_exp < 3''').scalar()
|
||||
res = db_session.execute(text(f'''SELECT count(*) FROM {self.db_name_prefix}_sample s,
|
||||
{self.db_name_prefix}_experiment e WHERE s.e_id=e.id and e.idx_exp < 3''')).scalar()
|
||||
n_sample_1_2 = 0 if res is None else res
|
||||
print(f'There are {n_sample_1_2} sample for exp 1 and 2.')
|
||||
res = db_session.execute(f'SELECT id FROM {self.db_name_prefix}_sample WHERE is_done_flag = -1')
|
||||
res = db_session.execute(text(f'SELECT id FROM {self.db_name_prefix}_sample WHERE is_done_flag = -1'))
|
||||
for row in res:
|
||||
s_id = row[0]
|
||||
if s_id <= n_sample_1_2:
|
||||
|
||||
Reference in New Issue
Block a user