Skip to content

Commit

Permalink
Merge pull request #120 from 1chooo/ho-dev
Browse files Browse the repository at this point in the history
update: Classifier playground
  • Loading branch information
1chooo authored Sep 12, 2023
2 parents aac5ff0 + be7afb7 commit 5170867
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 81 deletions.
15 changes: 12 additions & 3 deletions Refinaid/Playground/Classifier/Dashborad/Header.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,28 @@

class PageHeader:

def __init__(self, page_content: PageContent) -> None:
def __init__(
self,
page_content: PageContent,
) -> None:
self.page_content = page_content

def get_home_header(
self, *args: Any, **kwargs: Any) -> gr.Markdown:
self,
*args: Any,
**kwargs: Any,
) -> gr.Markdown:
our_heading = gr.Markdown(
self.page_content.home_header
)

return our_heading

def get_preprocessing_header(
self, *args: Any, **kwargs: Any) -> gr.Markdown:
self,
*args: Any,
**kwargs: Any,
) -> gr.Markdown:
our_preprocessing_header = gr.Markdown(
self.page_content.preprocessing_header
)
Expand Down
83 changes: 52 additions & 31 deletions Refinaid/Playground/Classifier/Dashborad/Preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@

class PreprocessingComponent:

def __init__(self, page_content: PageContent) -> None:
def __init__(
self,
page_content: PageContent,
) -> None:
self.page_content = page_content

def get_dataset_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown,
gr.Dropdown
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Dropdown
]:

dataset_header = gr.Markdown("### Dataset")

Expand All @@ -38,10 +44,13 @@ def get_dataset_info(
)

def get_select_mutiple_parameters_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown,
gr.Dropdown
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Dropdown
]:
select_mutiple_parameters_header = gr.Markdown(
"### Select Mutiple Parameters"
)
Expand Down Expand Up @@ -71,9 +80,9 @@ def get_missing_values_handling_info(
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Radio
]:
gr.Markdown,
gr.Radio
]:

missing_values_handling_header = gr.Markdown(
"### Missing Values Handling"
Expand All @@ -93,11 +102,13 @@ def get_missing_values_handling_info(
)

def get_data_scale_info(
self, *args: Any, **kwargs: Any
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Radio
]:
gr.Markdown,
gr.Radio
]:

data_scale_header = gr.Markdown(
"### Data Scaling"
Expand All @@ -119,13 +130,15 @@ def get_data_scale_info(
)

def get_data_split_info(
self, *args: Any, **kwargs: Any
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Slider,
gr.Slider,
gr.Slider
]:
gr.Markdown,
gr.Slider,
gr.Slider,
gr.Slider
]:
data_split_header = gr.Markdown(
"### Data Split\nTotal value should be 100%"
)
Expand Down Expand Up @@ -163,10 +176,12 @@ def get_data_split_info(
)

def get_submit_dataset_setting_btn(
self, *args: Any, **kwargs: Any
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Button
]:
gr.Button
]:

submit_dataset_setting_btn = gr.Button(
value="Submit Data Preprocessing Results",
Expand All @@ -177,10 +192,13 @@ def get_submit_dataset_setting_btn(
)

def get_preprocessing_visulize_info(
self, *args: Any, **kwargs: Any
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown, gr.ScatterPlot
]:
gr.Markdown,
gr.ScatterPlot,
]:

preprocessing_visulize_header = gr.Markdown(
"### Data Visualization in Preprocessing"
Expand All @@ -203,10 +221,13 @@ def get_preprocessing_visulize_info(
)

def get_preprocessing_visualize_axis_info(
self, *args: Any, **kwargs: Any
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Dropdown, gr.Dropdown
]:
gr.Dropdown,
gr.Dropdown
]:
x_axis_dropdown = gr.Dropdown(
label="X Axis",
value='PassengerId',
Expand Down
103 changes: 67 additions & 36 deletions Refinaid/Playground/Classifier/Dashborad/Training.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@

class TrainingComponent:

def __init__(self, page_content: PageContent) -> None:
def __init__(
self,
page_content: PageContent,
) -> None:
self.page_content = page_content

def get_training_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown
]:
training_heading = gr.Markdown(
self.page_content.training_header
)
Expand All @@ -27,10 +33,13 @@ def get_training_info(
)

def get_picked_dataset_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown,
gr.Dataframe,
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Dataframe,
]:
picked_dataset_header = gr.Markdown(
"### Data You have picked!!!"
)
Expand All @@ -50,9 +59,12 @@ def get_picked_dataset_info(
)

def get_model_dropdown_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Dropdown
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Dropdown
]:
choices =[
"Decision Tree Classifier",
"K Neighbor Classifier",
Expand All @@ -69,15 +81,18 @@ def get_model_dropdown_info(
)

def get_decision_tree_classifer_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown,
gr.Dropdown,
gr.Textbox,
gr.Slider,
gr.Slider,
gr.Dropdown,
gr.Textbox,
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Dropdown,
gr.Textbox,
gr.Slider,
gr.Slider,
gr.Dropdown,
gr.Textbox,
]:
decision_tree_classifer_title = gr.Markdown(
"### Decision Tree Classifier",
visible=False,
Expand Down Expand Up @@ -146,9 +161,15 @@ def get_decision_tree_classifer_info(
)

def get_k_neighbors_classifier_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown, gr.Slider, gr.Dropdown, gr.Dropdown
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Slider,
gr.Dropdown,
gr.Dropdown,
]:
k_neighbors_classifier_title = gr.Markdown(
"### K Neighbors Classifier",
visible=False,
Expand Down Expand Up @@ -193,9 +214,12 @@ def get_k_neighbors_classifier_info(
)

def get_training_btn_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Button,
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Button,
]:
train_btn = gr.Button(
value="Train"
)
Expand All @@ -205,10 +229,13 @@ def get_training_btn_info(
)

def get_training_results_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown,
gr.Dataframe,
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Dataframe,
]:
training_results_header = gr.Markdown("## Training Result")
training_results = gr.Dataframe(
headers=[
Expand All @@ -228,11 +255,14 @@ def get_training_results_info(
)

def get_training_results_plot_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Plot,
gr.Plot,
gr.Plot,
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Plot,
gr.Plot,
gr.Plot,
]:
train_img1 = gr.Plot(
interactive=True
)
Expand All @@ -247,4 +277,5 @@ def get_training_results_plot_info(
train_img1,
train_img2,
train_img3,
)
)

25 changes: 17 additions & 8 deletions Refinaid/Playground/Classifier/Dashborad/TrainingHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,33 @@

class TrainingHistoryComponent:

def __init__(self, page_content: PageContent) -> None:
def __init__(
self,
page_content: PageContent,
) -> None:
self.page_content = page_content

def get_history_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown
]:
history_heading = gr.Markdown("## History")

return (
history_heading
)

def get_history_training_info(
self, *args: Any, **kwargs: Any) -> Tuple[
gr.Markdown,
gr.Dataframe
]:
self,
*args: Any,
**kwargs: Any,
) -> Tuple[
gr.Markdown,
gr.Dataframe
]:

history_heading = self.get_history_info()
training_history = gr.Dataframe(
Expand Down
Loading

0 comments on commit 5170867

Please sign in to comment.