-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from 1chooo/ho-dev
add: classifier playground
- Loading branch information
Showing
11 changed files
with
862 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
''' | ||
Create Date: 2023/09/11 | ||
Author: @1chooo(Hugo ChunHo Lin) | ||
Version: v0.1.2 | ||
''' | ||
|
||
import gradio as gr | ||
from Refinaid.gui.Information import PageContent | ||
from typing import Any | ||
|
||
class PageHeader: | ||
|
||
def __init__(self, page_content: PageContent) -> None: | ||
self.page_content = page_content | ||
|
||
def get_home_header( | ||
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: | ||
our_preprocessing_header = gr.Markdown( | ||
self.page_content.preprocessing_header | ||
) | ||
|
||
return our_preprocessing_header |
225 changes: 225 additions & 0 deletions
225
Refinaid/Playground/Classifier/Dashborad/Preprocessing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
# -*- coding: utf-8 -*- | ||
''' | ||
Create Date: 2023/09/11 | ||
Author: @1chooo(Hugo ChunHo Lin) | ||
Version: v0.1.2 | ||
''' | ||
|
||
import gradio as gr | ||
from Refinaid.gui.Information import PageContent | ||
from typing import Any, Tuple | ||
from Refinaid.Action.Load import get_dataframe | ||
|
||
class PreprocessingComponent: | ||
|
||
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 | ||
]: | ||
|
||
dataset_header = gr.Markdown("### Dataset") | ||
|
||
dataset_choices = self.page_content.dataset_choices | ||
|
||
selected_dataset_name = gr.Dropdown( | ||
label="Select Dataset", | ||
value="Titanic", | ||
choices=dataset_choices, | ||
interactive=True, | ||
) | ||
|
||
return ( | ||
dataset_header, | ||
selected_dataset_name | ||
) | ||
|
||
def get_select_mutiple_parameters_info( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Markdown, | ||
gr.Dropdown | ||
]: | ||
select_mutiple_parameters_header = gr.Markdown( | ||
"### Select Mutiple Parameters" | ||
) | ||
select_mutiple_parameters_dropdown = gr.Dropdown( | ||
label="Select Mutiple Parameters", | ||
value=[ | ||
'PassengerId', 'Pclass', 'Sex', | ||
'Age', 'SibSp', 'Parch', 'Ticket', | ||
'Fare', 'Cabin', 'Embarked' | ||
], | ||
choices=[ | ||
'PassengerId', 'Pclass', 'Sex', | ||
'Age', 'SibSp', 'Parch', 'Ticket', | ||
'Fare', 'Cabin', 'Embarked' | ||
], | ||
interactive=True, | ||
multiselect=True, | ||
) | ||
|
||
return ( | ||
select_mutiple_parameters_header, | ||
select_mutiple_parameters_dropdown | ||
) | ||
|
||
def get_missing_values_handling_info( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Markdown, | ||
gr.Radio | ||
]: | ||
|
||
missing_values_handling_header = gr.Markdown( | ||
"### Missing Values Handling" | ||
) | ||
missing_value_checkbox = gr.Radio( | ||
label="Select a Method", | ||
value="Drop Nan", | ||
choices=[ | ||
"Drop Nan", | ||
"By Columns" | ||
], | ||
interactive=True, | ||
) | ||
return ( | ||
missing_values_handling_header, | ||
missing_value_checkbox | ||
) | ||
|
||
def get_data_scale_info( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Markdown, | ||
gr.Radio | ||
]: | ||
|
||
data_scale_header = gr.Markdown( | ||
"### Data Scaling" | ||
) | ||
data_scale_dropdown = gr.Radio( | ||
value="None", | ||
choices=[ | ||
"None", | ||
"Standard", | ||
"Min-Max" | ||
], | ||
label="Please select a method", | ||
interactive=True, | ||
) | ||
|
||
return ( | ||
data_scale_header, | ||
data_scale_dropdown | ||
) | ||
|
||
def get_data_split_info( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Markdown, | ||
gr.Slider, | ||
gr.Slider, | ||
gr.Slider | ||
]: | ||
data_split_header = gr.Markdown( | ||
"### Data Split\nTotal value should be 100%" | ||
) | ||
|
||
training_slider = gr.Slider( | ||
label="Training Set", | ||
value=70, | ||
minimum=0, | ||
maximum=100, | ||
step=5, | ||
interactive=True, | ||
) | ||
validation_slider = gr.Slider( | ||
label="Validation Set", | ||
value=10, | ||
minimum=0, | ||
maximum=100, | ||
step=5, | ||
interactive=True, | ||
) | ||
testing_slider = gr.Slider( | ||
label="Testing Set", | ||
value=20, | ||
minimum=0, | ||
maximum=100, | ||
step=5, | ||
interactive=True, | ||
) | ||
|
||
return ( | ||
data_split_header, | ||
training_slider, | ||
validation_slider, | ||
testing_slider | ||
) | ||
|
||
def get_submit_dataset_setting_btn( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Button | ||
]: | ||
|
||
submit_dataset_setting_btn = gr.Button( | ||
value="Submit Data Preprocessing Results", | ||
) | ||
|
||
return ( | ||
submit_dataset_setting_btn | ||
) | ||
|
||
def get_preprocessing_visulize_info( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Markdown, gr.ScatterPlot | ||
]: | ||
|
||
preprocessing_visulize_header = gr.Markdown( | ||
"### Data Visualization in Preprocessing" | ||
) | ||
|
||
preprocessing_visulize_scatter_plot = gr.ScatterPlot( | ||
value=get_dataframe("Titanic"), | ||
label="Data Visualization", | ||
x="PassengerId", | ||
y="Pclass", | ||
title='Scatter Plot in Data Visualization', | ||
# height=400, | ||
# width=400, | ||
caption='Observe the relationship between parameters', | ||
) | ||
|
||
return ( | ||
preprocessing_visulize_header, | ||
preprocessing_visulize_scatter_plot | ||
) | ||
|
||
def get_preprocessing_visualize_axis_info( | ||
self, *args: Any, **kwargs: Any) -> Tuple[ | ||
gr.Dropdown, gr.Dropdown | ||
]: | ||
x_axis_dropdown = gr.Dropdown( | ||
label="X Axis", | ||
value='PassengerId', | ||
choices=[ | ||
'PassengerId', 'Pclass', 'Age', | ||
'SibSp', 'Parch', 'Fare' | ||
], | ||
interactive=True, | ||
) | ||
y_axis_dropdown = gr.Dropdown( | ||
label="Y Axis", | ||
value='Pclass', | ||
choices=[ | ||
'PassengerId', 'Pclass', 'Age', | ||
'SibSp', 'Parch', 'Fare' | ||
], | ||
interactive=True, | ||
) | ||
|
||
return ( | ||
x_axis_dropdown, | ||
y_axis_dropdown | ||
) | ||
|
Oops, something went wrong.