summaryrefslogtreecommitdiffstats
path: root/tools/modelselector/modelselector.py
blob: ab322410fd6f070fd0f17b529f3ea2baa739b62e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
# Copyright 2022 Linux Foundation.
# srao@linuxfoundation.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Tool to suggest which ML approach is more applicable for
a particular data and usecase.
TODO:
1. Minimize code.
2. Add Informative data to the user.
3. Check for Size Entry - 1G/K ..
"""

from __future__ import print_function
import signal
import sys
from pypsi import wizard as wiz
from pypsi.shell import Shell

# pylint: disable=line-too-long,too-few-public-methods,too-many-instance-attributes, too-many-nested-blocks, too-many-return-statements, too-many-branches

class Bcolors:
    """
    For Coloring
    """
    HEADER = '\033[95m'
    OKBLUE = '\033[94m'
    OKGREEN = '\033[92m'
    WARNING = '\033[93m'
    FAIL = '\033[91m'
    ENDC = '\033[0m'
    BOLD = '\033[1m'
    UNDERLINE = '\033[4m'

class AlgoSelectorWizard():
    """
    Class to create wizards
    """
    def __init__(self):
        """
        Perform Initialization.
        """
        self.shell = Shell()
        # Set of all values from the user
        self.main_values = {}
        self.main_l1_values = {}
        self.main_l2a_values = {}
        self.main_l2b_values = {}
        self.main_l3_values = {}
        self.main_l4_values = {}
        self.unsup_values = {}
        self.ri_values = {}
        self.gen_values = {}
        self.gen_choice_values = {}
        self.gen_metrics_values = {}
        self.gen_data_main_values = {}
        self.gen_data_text_values = {}
        self.gen_data_features_values = {}
        self.gen_data_signal_values = {}
        self.gen_about_data_basic_values = {}
        self.gen_about_data_adv_values = {}
        self.gen_about_data_output_values = {}
        self.gans_values = {}
        # Set of Wizards.
        self.wiz_main = None
        self.wiz_main_l1 = None
        self.wiz_main_l2_a = None
        self.wiz_main_l2_b = None
        self.wiz_main_l3 = None
        self.wiz_main_l4 = None
        self.wiz_generic = None
        self.wiz_generic_choice = None
        self.wiz_geneirc_metric = None
        self.wiz_generic_data_main = None
        self.wiz_generic_data_signal = None
        self.wiz_generic_data_features = None
        self.wiz_generic_data_text = None
        self.wiz_generic_data_basic = None
        self.wiz_generic_data_adv = None
        self.wiz_generic_data_output = None
        self.wiz_unsupervised = None
        self.wiz_reinforcement = None
        self.wiz_gans = None
        # Some Inferences
        self.ml_needed = False
        self.ml_gans = False
        self.supervised = False
        self.unsupervised = False
        self.reinforcement = False
        self.data_size = 'high'
        self.interpretability = False
        self.faster = False
        self.ftod_ratio = 'low'
        self.reproducibility = False


    ############# All the Wizards ##################################

    ### GENERIC Wizards - Need for ML ##############################
    def main_wizard_l1(self):
        """
        The Main Wizard L1
        """
        self.wiz_main_l1 = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Do you Need ML - Data Availability"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_availability",
                    # Display name
                    name=Bcolors.HEADER+"Do you have access to data about different situations, or that describes a lot of examples of situations"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y',
                ),
            )
        )
    
    def gans_wizard(self):
        """
        The GANs Wizard
        """
        self.wiz_gans = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Synthetic Data Genration using GANs"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="gans_data_type",
                    # Display name
                    name=Bcolors.HEADER+"Is the sample data you have is time-series? Answer Y/N - Yes/No"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y',
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="gans_data_variables",
                    # Display name
                    name=Bcolors.HEADER+"Is the sample data you have is multi-variate (more than one features/columns) ? Answer Y/N - Yes/No"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y',
                ),
            )
        )


    def main_wizard_l2_a(self):
        """
        The Main Wizard L2-A
        """
        self.wiz_main_l2_a = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Do you Need ML - Data Creation"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_creativity",
                    # Display name
                    name=Bcolors.HEADER+"Will a system be able to gather a lot of data by trying sequences of actions in many different situations and seeing the results"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y',
                ),
            )
        )

    def main_wizard_l2_b(self):
        """
        The Main Wizard L2-B
        """
        gan = """ Synthetic data generation is an important use-case for Telco-scenarios, due to difficulty in getting good dataset."""
        label = """ One or more meaningful and informative 'tag' to provide context so that a machine learning model can learn from it. For example, labels might indicate whether a photo contains a bird or car, which words were uttered in an audio recording, or if an x-ray contains a tumor. Data labeling is required for a variety of use cases including computer vision, natural language processing, and speech recognition."""
        self.wiz_main_l2_b = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Do you Need ML - Data Programmability"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_generation",
                    # Display name
                    name=Bcolors.HEADER+" Do you want to generate Synthetic Data from the existing data (Type Y/N - Yes/No). Type helfp for the description"+Bcolors.ENDC,
                    # Help message
                    help=gan,
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='N',
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_label",
                    # Display name
                    name=Bcolors.HEADER+" Do you have Labelled data? (Type Y/N - Yes/No). Type help for description of label. "+Bcolors.ENDC,
                    # Help message
                    help=label,
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y',
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_programmability",
                    # Display name
                    name=Bcolors.HEADER+"Can a program or set of rules decide what actions to take based on the data you have about the situations"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='N',
                ),
            )
        )


    def main_wizard_l3(self):
        """
        The Main Wizard L3
        """
        self.wiz_main_l3 = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Do you Need ML - Data Knowledge"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_knowledge",
                    # Display name
                    name=Bcolors.HEADER+"Could a knowledgeable human decide what actions to take based on the data you have about the situations"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y',
                ),
            )
        )

    def main_wizard_l4(self):
        """
        The Main Wizard - L4
        """
        self.wiz_main_l4 = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Do you Need ML - Data Pattern"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_pattern",
                    # Display name
                    name=Bcolors.HEADER+"Could there be patterns in these situations that the humans haven't recognized before"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No.",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
            )
        )
    ### GENERIC Wizards - GOAL, METRICS, DATA ##############################
    def gen_choice_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_choice = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, and Preferences"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_goal",
                    # Display name
                    name=Bcolors.HEADER+" What is your goal with the data? Predict, Describe or Explore"+Bcolors.ENDC,
                    # Help message
                    help="Enter one of Predict/Describe/Explore",
                    validators=(wiz.required_validator, wiz.choice_validator(['Predict',
                    	                                                      'predict',
                    	                                                      'Describe',
                    	                                                      'describe',
                    	                                                      'Explore',
                    	                                                      'explore'])),
                    default='Explore'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_metrics_pref",
                    # Display name
                    name=Bcolors.HEADER+" Do you know which metrics (speed, accuracy, etc.) are more important for you? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_main",
                    # Display name
                    name=Bcolors.HEADER+" Do you know about the input data type (If its signal/features/text)  ?  "+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_databasic_pref",
                    # Display name
                    name=Bcolors.HEADER+" Do you have basic information (size, count, etc.) about the input data? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_dataadv_pref",
                    # Display name
                    name=Bcolors.HEADER+" Do you have advanced information (distribution, relation, independency, etc.) about the input data? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_dataoutput_pref",
                    # Display name
                    name=Bcolors.HEADER+" Do you have basic information (size, count, etc.) about the output? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
            )
        )

    def gen_metrics_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_metrics = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, Metrics, Data and Output Type"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="metric_accuracy",
                    # Display name
                    name=Bcolors.HEADER+" How important the metric 'Accuracy' is for you? 1-5: 1- Least important 5- Most Important"+Bcolors.ENDC,
                    # Help message
                    help="Enter 1-5: 1 being least important, and 5 being most important",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='1'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="metric_speed",
                    # Display name
                    name=Bcolors.HEADER+" How important the metric 'Speed' is for you? 1-5: 1- Least important 5- Most Important"+Bcolors.ENDC,
                    # Help message
                    help="Enter 1-5: 1 being least important, and 5 being most important",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='1'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="metric_interpretability",
                    # Display name
                    name=Bcolors.HEADER+" How important the metric 'Interpretability' is for you? 1-5: 1- Least important 5- Most Important"+Bcolors.ENDC,
                    # Help message
                    help="Enter 1-5: 1 being least important, and 5 being most important",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='1'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="metric_reproducibility",
                    # Display name
                    name=Bcolors.HEADER+" How important the metric 'Reproducibility' is for you? 1-5: 1- Least important 5- Most Important"+Bcolors.ENDC,
                    # Help message
                    help="Enter 1-5: 1 being least important, and 5 being most important",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='1'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="metric_implementation",
                    # Display name
                    name=Bcolors.HEADER+" How important the metric 'Ease of Implementation and Maintenance' is for you? 1-5: 1- Least important 5- Most Important"+Bcolors.ENDC,
                    # Help message
                    help="Enter 1-5: 1 being least important, and 5 being most important",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='1'
                ),
            )
        )

    def gen_data_main_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_main = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, and Preferences"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_column",
                    # Display name
                    name=Bcolors.HEADER+" What does the data (columns) represent? Please type help and select the associated number"+Bcolors.ENDC,
                    # Help message
                    help="1. Well Defined Features\n 2. Signals - Timeseries, pixels, etc\n 3. Text - Unstructured\n 4. None of the above\n",
                    validators=(wiz.required_validator, wiz.int_validator(1, 4)),
                    default='1'
                ),
            )
        )

    def gen_data_signal_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_signal = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, and Preferences"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_signal_type",
                    # Display name
                    name=Bcolors.HEADER+" If Signals, can you choose any one from the below list? Please type help for list "+Bcolors.ENDC,
                    # Help message
                    help="1. Image\n 2. Audio\n 3. Timeseries\n 4. None of the above\n 5. Not Applicable\n  ",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='3'
                ),
            )
        )

    def gen_data_features_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_features = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, and Preferences"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_features",
                    # Display name
                    name=Bcolors.HEADER+" If features, are they well defined? i.e., are all the variables well understood? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_features_count",
                    # Display name
                    name=Bcolors.HEADER+" If features, How many are there? "+Bcolors.ENDC,
                    # Help message
                    help="Number only - Approximate should be OK.",
                    validators=(wiz.required_validator, wiz.int_validator(1, 100000)),
                    default='10'
                ),
            )
        )

    def gen_data_text_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_text = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, and Preferences"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_text_type",
                    # Display name
                    name=Bcolors.HEADER+" If Text, can you choose any one from the below list? Please type help for list"+Bcolors.ENDC,
                    # Help message
                    help="1. Webpages\n 2. Emails\n 3. Social-Media Posts\n 4. Books\n 5. Formal Articles\n 6. Speech converted to text\n 7. None of the above\n 8. Not Applicable\n  ",
                    validators=(wiz.required_validator, wiz.int_validator(1, 8)),
                    default='3'
                ),

            )
        )

    def gen_about_data_basic_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_basic = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Basic Input Data Information"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_missing",
                    # Display name
                    name=Bcolors.HEADER+" Are there any missing values in the data? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='N'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_size_bytes",
                    # Display name
                    name=Bcolors.HEADER+" How big is the data in terms of size? (Use K/M/G Bytes unit) "+Bcolors.ENDC,
                    # Help message
                    help="Number(integer) and unit: K for Kilo, M for Mega and G for Giga. Ex: 10G for 10 Giga bytes",
                    validators=(wiz.required_validator),
                    default='1G'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_size_samples",
                    # Display name
                    name=Bcolors.HEADER+" How big is the data in terms of samples? (Use T/M/B Samples) "+Bcolors.ENDC,
                    # Help message
                    help="Number(integer) and unit: T for Thousand, M for Million and B for Billion. Ex: 1M for 1 Million Samples",
                    validators=(wiz.required_validator),
                    default='1M'
                ),
            )
        )

    def gen_about_data_advanced_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_adv = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Advanced Input Data Information"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_distribution",
                    # Display name
                    name=Bcolors.HEADER+" Are you aware of any 'Distribution' that is inherent to the data, we can take advantage of?"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_io_relation",
                    # Display name
                    name=Bcolors.HEADER+" Is the probability of 'Linear Relation' between input and the output is high?"+Bcolors.ENDC,
                    # Help message
                    help="Y/N - Yes/No",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_correlation",
                    # Display name
                    name=Bcolors.HEADER+" Are you confident that there is NO high correlation among the independent variables in your day?"+Bcolors.ENDC,
                    # Help message
                    help="Y/N/ - Yes/No ",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_cond_indep",
                    # Display name
                    name=Bcolors.HEADER+" Are you confident that the variables are conditionally independent?"+Bcolors.ENDC,
                    # Help message
                    help="Y/N/. If probability that it rains given lightining and thunder is same as probability that it rains given lightining, then rain and thunder are conditionally independent",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='Y'
                ),
            )
        )

    def gen_about_output_wizard(self):
        """
        Generic Wizard - Goal, metrics, data
        """
        self.wiz_generic_data_output = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Data Output"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.        
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_type_output",
                    # Display name
                    name=Bcolors.HEADER+" What is the expected output data type ? (Please type number associated with type in 'help') "+Bcolors.ENDC,
                    # Help message
                    help=" 1:Numerical-Discrete\n 2:Numerical-Continuous\n 3:Ordinal\n 4:Categorical-Binary\n 5:Categorical-Multiclass",
                    validators=(wiz.required_validator, wiz.int_validator(1, 5)),
                    default='1'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="data_output_prob",
                    # Display name
                    name=Bcolors.HEADER+" Is the expected output data a probability value ? "+Bcolors.ENDC,
                    # Help message
                    help="Y/N",
                    validators=(wiz.required_validator, wiz.boolean_validator),
                    default='N'
                ),
            )
        )


    def unsupervised_wizard(self):
        """
        The Un-Supervized Learning Wizard
        """
        self.wiz_unsupervised = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Understanding Goal, Metrics, Data and Output Type"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="unsup_goal",
                    # Display name
                    name=Bcolors.HEADER+" What is the main goal? (Please type number associated with type in 'help')"+Bcolors.ENDC,
                    # Help message
                    help="1: Explore Similar Groups (clustering) \n 2: Perform Dimensionality Reduction\n 3: Others\n",
                    validators=(wiz.required_validator, wiz.int_validator(1, 3)),
                    default='1'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="unsup_dr_topic_mod",
                    # Display name
                    name=Bcolors.HEADER+" If dimensionality reduction, do you prefer topic modelling ? (Please type NA is you are not sure)"+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='NA'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="unsup_clus_dv",
                    # Display name
                    name=Bcolors.HEADER+" Are you aware of density variations in your data ? (Please type NA is you are not sure)"+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='NA'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="unsup_clus_outliers",
                    # Display name
                    name=Bcolors.HEADER+" Are there too many outliers in your data ? (Please type NA is you are not sure)"+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='NA'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="unsup_clus_groups",
                    # Display name
                    name=Bcolors.HEADER+" If clustering, do you know how many groups to form? (Please type NA is you are not sure)"+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='NA'
                ),

            )
        )

    def reinforcement_wizard(self):
        """
        The Reinforced Learning Wizard
        """
        message = """
            Reward  |--------|
            |-------| Agent  |  Action
            | |-----|        |-------|
            | |	    |--------|       |
            | |state                 |
            | |	                     |
            | |	   |-----------|     |
            | |----|Environment|     |
            |------|           |-----|
    	           |-----------|
            """
        self.wiz_reinforcement = wiz.PromptWizard(
            name=Bcolors.OKBLUE+"Reinforcement Specific"+Bcolors.ENDC,
            description="",
            steps=(
                # The list of input prompts to ask the user.
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="ri_info",
                    # Display name
                    name=Bcolors.HEADER+" Type help for reference diagram for reinforcement-learning"+Bcolors.ENDC,
                    # Help message
                    help=message,
                    validators=(wiz.required_validator),
                    default='Type Help or Press Enter'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="ri_model_preference",
                    # Display name
                    name=Bcolors.HEADER+" Do you prefer model-based approach? (Type NA if you are not sure) "+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="ri_model_availability",
                    # Display name
                    name=Bcolors.HEADER+" Do you have a model for model-based approach? (Type NA if not applicable) "+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="ri_modelfree_value",
                    # Display name
                    name=Bcolors.HEADER+" In Model-Free approach, do you prefer value-based approach? (Type NA if not applicable) "+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="ri_modelfree_value_state",
                    # Display name
                    name=Bcolors.HEADER+" In Model-Free Value-Based approach, do you prefer state-only model? (Type NA if not applicable) "+Bcolors.ENDC,
                    # Help message
                    help="Y/N/NA",
                    validators=(wiz.required_validator, wiz.choice_validator(['Y','N','NA','Na',
                    	                                                      'y','n','na','nA'])),
                    default='Y'
                ),
                wiz.WizardStep(
                    # ID where the value will be stored
                    id="ri_app_domain",
                    # Display name
                    name=Bcolors.HEADER+" What is the application domain ? (Please type number associated with type in 'help') "+Bcolors.ENDC,
                    # Help message
                    help=" 1:Computer Resource Mgmt.\n 2:Robotics\n 3:Traffic-Control\n 4:Reccommenders\n 5:Autonomous Vehicles\n 6:Games\n 7:Chemistry\n 8:Others\n",
                    validators=(wiz.required_validator, wiz.int_validator(1, 8)),
                    default='1'
                ),
            )
        )

    ############### All the Run Operations ######################
    def run_mainwiz(self):
        """
        Run the Main Wizard
        """
        self.main_wizard_l1()
        self.main_l1_values = self.wiz_main_l1.run(self.shell)
        if self.main_l1_values['data_availability']:
            print("OK-1")
            self.main_wizard_l2_b()
            self.main_l2b_values = self.wiz_main_l2_b.run(self.shell)
            if self.main_l2b_values['data_label']:
                self.supervised = True
            else:
                self.unsupervised = True
            if self.main_l2b_values['data_programmability']:
                print(Bcolors.FAIL+"ML is not required - Please consider alternate approaches\n"+Bcolors.ENDC)
            elif self.main_l2b_values['data_generation']:
                print(Bcolors.OKGREEN+"Looks like you need ML, let's continue"+Bcolors.ENDC)
                self.ml_needed = True
                self.ml_gans = True
            else:
                self.main_wizard_l3()
                self.main_l3_values = self.wiz_main_l3.run(self.shell)
                if self.main_l3_values['data_knowledge']:
                    print(Bcolors.OKGREEN+"Looks like you need ML, let's continue"+Bcolors.ENDC)
                    self.ml_needed = True
                else:
                    self.main_wizard_l4()
                    self.main_l4_values = self.wiz_main_l4.run(self.shell)
                    if self.main_l4_values['data_pattern']:
                        print(Bcolors.OKGREEN+"Looks like you need ML, let's continue"+Bcolors.ENDC)
                        self.ml_needed = True
                    else:
                        print(Bcolors.FAIL+"ML is not required - Please consider alternate approaches\n"+Bcolors.ENDC)
        else:
            self.main_wizard_l2_a()
            self.main_l2a_values = self.wiz_main_l2_a.run(self.shell)
            if self.main_l2a_values['data_creativity']:
                print(Bcolors.OKGREEN+"Looks like you need ML, let's continue"+Bcolors.ENDC)
                self.ml_needed = True
                self.reinforcement = True
            else:
                print(Bcolors.FAIL+"ML is not required - Please consider alternate approaches\n"+Bcolors.ENDC)
    
    def run_gans_wizard(self):
        """
        Run GANs wizard
        """
        self.gans_wizard()
        self.gans_values = self.wiz_gans.run(self.shell)
        if self.gans_values['gans_data_type']:
            if self.gans_values['gans_data_variables']:
                print("GANs technique to consider: TTS-GAN")
            else:
                print("GANs technique to consider: TimeGAN")
        else:
            print("Sorry. We need to discuss, please connect with Anuket Thoth Project <srao@linuxfoundation.org>")
                



    def run_generic_wizard(self):
        """
        Run Generic Wizard
        """
        self.gen_choice_wizard()
        self.gen_choice_values = self.wiz_generic_choice.run(self.shell)
        if self.gen_choice_values['data_metrics_pref']:
            self.gen_metrics_wizard()
            self.gen_metrics_values = self.wiz_generic_metrics.run(self.shell)
        if self.gen_choice_values['data_main']:
            self.gen_data_main_wizard()
            self.gen_data_main_values = self.wiz_generic_data_main.run(self.shell)
            if int(self.gen_data_main_values['data_column']) == 3:
                self.gen_data_text_wizard()
                self.gen_data_text_values = self.wiz_generic_data_text.run(self.shell)
            else:
                self.gen_data_text_values = {'data_text_type': '3'}
            if int(self.gen_data_main_values['data_column']) == 1:
                self.gen_data_features_wizard()
                self.gen_data_features_values = self.wiz_generic_data_features.run(self.shell)
            else:
                self.gen_data_features_values = {'data_features': 'Y',
                                                 'data_features_count': '10'}
            if int(self.gen_data_main_values['data_column']) == 2:
                self.gen_data_signal_wizard()
                self.gen_data_signal_values = self.wiz_generic_data_signal.run(self.shell)
            else:
                self.gen_data_signal_values = {'data_signal_type': '1'}
        else:
            self.gen_data_main_values = {'data_column': '1'}
            print("Unknown Data Type")
        if self.gen_choice_values['data_databasic_pref']:
            self.gen_about_data_basic_wizard()
            self.gen_about_data_basic_values = self.wiz_generic_data_basic.run(self.shell)
        else:
            self.gen_about_data_basic_values = {'data_missing':'N',
                                                'data_size_bytes': '1G',
                                                'data_size_samples': '1M'}
        if self.gen_choice_values['data_dataadv_pref']:
            self.gen_about_data_advanced_wizard()
            self.gen_about_data_adv_values = self.wiz_generic_data_adv.run(self.shell)
        else:
            self.gen_about_data_adv_values = {'data_distribution': 'N',
                                              'data_io_relation': 'N',
                                              'data_correlation': 'N',
                                              'data_cond_indep': 'N'}
        if self.gen_choice_values['data_dataoutput_pref']:
            self.gen_about_output_wizard()
            self.gen_about_data_output_values = self.wiz_generic_data_output.run(self.shell)
        else:
            self.gen_about_data_output_values = {'data_type_output': '1',
                                                 'data_output_prob': 'N'}


    def run_unsupervised_wizard(self):
        """
        Run UnSupervised Learning Wizard.
        """
        self.unsupervised_wizard()
        self.unsup_values = self.wiz_unsupervised.run(self.shell)

    def run_reinforcement_wizard(self):
        """
        Run Reinforced Learning Wizard
        """
        self.reinforcement_wizard()
        self.ri_values = self.wiz_reinforcement.run(self.shell)

    def decide_unsupervised(self):
        """
        Decide which Unsupervised-learning to use
        """
        repro = False
        clus_prob = False
        if int(self.unsup_values['unsup_goal']) == 1:
            # Clustering
            if 'high' in self.data_size:
                if not self.reproducibility:
                    clus_prob = True
                else:
                    repro = True
            else:
                if 'y' in self.unsup_values['unsup_clus_dv'].lower():
                    if 'y' in self.unsup_values['unsup_clus_groups'].lower():
                        clus_prob = True
                    else:
                        print("Unsupervised Learning model to consider: Hierarchical Clustering")
                        return
                else:
                    repro = True
            if repro:
                if 'y' in self.unsup_values['unsup_clus_outliers'].lower():
                    print("Unsupervised Learning model to consider: Hierarchical Clustering")
                else:
                    print("Unsupervised Learning model to consider: DBSCAN")
                return
            if clus_prob:
                if 'y' in self.gen_about_data_output_values['data_output_prob'].lower():
                    print("Unsupervised Learning model to consider: Gaussian Mixture")
                else:
                    print("Unsupervised Learning model to consider: KMeans")
                return
        elif int(self.unsup_values['unsup_goal']) == 2:
            # Dimensionality Reduction
            if 'y' in self.unsup_values['unsup_dr_topic_mod'].lower():
                if 'y' in self.gen_about_data_output_values['data_output_prob'].lower():
                    print("Unsupervised Learning model to consider: SVD")
                else:
                    print("Unsupervised Learning model to consider: LDA")
            else:
                print("Unsupervised Learning model to consider: PCA")
        else:
            print("Sorry. We need to discuss, please connect with Anuket Thoth Project <srao@linuxfoundation.org>")

    def decide_reinforcement(self):
        """
        Decide which reinforement learning to use.
        """
        if (int(self.gen_about_data_output_values['data_type_output']) == 2 or
                'y' in self.ri_values['ri_model_preference'].lower()):
            # Model Bsaed
            if 'y' in self.ri_values['ri_model_availability'].lower():
                print("Reinforcement Learning model to consider - AlphaZero")
            else:
                print("Reinforcement Learning models to consider - World Models, I2A, MBMF, and MBVE")
        elif 'n' in self.ri_values['ri_model_preference'].lower():
            # Model-Free based approach.
            if 'y' not in self.ri_values['ri_modelfree_value'].lower():
                print("Reinforcement Learning models to consider: Policy Gradient and Actor Critic")
            else:
                if 'y' in self.ri_values['ri_modelfree_value_state'].lower():
                    print("Reinforcement Learning models to consider - Monte Carlo, TD(0), and TD(Lambda)")
                else:
                    print("Reinforcement Learning models to consider - SARSA, QLearning, Deep Queue Nets")
        else:
            # Default
            print("Sorry. We need to discuss, please connect with Anuket Thoth Project <srao@linuxfoundation.org>")

    def perform_inference(self):
        """
        Perform Inferences. Used across all 3 types.
        """
        # Decide whether data is Low or High
        self.data_size = 'unknown'
        if ('k' in self.gen_about_data_basic_values['data_size_bytes'].lower() or
                't' in self.gen_about_data_basic_values['data_size_samples']):
            self.data_size = 'low'

        if int(self.gen_metrics_values['metric_interpretability']) >= 3 :
            self.interpretability = True
        if int(self.gen_metrics_values['metric_speed']) >= 3 :
            self.faster = True
        if int(self.gen_metrics_values['metric_reproducibility']) >= 3 :
            self.reproducibility = True

        # Decide Features relative to Data (ftod_ratio) - high/low
        if ('k' in self.gen_about_data_basic_values['data_size_bytes'].lower() or
                't' in self.gen_about_data_basic_values['data_size_samples']):
            if int(self.gen_data_features_values['data_features_count']) > 50:
                self.ftod_ratio = 'high'
        elif ('m' in self.gen_about_data_basic_values['data_size_bytes'].lower() or
                'm' in self.gen_about_data_basic_values['data_size_samples']):
            if int(self.gen_data_features_values['data_features_count']) > 5000:
                self.ftod_ratio = 'high'
        else:
            if int(self.gen_data_features_values['data_features_count']) > 500000:
                self.ftod_ratio = 'high'


    def decide_supervised(self):
        """
        Decide which Supervised learning to use.
        """
        if 'high' in self.data_size:
            # Cover: DT, RF, RNN, CNN, ANN and Naive Bayes
            if self.interpretability:
                if self.faster:
                    print("Supervised Learning model to consider  - Decision Tree")
                else:
                    print("Supervised Learning model to consider  - Random Forest")
            else:
                if int(self.gen_data_main_values['data_column']) == 3:
                    print("Supervised Learning model to consider  - RNN")
                elif (int(self.gen_data_main_values['data_column']) == 2 and
                        int(self.gen_data_signal_values['data_signal_type']) == 1):
                    print("Supervised Learning model to consider  - CNN")
                elif (int(self.gen_data_main_values['data_column']) == 2 and
                        (int(self.gen_data_signal_values['data_signal_type']) == 2 or
                            int(self.gen_data_signal_values['data_signal_type']) == 3)):
                    if 'y' in self.gen_about_data_output_values['data_output_prob'].lower():
                        print("Supervised Learning model to consider  - Naive Bayes")
                    else:
                        print("Supervised Learning model to consider  - ANN")
                else:
                    print("Supervised model to consider  Learning - ANN")
        elif 'low' in self.data_size:
            from_b = False
            # Cover: Regressions
            if 'high' in self.ftod_ratio:
                from_b = True
            else:
                print("Supervised Learning model to consider  - SVN with Gaussian Kernel")
                return
            if int(self.gen_about_data_output_values['data_type_output']) != 2:
                from_b = True
            else:
                if 'y' in self.gen_about_data_adv_values['data_io_relation'].lower():
                    print("Supervised Learning model to consider  - Linear Regression or Linear SVM")
                else:
                    print("Supervised Learning model to consider  - Polynomial Regression or nonLinear SVM")
                return
            if from_b:
                if int(self.gen_about_data_output_values['data_output_type']) == 4:
                    if 'y' in self.gen_about_data_output_values['data_output_prob'].lower():
                        if 'y' in self.gen_about_data_adv_values['data_cond_indep'].lower():
                            print("Supervised Learning model to consider  - Naive Bayes")
                        else:
                            if 'y' in self.gen_about_data_adv_values['data_correlation'].lower():
                                print("Supervised Learning model to consider  - LASSO or Ridge Regression")
                            else:
                                print("Supervised Learning model to consider  - Logistic Regression")
                    else:
                        print("Supervised Learning model to consider  - Polynomial Regression or nonLinear SVM")

                else:
                    print("Supervised Learning model to consider - KNN")
        else:
            # Default
            print("Sorry. We need to discuss, please connect with Anuket Thoth Project <srao@linuxfoundation.org>")

    def ask_and_decide(self):
        """
        THe Main Engine
        """
        self.run_mainwiz()
        if self.ml_gans:
            self.run_gans_wizard()
            return
        if self.ml_needed:
            self.run_generic_wizard()
            if self.supervised:
                self.decide_supervised()
            elif self.unsupervised:
                self.run_unsupervised_wizard()
                self.decide_unsupervised()
            elif self.reinforcement:
                self.run_reinforcement_wizard()
                self.decide_reinforcement()


def signal_handler(signum, frame):
    """
    Signal Handler
    """
    print("\n You interrupted, No Suggestion will be provided!")
    print(signum, frame)
    sys.exit(0)

def main():
    """
    The Main Function
    """
    try:
        algowiz = AlgoSelectorWizard()
        algowiz.ask_and_decide()
    except(KeyboardInterrupt, MemoryError):
        print("Some Error Occured - No Suggestion can be provided")

    print("Thanks for using the Algoselector-Wizard, " +
            "Hope our suggestion will be useful")

if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal_handler)
    main()