summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano <55825613+luevano@users.noreply.github.com>2019-12-12 03:38:25 -0700
committerDavid Luevano <55825613+luevano@users.noreply.github.com>2019-12-12 03:38:25 -0700
commitcc4eaa121dc340fe44650b4fac40353266b224d8 (patch)
tree9660017bf3d6298458521c864b3d27f4b6ddd780
parent46cd12e1e5c4fb1879e39ae4968a82a9c95fcf92 (diff)
Add a bit of error handling
-rw-r--r--do_ml.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/do_ml.py b/do_ml.py
index 561b33904..e0df62be3 100644
--- a/do_ml.py
+++ b/do_ml.py
@@ -58,6 +58,18 @@ def do_ml(desc_data,
if not desc_type:
desc_type = 'NOT SPECIFIED'
+ d_len = len(desc_data)
+ e_len = len(energy_data)
+ if d_len != e_len:
+ printc(''.join(['ERROR. Descriptor data size different ',
+ 'than energy data size.']), Fore.RED)
+ return None
+
+ if training_size > d_len or test_size > d_len:
+ printc('ERROR. Training or test size greater than data size.',
+ Fore.RED)
+ return None
+
tic = time.perf_counter()
if show_msgs:
printc('{} ML started, with parameters:'.format(desc_type), Fore.CYAN)