Commit 51f2b8c1 authored by Noah Brackenbury's avatar Noah Brackenbury

merging

parents e368e2d5 2e83d650
...@@ -40,8 +40,11 @@ def WebMessage_parseWebMessage(self): ...@@ -40,8 +40,11 @@ def WebMessage_parseWebMessage(self):
reference='ai_business_bot', reference='ai_business_bot',
title="AI Business Bot") title="AI Business Bot")
erp5_file = portal.portal_catalog.getResultValue(**kw) erp5_file = portal.portal_catalog.getResultValue(**kw)
<<<<<<< HEAD
if not erp5_file: if not erp5_file:
return "No model found to be applied to this Web Message. Run Set Web Message Model in Event Module first." return "No model found to be applied to this Web Message. Run Set Web Message Model in Event Module first."
=======
>>>>>>> 2e83d650106eb861a0c38350ab16aa6d13caea36
model_as_string = erp5_file.getData() model_as_string = erp5_file.getData()
model = pickle.loads(model_as_string) model = pickle.loads(model_as_string)
language_arrays = model[0] language_arrays = model[0]
......
...@@ -27,8 +27,11 @@ def WebMessage_setModel(self): ...@@ -27,8 +27,11 @@ def WebMessage_setModel(self):
portal_type="Web Message", portal_type="Web Message",
query=NegatedQuery(Query(subject=None)), query=NegatedQuery(Query(subject=None)),
) )
<<<<<<< HEAD
if not training_messages: if not training_messages:
return "No Web Messages to train on" return "No Web Messages to train on"
=======
>>>>>>> 2e83d650106eb861a0c38350ab16aa6d13caea36
for message in training_messages: for message in training_messages:
(language_arrays, tag_arrays) = message.WebMessage_trainOnWebMessage(language_arrays, tag_arrays, stopwords_arrays) (language_arrays, tag_arrays) = message.WebMessage_trainOnWebMessage(language_arrays, tag_arrays, stopwords_arrays)
end_time = time.time() end_time = time.time()
......
...@@ -27,8 +27,11 @@ def WebMessage_testModel(self): ...@@ -27,8 +27,11 @@ def WebMessage_testModel(self):
portal_type="Web Message", portal_type="Web Message",
query=NegatedQuery(Query(subject=None)), query=NegatedQuery(Query(subject=None)),
) )
<<<<<<< HEAD
if not training_messages: if not training_messages:
return "No Web Messages found to train on" return "No Web Messages found to train on"
=======
>>>>>>> 2e83d650106eb861a0c38350ab16aa6d13caea36
for index, message in enumerate(training_messages): for index, message in enumerate(training_messages):
if random.random() <= 0.2: if random.random() <= 0.2:
test_messages.append(message) test_messages.append(message)
...@@ -116,11 +119,18 @@ def WebMessage_testModel(self): ...@@ -116,11 +119,18 @@ def WebMessage_testModel(self):
if not suggested_tags_set.intersection(sr) and not suggested_tags_set.intersection(so): if not suggested_tags_set.intersection(sr) and not suggested_tags_set.intersection(so):
type_accuracy += 1 type_accuracy += 1
<<<<<<< HEAD
if not len(test_messages) == 0: if not len(test_messages) == 0:
correct_tags = float(correct_tags) / float(len(test_messages)) correct_tags = float(correct_tags) / float(len(test_messages))
excess_tags = float(excess_tags) / float(len(test_messages)) excess_tags = float(excess_tags) / float(len(test_messages))
language_accuracy = float(language_accuracy) / float(len(test_messages)) language_accuracy = float(language_accuracy) / float(len(test_messages))
type_accuracy = float(type_accuracy) / float(len(test_messages)) type_accuracy = float(type_accuracy) / float(len(test_messages))
=======
correct_tags = float(correct_tags) / float(len(test_messages))
excess_tags = float(excess_tags) / float(len(test_messages))
language_accuracy = float(language_accuracy) / float(len(test_messages))
type_accuracy = float(type_accuracy) / float(len(test_messages))
>>>>>>> 2e83d650106eb861a0c38350ab16aa6d13caea36
end_time = time.time() end_time = time.time()
uptime = end_time - start_time uptime = end_time - start_time
human_uptime = str(datetime.timedelta(seconds=int(uptime))) human_uptime = str(datetime.timedelta(seconds=int(uptime)))
......
erp5_base erp5_base
erp5_web erp5_web
erp5_dms erp5_dms
<<<<<<< HEAD
erp5_crm erp5_crm
erp5_ingestion_mysql_innodb_catalog erp5_ingestion_mysql_innodb_catalog
=======
erp5_crm
>>>>>>> 2e83d650106eb861a0c38350ab16aa6d13caea36
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment