Skip to content

Commit 6e5837a

Browse files
committed
Tools: Update Model Selector
This patch updates the model selector Signed-off-by: Sridhar K. N. Rao <[email protected]> Change-Id: I46f9cc518d08e28f60cf8067dee1b9e7007f4510
1 parent 9e9df40 commit 6e5837a

File tree

1 file changed

+73
-2
lines changed

1 file changed

+73
-2
lines changed

tools/modelselector/modelselector.py

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def __init__(self):
7171
self.gen_about_data_basic_values = {}
7272
self.gen_about_data_adv_values = {}
7373
self.gen_about_data_output_values = {}
74+
self.gans_values = {}
7475
# Set of Wizards.
7576
self.wiz_main = None
7677
self.wiz_main_l1 = None
@@ -90,8 +91,10 @@ def __init__(self):
9091
self.wiz_generic_data_output = None
9192
self.wiz_unsupervised = None
9293
self.wiz_reinforcement = None
94+
self.wiz_gans = None
9395
# Some Inferences
9496
self.ml_needed = False
97+
self.ml_gans = False
9598
self.supervised = False
9699
self.unsupervised = False
97100
self.reinforcement = False
@@ -126,6 +129,39 @@ def main_wizard_l1(self):
126129
),
127130
)
128131
)
132+
133+
def gans_wizard(self):
134+
"""
135+
The GANs Wizard
136+
"""
137+
self.wiz_gans = wiz.PromptWizard(
138+
name=Bcolors.OKBLUE+"Synthetic Data Genration using GANs"+Bcolors.ENDC,
139+
description="",
140+
steps=(
141+
# The list of input prompts to ask the user.
142+
wiz.WizardStep(
143+
# ID where the value will be stored
144+
id="gans_data_type",
145+
# Display name
146+
name=Bcolors.HEADER+"Is the sample data you have is time-series? Answer Y/N - Yes/No"+Bcolors.ENDC,
147+
# Help message
148+
help="Y/N - Yes/No",
149+
validators=(wiz.required_validator, wiz.boolean_validator),
150+
default='Y',
151+
),
152+
wiz.WizardStep(
153+
# ID where the value will be stored
154+
id="gans_data_variables",
155+
# Display name
156+
name=Bcolors.HEADER+"Is the sample data you have is multi-variate (more than one features/columns) ? Answer Y/N - Yes/No"+Bcolors.ENDC,
157+
# Help message
158+
help="Y/N - Yes/No",
159+
validators=(wiz.required_validator, wiz.boolean_validator),
160+
default='Y',
161+
),
162+
)
163+
)
164+
129165

130166
def main_wizard_l2_a(self):
131167
"""
@@ -153,12 +189,23 @@ def main_wizard_l2_b(self):
153189
"""
154190
The Main Wizard L2-B
155191
"""
192+
gan = """ Synthetic data generation is an important use-case for Telco-scenarios, due to difficulty in getting good dataset."""
156193
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."""
157194
self.wiz_main_l2_b = wiz.PromptWizard(
158195
name=Bcolors.OKBLUE+"Do you Need ML - Data Programmability"+Bcolors.ENDC,
159196
description="",
160197
steps=(
161198
# The list of input prompts to ask the user.
199+
wiz.WizardStep(
200+
# ID where the value will be stored
201+
id="data_generation",
202+
# Display name
203+
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,
204+
# Help message
205+
help=gan,
206+
validators=(wiz.required_validator, wiz.boolean_validator),
207+
default='N',
208+
),
162209
wiz.WizardStep(
163210
# ID where the value will be stored
164211
id="data_label",
@@ -764,6 +811,10 @@ def run_mainwiz(self):
764811
self.unsupervised = True
765812
if self.main_l2b_values['data_programmability']:
766813
print(Bcolors.FAIL+"ML is not required - Please consider alternate approaches\n"+Bcolors.ENDC)
814+
elif self.main_l2b_values['data_generation']:
815+
print(Bcolors.OKGREEN+"Looks like you need ML, let's continue"+Bcolors.ENDC)
816+
self.ml_needed = True
817+
self.ml_gans = True
767818
else:
768819
self.main_wizard_l3()
769820
self.main_l3_values = self.wiz_main_l3.run(self.shell)
@@ -787,6 +838,23 @@ def run_mainwiz(self):
787838
self.reinforcement = True
788839
else:
789840
print(Bcolors.FAIL+"ML is not required - Please consider alternate approaches\n"+Bcolors.ENDC)
841+
842+
def run_gans_wizard(self):
843+
"""
844+
Run GANs wizard
845+
"""
846+
self.gans_wizard()
847+
self.gans_values = self.wiz_gans.run(self.shell)
848+
if self.gans_values['gans_data_type']:
849+
if self.gans_values['gans_data_variables']:
850+
print("GANs technique to consider: TTS-GAN")
851+
else:
852+
print("GANs technique to consider: TimeGAN")
853+
else:
854+
print("Sorry. We need to discuss, please connect with Anuket Thoth Project <[email protected]>")
855+
856+
857+
790858

791859
def run_generic_wizard(self):
792860
"""
@@ -900,7 +968,7 @@ def decide_unsupervised(self):
900968
else:
901969
print("Unsupervised Learning model to consider: PCA")
902970
else:
903-
print("Sorry. We need to discuss, please connect with Anuket Thoth Project <[email protected]>")
971+
print("Sorry. We need to discuss, please connect with Anuket Thoth Project <[email protected]>")
904972

905973
def decide_reinforcement(self):
906974
"""
@@ -1016,13 +1084,16 @@ def decide_supervised(self):
10161084
print("Supervised Learning model to consider - KNN")
10171085
else:
10181086
# Default
1019-
print("Sorry. We need to discuss, please connect with Anuket Thoth Project <[email protected]>")
1087+
print("Sorry. We need to discuss, please connect with Anuket Thoth Project <[email protected]>")
10201088

10211089
def ask_and_decide(self):
10221090
"""
10231091
THe Main Engine
10241092
"""
10251093
self.run_mainwiz()
1094+
if self.ml_gans:
1095+
self.run_gans_wizard()
1096+
return
10261097
if self.ml_needed:
10271098
self.run_generic_wizard()
10281099
if self.supervised:

0 commit comments

Comments
 (0)