Skip to content

Commit

Permalink
Renamed datasets to collections
Browse files Browse the repository at this point in the history
Changed all instances of "dataset" to the new term "collection".
  • Loading branch information
SmithRWORNL committed Feb 21, 2024
1 parent 9a0db16 commit d0006b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Database/ssm.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE USER postgres PASSWORD 'postgres';
CREATE TABLE models (name varchar(255) PRIMARY KEY, datasets text, filter text, extrema text, labels text, description text, model bytea, f1 float, recall float, selectivity float, false_discovery float, false_omission float, true_positive int, true_negative int, false_positive int, false_negative int, created timestamp default current_timestamp);
CREATE TABLE models (name varchar(255) PRIMARY KEY, collections text, filter text, extrema text, labels text, description text, model bytea, f1 float, recall float, selectivity float, false_discovery float, false_omission float, true_positive int, true_negative int, false_positive int, false_negative int, created timestamp default current_timestamp);
CREATE TABLE graphs (image bytea, model varchar(255));
GRANT CONNECT ON DATABASE ssm TO postgres;
GRANT SELECT, INSERT, UPDATE, DELETE ON models TO postgres;
Expand Down
14 changes: 7 additions & 7 deletions ssm_ml/ssmml.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def save_model(classifier, name, training_data, filter_json, feature_extrema, la
@param classifier: The model to be saved.
@param name: The name to save the classifier under
@param training_data: The list of datasets used in training the model
@param training_data: The list of collections used in training the model
@param filter: The json representation (as used by construct_filters) of the filter used to extract features/labels.
@param feature_extrema: The list of extrema for each feature in the form [[f1_min, f1_max], [f2_min, f2_max]...]
@param labels: The ordered list of labels for the classifier
Expand Down Expand Up @@ -434,10 +434,10 @@ def save_model(classifier, name, training_data, filter_json, feature_extrema, la
#Pickle the classifier
model_pickle = psycopg2.Binary(pickle.dumps(classifier))

#Get the list of dataset uuids
datasets = ''
#for dataset in training_data:
# datasets += dataset['uuid']
#Get the list of collection uuids
collections = ''
#for collection in training_data:
# collections += collection['uuid']

extrema_string = ''

Expand All @@ -454,8 +454,8 @@ def save_model(classifier, name, training_data, filter_json, feature_extrema, la
label_string = label_string[:-1]


connection.cursor().execute("INSERT INTO models (name, datasets, model, filter, extrema, labels, description, f1, recall, selectivity, false_discovery, false_omission, true_positive, true_negative, false_positive, false_negative) VALUES ('" + name + "', '"
+ datasets + "', " + str(model_pickle) + ", '" + filter_json + "', '" + extrema_string + "', '"
connection.cursor().execute("INSERT INTO models (name, collections, model, filter, extrema, labels, description, f1, recall, selectivity, false_discovery, false_omission, true_positive, true_negative, false_positive, false_negative) VALUES ('" + name + "', '"
+ collections + "', " + str(model_pickle) + ", '" + filter_json + "', '" + extrema_string + "', '"
+ label_string + "', '" + description
+ "'," + str(f1) + ", "
+str(recall) + ", " + str(selectivity) + ", " + str(false_discovery) + ", " + str(false_omission) + ", " + str(tp) + ", "
Expand Down

0 comments on commit d0006b5

Please sign in to comment.