mirror of
https://github.com/Doctorado-ML/Stree_datasets.git
synced 2025-08-15 15:36:01 +00:00
Fix oc1 process
This commit is contained in:
@@ -24,8 +24,8 @@ def store_result(database, dataset, accuracy, time_spent):
|
||||
"insert into results ("
|
||||
+ ",".join(attributes)
|
||||
+ ") values("
|
||||
+ ("%s," * len(attributes))[:-1]
|
||||
+ ")"
|
||||
+ ("\"%s\"," * len(attributes))[:-1]
|
||||
+ ");"
|
||||
)
|
||||
now = datetime.now()
|
||||
date = now.strftime("%Y-%m-%d")
|
||||
@@ -38,15 +38,16 @@ def store_result(database, dataset, accuracy, time_spent):
|
||||
stdev(accuracy),
|
||||
dataset,
|
||||
"oc1",
|
||||
True,
|
||||
False,
|
||||
1,
|
||||
0,
|
||||
mean(time_spent),
|
||||
stdev(time_spent),
|
||||
str({"random_state": 1}),
|
||||
"{}",
|
||||
)
|
||||
cursor = database.cursor()
|
||||
cursor.execute(command_insert, values)
|
||||
database.commit()
|
||||
print(command_insert % values, file=database)
|
||||
#cursor = database.cursor()
|
||||
#cursor.execute(command_insert, values)
|
||||
#database.commit()
|
||||
|
||||
|
||||
def get_result(name):
|
||||
@@ -57,7 +58,7 @@ def get_result(name):
|
||||
result_file = open(filename, "r")
|
||||
lines = result_file.readlines()
|
||||
result_file.close()
|
||||
data = lines[-7:-2]
|
||||
data = lines[-6:-1]
|
||||
for line in data:
|
||||
acc, time_s = line.split("***")[2:4]
|
||||
accuracy.append(float(acc))
|
||||
@@ -65,8 +66,9 @@ def get_result(name):
|
||||
return accuracy, time_spent
|
||||
|
||||
|
||||
dbh = MySQL()
|
||||
database = dbh.get_connection()
|
||||
#dbh = MySQL()
|
||||
#database = dbh.get_connection()
|
||||
database = open("oc1.sql", "w")
|
||||
dt = Datasets(False, False, "tanveer")
|
||||
for dataset in dt:
|
||||
print(f"Processing {dataset[0]:30s}", end=" ")
|
||||
@@ -79,4 +81,5 @@ for dataset in dt:
|
||||
f"elements=[{len(accuracy)} {len(time_spent)}]"
|
||||
)
|
||||
store_result(database, dataset[0], accuracy, time_spent)
|
||||
dbh.close()
|
||||
#dbh.close()
|
||||
database.close
|
||||
|
Reference in New Issue
Block a user