Update my_model/tabs/dataset_analysis.py
Browse files
my_model/tabs/dataset_analysis.py
CHANGED
@@ -38,8 +38,7 @@ class OKVQADatasetAnalyzer:
|
|
38 |
'train_test'indicating whether to load training data, testing data, or both.
|
39 |
|
40 |
The constructor initializes the paths, selects the dataset based on the choice, and loads the initial data by
|
41 |
-
calling the `load_data` method.
|
42 |
-
It also prepares structures for categorizing questions and storing the results.
|
43 |
"""
|
44 |
|
45 |
self.train_file_path = train_file_path
|
@@ -160,6 +159,7 @@ class OKVQADatasetAnalyzer:
|
|
160 |
# Display the chart in Streamlit
|
161 |
st.altair_chart(chart, use_container_width=True)
|
162 |
|
|
|
163 |
def plot_bar_chart(self, df: pd.DataFrame, category_col: str, value_col: str, chart_title: str) -> None:
|
164 |
"""
|
165 |
Plots an interactive bar chart using Altair and Streamlit.
|
@@ -217,7 +217,6 @@ class OKVQADatasetAnalyzer:
|
|
217 |
st.altair_chart(chart, use_container_width=True)
|
218 |
|
219 |
|
220 |
-
|
221 |
def export_to_csv(self, qs_filename: str, question_types_filename: str) -> None:
|
222 |
"""
|
223 |
Exports the categorized questions and their counts to two separate CSV files.
|
@@ -246,8 +245,6 @@ class OKVQADatasetAnalyzer:
|
|
246 |
writer.writerow([q_type, count])
|
247 |
|
248 |
|
249 |
-
|
250 |
-
|
251 |
def run_dataset_analyzer() -> None:
|
252 |
"""
|
253 |
Executes the dataset analysis process and displays the results using Streamlit.
|
@@ -326,7 +323,4 @@ def run_dataset_analyzer() -> None:
|
|
326 |
with st.expander("Show Dataset Samples"):
|
327 |
n = random.randint(1,len(train_data)-10)
|
328 |
# Displaying 10 random samples.
|
329 |
-
st.write(train_data[n:n+10])
|
330 |
-
|
331 |
-
|
332 |
-
|
|
|
38 |
'train_test'indicating whether to load training data, testing data, or both.
|
39 |
|
40 |
The constructor initializes the paths, selects the dataset based on the choice, and loads the initial data by
|
41 |
+
calling the `load_data` method. It also prepares structures for categorizing questions and storing the results.
|
|
|
42 |
"""
|
43 |
|
44 |
self.train_file_path = train_file_path
|
|
|
159 |
# Display the chart in Streamlit
|
160 |
st.altair_chart(chart, use_container_width=True)
|
161 |
|
162 |
+
|
163 |
def plot_bar_chart(self, df: pd.DataFrame, category_col: str, value_col: str, chart_title: str) -> None:
|
164 |
"""
|
165 |
Plots an interactive bar chart using Altair and Streamlit.
|
|
|
217 |
st.altair_chart(chart, use_container_width=True)
|
218 |
|
219 |
|
|
|
220 |
def export_to_csv(self, qs_filename: str, question_types_filename: str) -> None:
|
221 |
"""
|
222 |
Exports the categorized questions and their counts to two separate CSV files.
|
|
|
245 |
writer.writerow([q_type, count])
|
246 |
|
247 |
|
|
|
|
|
248 |
def run_dataset_analyzer() -> None:
|
249 |
"""
|
250 |
Executes the dataset analysis process and displays the results using Streamlit.
|
|
|
323 |
with st.expander("Show Dataset Samples"):
|
324 |
n = random.randint(1,len(train_data)-10)
|
325 |
# Displaying 10 random samples.
|
326 |
+
st.write(train_data[n:n+10])
|
|
|
|
|
|