Spaces:
Running
Running
asad
#1
by
asaduzzaman607
- opened
- .gitattributes +0 -12
- .gitignore +0 -3
- .ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
- .ipynb_checkpoints/distinguish_high_low_label-checkpoint.ipynb +0 -447
- Untitled.ipynb +2 -2
- app.py +44 -216
- distinguish_high_low_label.ipynb +0 -451
- fullTest/test.txt +0 -3
- fullTest/test_info.txt +0 -3
- fullTest/test_label.txt +0 -0
- new_test_saved_finetuned_model.py +1 -6
- plot.png +0 -0
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test_info.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test_label.txt +0 -0
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_BKT.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_info.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_label.txt +0 -0
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/highGRschool10/test_label.txt +0 -0
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test_info.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test_label.txt +0 -0
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test_info.txt +0 -3
- ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test_label.txt +0 -0
- result.txt +7 -7
- roc_data.pkl +2 -2
- roc_data2.pkl +0 -3
- selected_rows.txt +0 -0
- test.txt +0 -0
- train.txt +0 -0
- train_info.txt +0 -3
- train_label.txt +0 -0
.gitattributes
CHANGED
@@ -38,15 +38,3 @@ ratio_proportion_change3/output/FS/bert_fine_tuned.model.ep32 filter=lfs diff=lf
|
|
38 |
ratio_proportion_change3/output/IS/bert_fine_tuned.model.ep14 filter=lfs diff=lfs merge=lfs -text
|
39 |
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/highGRschool10/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
40 |
ratio_proportion_change3_2223/sch_largest_100-coded/output/highGRschool10/bert_fine_tuned.model.ep42 filter=lfs diff=lfs merge=lfs -text
|
41 |
-
train_info.txt filter=lfs diff=lfs merge=lfs -text
|
42 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
43 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test.txt filter=lfs diff=lfs merge=lfs -text
|
44 |
-
fullTest/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
45 |
-
fullTest/test.txt filter=lfs diff=lfs merge=lfs -text
|
46 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
47 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test.txt filter=lfs diff=lfs merge=lfs -text
|
48 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
49 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test.txt filter=lfs diff=lfs merge=lfs -text
|
50 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
51 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test.txt filter=lfs diff=lfs merge=lfs -text
|
52 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_BKT.txt filter=lfs diff=lfs merge=lfs -text
|
|
|
38 |
ratio_proportion_change3/output/IS/bert_fine_tuned.model.ep14 filter=lfs diff=lfs merge=lfs -text
|
39 |
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/highGRschool10/test_info.txt filter=lfs diff=lfs merge=lfs -text
|
40 |
ratio_proportion_change3_2223/sch_largest_100-coded/output/highGRschool10/bert_fine_tuned.model.ep42 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
CHANGED
@@ -1,5 +1,2 @@
|
|
1 |
train_info.txt
|
2 |
-
train.txt
|
3 |
-
train_label.txt
|
4 |
ratio_proportion_change3_2223/sch_largest_100-coded/logs/
|
5 |
-
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/
|
|
|
1 |
train_info.txt
|
|
|
|
|
2 |
ratio_proportion_change3_2223/sch_largest_100-coded/logs/
|
|
.ipynb_checkpoints/Untitled-checkpoint.ipynb
DELETED
The diff for this file is too large to render.
See raw diff
|
|
.ipynb_checkpoints/distinguish_high_low_label-checkpoint.ipynb
DELETED
@@ -1,447 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 3,
|
6 |
-
"id": "960bac80-51c7-4e9f-ad2d-84cd6c710f98",
|
7 |
-
"metadata": {},
|
8 |
-
"outputs": [],
|
9 |
-
"source": [
|
10 |
-
"import pickle\n",
|
11 |
-
"import pandas as pd"
|
12 |
-
]
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"cell_type": "code",
|
16 |
-
"execution_count": 4,
|
17 |
-
"id": "a34f21d0-0854-4a54-8f93-67718b2f969e",
|
18 |
-
"metadata": {},
|
19 |
-
"outputs": [],
|
20 |
-
"source": [
|
21 |
-
"file_path = \"roc_data2.pkl\"\n",
|
22 |
-
"\n",
|
23 |
-
"# Open and load the pickle file\n",
|
24 |
-
"with open(file_path, 'rb') as file:\n",
|
25 |
-
" data = pickle.load(file)\n",
|
26 |
-
"\n",
|
27 |
-
"\n",
|
28 |
-
"# Print or use the data\n",
|
29 |
-
"# data[2]"
|
30 |
-
]
|
31 |
-
},
|
32 |
-
{
|
33 |
-
"cell_type": "code",
|
34 |
-
"execution_count": 5,
|
35 |
-
"id": "f9febed4-ce50-4e30-96ea-4b538ce2f9a1",
|
36 |
-
"metadata": {},
|
37 |
-
"outputs": [],
|
38 |
-
"source": [
|
39 |
-
"inc_slider=1\n",
|
40 |
-
"parent_location=\"ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/\"\n",
|
41 |
-
"test_info_location=parent_location+\"fullTest/test_info.txt\"\n",
|
42 |
-
"test_location=parent_location+\"fullTest/test.txt\"\n",
|
43 |
-
"test_info = pd.read_csv(test_info_location, sep=',', header=None, engine='python')\n",
|
44 |
-
"grad_rate_data = pd.DataFrame(pd.read_pickle('school_grduation_rate.pkl'),columns=['school_number','grad_rate']) # Load the grad_rate data\n",
|
45 |
-
"\n",
|
46 |
-
"# Step 1: Extract unique school numbers from test_info\n",
|
47 |
-
"unique_schools = test_info[0].unique()\n",
|
48 |
-
"\n",
|
49 |
-
"# Step 2: Filter the grad_rate_data using the unique school numbers\n",
|
50 |
-
"schools = grad_rate_data[grad_rate_data['school_number'].isin(unique_schools)]\n",
|
51 |
-
"\n",
|
52 |
-
"# Define a threshold for high and low graduation rates (adjust as needed)\n",
|
53 |
-
"grad_rate_threshold = 0.9 \n",
|
54 |
-
"\n",
|
55 |
-
"# Step 4: Divide schools into high and low graduation rate groups\n",
|
56 |
-
"high_grad_schools = schools[schools['grad_rate'] >= grad_rate_threshold]['school_number'].unique()\n",
|
57 |
-
"low_grad_schools = schools[schools['grad_rate'] < grad_rate_threshold]['school_number'].unique()\n",
|
58 |
-
"\n",
|
59 |
-
"# Step 5: Sample percentage of schools from each group\n",
|
60 |
-
"high_sample = pd.Series(high_grad_schools).sample(frac=inc_slider/100, random_state=1).tolist()\n",
|
61 |
-
"low_sample = pd.Series(low_grad_schools).sample(frac=inc_slider/100, random_state=1).tolist()\n",
|
62 |
-
"\n",
|
63 |
-
"# Step 6: Combine the sampled schools\n",
|
64 |
-
"random_schools = high_sample + low_sample\n",
|
65 |
-
"\n",
|
66 |
-
"# Step 7: Get indices for the sampled schools\n",
|
67 |
-
"indices = test_info[test_info[0].isin(random_schools)].index.tolist()\n",
|
68 |
-
"\n"
|
69 |
-
]
|
70 |
-
},
|
71 |
-
{
|
72 |
-
"cell_type": "code",
|
73 |
-
"execution_count": 6,
|
74 |
-
"id": "fdfdf4b6-2752-4a21-9880-869af69f20cf",
|
75 |
-
"metadata": {},
|
76 |
-
"outputs": [],
|
77 |
-
"source": [
|
78 |
-
"high_indices = test_info[(test_info[0].isin(high_sample))].index.tolist()\n",
|
79 |
-
"low_indices = test_info[(test_info[0].isin(low_sample))].index.tolist()"
|
80 |
-
]
|
81 |
-
},
|
82 |
-
{
|
83 |
-
"cell_type": "code",
|
84 |
-
"execution_count": 7,
|
85 |
-
"id": "a79a4598-5702-4cc8-9f07-8e18fdda648b",
|
86 |
-
"metadata": {},
|
87 |
-
"outputs": [
|
88 |
-
{
|
89 |
-
"data": {
|
90 |
-
"text/plain": [
|
91 |
-
"997"
|
92 |
-
]
|
93 |
-
},
|
94 |
-
"execution_count": 7,
|
95 |
-
"metadata": {},
|
96 |
-
"output_type": "execute_result"
|
97 |
-
}
|
98 |
-
],
|
99 |
-
"source": [
|
100 |
-
"len(high_indices)+len(low_indices)\n"
|
101 |
-
]
|
102 |
-
},
|
103 |
-
{
|
104 |
-
"cell_type": "code",
|
105 |
-
"execution_count": 8,
|
106 |
-
"id": "4707f3e6-2f44-46d8-ad8c-b6c244f693af",
|
107 |
-
"metadata": {},
|
108 |
-
"outputs": [
|
109 |
-
{
|
110 |
-
"data": {
|
111 |
-
"text/html": [
|
112 |
-
"<div>\n",
|
113 |
-
"<style scoped>\n",
|
114 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
115 |
-
" vertical-align: middle;\n",
|
116 |
-
" }\n",
|
117 |
-
"\n",
|
118 |
-
" .dataframe tbody tr th {\n",
|
119 |
-
" vertical-align: top;\n",
|
120 |
-
" }\n",
|
121 |
-
"\n",
|
122 |
-
" .dataframe thead th {\n",
|
123 |
-
" text-align: right;\n",
|
124 |
-
" }\n",
|
125 |
-
"</style>\n",
|
126 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
127 |
-
" <thead>\n",
|
128 |
-
" <tr style=\"text-align: right;\">\n",
|
129 |
-
" <th></th>\n",
|
130 |
-
" <th>0</th>\n",
|
131 |
-
" </tr>\n",
|
132 |
-
" </thead>\n",
|
133 |
-
" <tbody>\n",
|
134 |
-
" <tr>\n",
|
135 |
-
" <th>5342</th>\n",
|
136 |
-
" <td>PercentChange-0\\tNumeratorQuantity1-0\\tNumerat...</td>\n",
|
137 |
-
" </tr>\n",
|
138 |
-
" <tr>\n",
|
139 |
-
" <th>5343</th>\n",
|
140 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
141 |
-
" </tr>\n",
|
142 |
-
" <tr>\n",
|
143 |
-
" <th>5344</th>\n",
|
144 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
145 |
-
" </tr>\n",
|
146 |
-
" <tr>\n",
|
147 |
-
" <th>5345</th>\n",
|
148 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...</td>\n",
|
149 |
-
" </tr>\n",
|
150 |
-
" <tr>\n",
|
151 |
-
" <th>5346</th>\n",
|
152 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tDenomin...</td>\n",
|
153 |
-
" </tr>\n",
|
154 |
-
" <tr>\n",
|
155 |
-
" <th>...</th>\n",
|
156 |
-
" <td>...</td>\n",
|
157 |
-
" </tr>\n",
|
158 |
-
" <tr>\n",
|
159 |
-
" <th>113359</th>\n",
|
160 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...</td>\n",
|
161 |
-
" </tr>\n",
|
162 |
-
" <tr>\n",
|
163 |
-
" <th>113360</th>\n",
|
164 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
165 |
-
" </tr>\n",
|
166 |
-
" <tr>\n",
|
167 |
-
" <th>113361</th>\n",
|
168 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
169 |
-
" </tr>\n",
|
170 |
-
" <tr>\n",
|
171 |
-
" <th>113362</th>\n",
|
172 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
173 |
-
" </tr>\n",
|
174 |
-
" <tr>\n",
|
175 |
-
" <th>113363</th>\n",
|
176 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
177 |
-
" </tr>\n",
|
178 |
-
" </tbody>\n",
|
179 |
-
"</table>\n",
|
180 |
-
"<p>997 rows × 1 columns</p>\n",
|
181 |
-
"</div>"
|
182 |
-
],
|
183 |
-
"text/plain": [
|
184 |
-
" 0\n",
|
185 |
-
"5342 PercentChange-0\\tNumeratorQuantity1-0\\tNumerat...\n",
|
186 |
-
"5343 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
187 |
-
"5344 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
188 |
-
"5345 PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...\n",
|
189 |
-
"5346 PercentChange-0\\tNumeratorQuantity2-0\\tDenomin...\n",
|
190 |
-
"... ...\n",
|
191 |
-
"113359 PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...\n",
|
192 |
-
"113360 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
193 |
-
"113361 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
194 |
-
"113362 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
195 |
-
"113363 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
196 |
-
"\n",
|
197 |
-
"[997 rows x 1 columns]"
|
198 |
-
]
|
199 |
-
},
|
200 |
-
"execution_count": 8,
|
201 |
-
"metadata": {},
|
202 |
-
"output_type": "execute_result"
|
203 |
-
}
|
204 |
-
],
|
205 |
-
"source": [
|
206 |
-
"# Load the test file and select rows based on indices\n",
|
207 |
-
"test = pd.read_csv(test_location, sep=',', header=None, engine='python')\n",
|
208 |
-
"selected_rows_df2 = test.loc[indices]\n",
|
209 |
-
"selected_rows_df2"
|
210 |
-
]
|
211 |
-
},
|
212 |
-
{
|
213 |
-
"cell_type": "code",
|
214 |
-
"execution_count": 11,
|
215 |
-
"id": "1d0c3d49-061f-486b-9c19-cf20945f3207",
|
216 |
-
"metadata": {},
|
217 |
-
"outputs": [],
|
218 |
-
"source": [
|
219 |
-
"graduation_groups = [\n",
|
220 |
-
" 'high' if idx in high_indices else 'low' for idx in selected_rows_df2.index\n",
|
221 |
-
"]\n",
|
222 |
-
"# graduation_groups"
|
223 |
-
]
|
224 |
-
},
|
225 |
-
{
|
226 |
-
"cell_type": "code",
|
227 |
-
"execution_count": 43,
|
228 |
-
"id": "ad0ce4a1-27fa-4867-8061-4054dbb340df",
|
229 |
-
"metadata": {},
|
230 |
-
"outputs": [],
|
231 |
-
"source": [
|
232 |
-
"t_label=data[0]\n",
|
233 |
-
"p_label=data[1]"
|
234 |
-
]
|
235 |
-
},
|
236 |
-
{
|
237 |
-
"cell_type": "code",
|
238 |
-
"execution_count": 47,
|
239 |
-
"id": "a4f4a2b9-3134-42ac-871b-4e117098cd0e",
|
240 |
-
"metadata": {},
|
241 |
-
"outputs": [],
|
242 |
-
"source": [
|
243 |
-
"# Step 1: Align graduation_group, t_label, and p_label\n",
|
244 |
-
"aligned_labels = list(zip(graduation_groups, t_label, p_label))\n",
|
245 |
-
"\n",
|
246 |
-
"# Step 2: Separate the labels for high and low groups\n",
|
247 |
-
"high_t_labels = [t for grad, t, p in aligned_labels if grad == 'high']\n",
|
248 |
-
"low_t_labels = [t for grad, t, p in aligned_labels if grad == 'low']\n",
|
249 |
-
"\n",
|
250 |
-
"high_p_labels = [p for grad, t, p in aligned_labels if grad == 'high']\n",
|
251 |
-
"low_p_labels = [p for grad, t, p in aligned_labels if grad == 'low']\n",
|
252 |
-
"\n"
|
253 |
-
]
|
254 |
-
},
|
255 |
-
{
|
256 |
-
"cell_type": "code",
|
257 |
-
"execution_count": 50,
|
258 |
-
"id": "c8e34660-83d0-46a1-a218-95d609e11729",
|
259 |
-
"metadata": {},
|
260 |
-
"outputs": [
|
261 |
-
{
|
262 |
-
"data": {
|
263 |
-
"text/plain": [
|
264 |
-
"997"
|
265 |
-
]
|
266 |
-
},
|
267 |
-
"execution_count": 50,
|
268 |
-
"metadata": {},
|
269 |
-
"output_type": "execute_result"
|
270 |
-
}
|
271 |
-
],
|
272 |
-
"source": [
|
273 |
-
"len(low_t_labels)+len(high_t_labels)"
|
274 |
-
]
|
275 |
-
},
|
276 |
-
{
|
277 |
-
"cell_type": "code",
|
278 |
-
"execution_count": 51,
|
279 |
-
"id": "c11050db-2636-4c50-9cd4-b9943e5cee83",
|
280 |
-
"metadata": {},
|
281 |
-
"outputs": [],
|
282 |
-
"source": [
|
283 |
-
"from sklearn.metrics import precision_score, recall_score, f1_score, confusion_matrix, roc_curve, roc_auc_score"
|
284 |
-
]
|
285 |
-
},
|
286 |
-
{
|
287 |
-
"cell_type": "code",
|
288 |
-
"execution_count": 52,
|
289 |
-
"id": "e1309e93-7063-4f48-bbc7-11a0d449c34e",
|
290 |
-
"metadata": {},
|
291 |
-
"outputs": [
|
292 |
-
{
|
293 |
-
"name": "stdout",
|
294 |
-
"output_type": "stream",
|
295 |
-
"text": [
|
296 |
-
"ROC-AUC Score for High Graduation Rate Group: 0.675\n",
|
297 |
-
"ROC-AUC Score for Low Graduation Rate Group: 0.7489795918367347\n"
|
298 |
-
]
|
299 |
-
}
|
300 |
-
],
|
301 |
-
"source": [
|
302 |
-
"high_roc_auc = roc_auc_score(high_t_labels, high_p_labels) if len(set(high_t_labels)) > 1 else None\n",
|
303 |
-
"low_roc_auc = roc_auc_score(low_t_labels, low_p_labels) if len(set(low_t_labels)) > 1 else None\n",
|
304 |
-
"\n",
|
305 |
-
"print(\"ROC-AUC Score for High Graduation Rate Group:\", high_roc_auc)\n",
|
306 |
-
"print(\"ROC-AUC Score for Low Graduation Rate Group:\", low_roc_auc)"
|
307 |
-
]
|
308 |
-
},
|
309 |
-
{
|
310 |
-
"cell_type": "code",
|
311 |
-
"execution_count": 4,
|
312 |
-
"id": "a99e7812-817d-4f9f-b6fa-1a58aa3a34dc",
|
313 |
-
"metadata": {},
|
314 |
-
"outputs": [
|
315 |
-
{
|
316 |
-
"ename": "TypeError",
|
317 |
-
"evalue": "cannot convert the series to <class 'int'>",
|
318 |
-
"output_type": "error",
|
319 |
-
"traceback": [
|
320 |
-
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
321 |
-
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
|
322 |
-
"Cell \u001b[1;32mIn[4], line 47\u001b[0m\n\u001b[0;32m 44\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(test_info_location, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m file:\n\u001b[0;32m 45\u001b[0m data \u001b[38;5;241m=\u001b[39m file\u001b[38;5;241m.\u001b[39mreadlines()\n\u001b[1;32m---> 47\u001b[0m ideal_opt_task \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mtest_info\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m7\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# Assuming test_info[7] is accessible and holds the ideal task (1 or 2)\u001b[39;00m\n\u001b[0;32m 49\u001b[0m \u001b[38;5;66;03m# Initialize counters\u001b[39;00m\n\u001b[0;32m 50\u001b[0m task_counts \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 51\u001b[0m \u001b[38;5;241m1\u001b[39m: {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124monly_opt1\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m0\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124monly_opt2\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m0\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mboth\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m0\u001b[39m},\n\u001b[0;32m 52\u001b[0m \u001b[38;5;241m2\u001b[39m: {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124monly_opt1\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m0\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124monly_opt2\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m0\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mboth\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m0\u001b[39m}\n\u001b[0;32m 53\u001b[0m }\n",
|
323 |
-
"File \u001b[1;32m~\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\pandas\\core\\series.py:230\u001b[0m, in \u001b[0;36m_coerce_method.<locals>.wrapper\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 222\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(\n\u001b[0;32m 223\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCalling \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconverter\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m on a single element Series is \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 224\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdeprecated and will raise a TypeError in the future. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 227\u001b[0m stacklevel\u001b[38;5;241m=\u001b[39mfind_stack_level(),\n\u001b[0;32m 228\u001b[0m )\n\u001b[0;32m 229\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m converter(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miloc[\u001b[38;5;241m0\u001b[39m])\n\u001b[1;32m--> 230\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcannot convert the series to \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconverter\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n",
|
324 |
-
"\u001b[1;31mTypeError\u001b[0m: cannot convert the series to <class 'int'>"
|
325 |
-
]
|
326 |
-
}
|
327 |
-
],
|
328 |
-
"source": [
|
329 |
-
"parent_location=\"ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/\"\n",
|
330 |
-
"test_info_location=parent_location+\"fullTest/test_info.txt\"\n",
|
331 |
-
"test_location=parent_location+\"fullTest/test.txt\"\n",
|
332 |
-
"test_info = pd.read_csv(test_info_location, sep=',', header=None, engine='python')\n",
|
333 |
-
"\n",
|
334 |
-
"def analyze_row(row, ideal_opt_task):\n",
|
335 |
-
" # Split the row into fields\n",
|
336 |
-
" fields = row.split(\"\\t\")\n",
|
337 |
-
"\n",
|
338 |
-
" # Define tasks for OptionalTask_1, OptionalTask_2, and FinalAnswer\n",
|
339 |
-
" optional_task_1_subtasks = [\"DenominatorFactor\", \"NumeratorFactor\", \"EquationAnswer\"]\n",
|
340 |
-
" optional_task_2_subtasks = [\n",
|
341 |
-
" \"FirstRow2:1\", \"FirstRow2:2\", \"FirstRow1:1\", \"FirstRow1:2\", \n",
|
342 |
-
" \"SecondRow\", \"ThirdRow\"\n",
|
343 |
-
" ]\n",
|
344 |
-
" final_answer_tasks = [\"FinalAnswer\"]\n",
|
345 |
-
"\n",
|
346 |
-
" # Helper function to evaluate task attempts\n",
|
347 |
-
" def evaluate_tasks(fields, tasks):\n",
|
348 |
-
" task_status = {}\n",
|
349 |
-
" for task in tasks:\n",
|
350 |
-
" relevant_attempts = [f for f in fields if task in f]\n",
|
351 |
-
" if any(\"OK\" in attempt for attempt in relevant_attempts):\n",
|
352 |
-
" task_status[task] = \"Attempted (Successful)\"\n",
|
353 |
-
" elif any(\"ERROR\" in attempt for attempt in relevant_attempts):\n",
|
354 |
-
" task_status[task] = \"Attempted (Error)\"\n",
|
355 |
-
" elif any(\"JIT\" in attempt for attempt in relevant_attempts):\n",
|
356 |
-
" task_status[task] = \"Attempted (JIT)\"\n",
|
357 |
-
" else:\n",
|
358 |
-
" task_status[task] = \"Unattempted\"\n",
|
359 |
-
" return task_status\n",
|
360 |
-
"\n",
|
361 |
-
" # Evaluate tasks for each category\n",
|
362 |
-
" optional_task_1_status = evaluate_tasks(fields, optional_task_1_subtasks)\n",
|
363 |
-
" optional_task_2_status = evaluate_tasks(fields, optional_task_2_subtasks)\n",
|
364 |
-
"\n",
|
365 |
-
" # Check if tasks have any successful attempt\n",
|
366 |
-
" opt1_done = any(status == \"Attempted (Successful)\" for status in optional_task_1_status.values())\n",
|
367 |
-
" opt2_done = any(status == \"Attempted (Successful)\" for status in optional_task_2_status.values())\n",
|
368 |
-
"\n",
|
369 |
-
" return opt1_done, opt2_done\n",
|
370 |
-
"\n",
|
371 |
-
"# Read data from test_info.txt\n",
|
372 |
-
"with open(test_info_location, \"r\") as file:\n",
|
373 |
-
" data = file.readlines()\n",
|
374 |
-
"\n",
|
375 |
-
"ideal_opt_task = int(test_info[6]) # Assuming test_info[7] is accessible and holds the ideal task (1 or 2)\n",
|
376 |
-
"\n",
|
377 |
-
"# Initialize counters\n",
|
378 |
-
"task_counts = {\n",
|
379 |
-
" 1: {\"only_opt1\": 0, \"only_opt2\": 0, \"both\": 0},\n",
|
380 |
-
" 2: {\"only_opt1\": 0, \"only_opt2\": 0, \"both\": 0}\n",
|
381 |
-
"}\n",
|
382 |
-
"\n",
|
383 |
-
"for row in data:\n",
|
384 |
-
" row = row.strip()\n",
|
385 |
-
" if not row:\n",
|
386 |
-
" continue\n",
|
387 |
-
" opt1_done, opt2_done = analyze_row(row, ideal_opt_task)\n",
|
388 |
-
"\n",
|
389 |
-
" if ideal_opt_task == 0:\n",
|
390 |
-
" if opt1_done and not opt2_done:\n",
|
391 |
-
" task_counts[1][\"only_opt1\"] += 1\n",
|
392 |
-
" elif not opt1_done and opt2_done:\n",
|
393 |
-
" task_counts[1][\"only_opt2\"] += 1\n",
|
394 |
-
" elif opt1_done and opt2_done:\n",
|
395 |
-
" task_counts[1][\"both\"] += 1\n",
|
396 |
-
" elif ideal_opt_task == 1:\n",
|
397 |
-
" if opt1_done and not opt2_done:\n",
|
398 |
-
" task_counts[2][\"only_opt1\"] += 1\n",
|
399 |
-
" elif not opt1_done and opt2_done:\n",
|
400 |
-
" task_counts[2][\"only_opt2\"] += 1\n",
|
401 |
-
" elif opt1_done and opt2_done:\n",
|
402 |
-
" task_counts[2][\"both\"] += 1\n",
|
403 |
-
"\n",
|
404 |
-
"# Create a string output for results\n",
|
405 |
-
"output_summary = \"Task Analysis Summary:\\n\"\n",
|
406 |
-
"output_summary += \"-----------------------\\n\"\n",
|
407 |
-
"\n",
|
408 |
-
"for ideal_task, counts in task_counts.items():\n",
|
409 |
-
" output_summary += f\"Ideal Task = OptionalTask_{ideal_task}:\\n\"\n",
|
410 |
-
" output_summary += f\" Only OptionalTask_1 done: {counts['only_opt1']}\\n\"\n",
|
411 |
-
" output_summary += f\" Only OptionalTask_2 done: {counts['only_opt2']}\\n\"\n",
|
412 |
-
" output_summary += f\" Both done: {counts['both']}\\n\"\n",
|
413 |
-
"\n",
|
414 |
-
"print(output_summary)"
|
415 |
-
]
|
416 |
-
},
|
417 |
-
{
|
418 |
-
"cell_type": "code",
|
419 |
-
"execution_count": null,
|
420 |
-
"id": "65ad9383-741f-44eb-8e8f-853ee7bc52a2",
|
421 |
-
"metadata": {},
|
422 |
-
"outputs": [],
|
423 |
-
"source": []
|
424 |
-
}
|
425 |
-
],
|
426 |
-
"metadata": {
|
427 |
-
"kernelspec": {
|
428 |
-
"display_name": "Python 3 (ipykernel)",
|
429 |
-
"language": "python",
|
430 |
-
"name": "python3"
|
431 |
-
},
|
432 |
-
"language_info": {
|
433 |
-
"codemirror_mode": {
|
434 |
-
"name": "ipython",
|
435 |
-
"version": 3
|
436 |
-
},
|
437 |
-
"file_extension": ".py",
|
438 |
-
"mimetype": "text/x-python",
|
439 |
-
"name": "python",
|
440 |
-
"nbconvert_exporter": "python",
|
441 |
-
"pygments_lexer": "ipython3",
|
442 |
-
"version": "3.12.4"
|
443 |
-
}
|
444 |
-
},
|
445 |
-
"nbformat": 4,
|
446 |
-
"nbformat_minor": 5
|
447 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Untitled.ipynb
CHANGED
@@ -623,7 +623,7 @@
|
|
623 |
"uri": "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113:m122"
|
624 |
},
|
625 |
"kernelspec": {
|
626 |
-
"display_name": "Python 3
|
627 |
"language": "python",
|
628 |
"name": "python3"
|
629 |
},
|
@@ -637,7 +637,7 @@
|
|
637 |
"name": "python",
|
638 |
"nbconvert_exporter": "python",
|
639 |
"pygments_lexer": "ipython3",
|
640 |
-
"version": "3.
|
641 |
}
|
642 |
},
|
643 |
"nbformat": 4,
|
|
|
623 |
"uri": "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113:m122"
|
624 |
},
|
625 |
"kernelspec": {
|
626 |
+
"display_name": "Python 3",
|
627 |
"language": "python",
|
628 |
"name": "python3"
|
629 |
},
|
|
|
637 |
"name": "python",
|
638 |
"nbconvert_exporter": "python",
|
639 |
"pygments_lexer": "ipython3",
|
640 |
+
"version": "3.10.14"
|
641 |
}
|
642 |
},
|
643 |
"nbformat": 4,
|
app.py
CHANGED
@@ -8,41 +8,24 @@ import shutil
|
|
8 |
import matplotlib.pyplot as plt
|
9 |
from sklearn.metrics import roc_curve, auc
|
10 |
import pandas as pd
|
11 |
-
from sklearn.metrics import roc_auc_score
|
12 |
# Define the function to process the input file and model selection
|
13 |
|
14 |
-
def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
15 |
# progress = gr.Progress(track_tqdm=True)
|
16 |
-
|
17 |
progress(0, desc="Starting the processing")
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
# Save the uploaded file content to a specified location
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
test_location=parent_location+"fullTest/test.txt"
|
30 |
-
if(model_name=="ASTRA-FT-HGR"):
|
31 |
-
finetune_task="highGRschool10"
|
32 |
-
# test_info_location=parent_location+"fullTest/test_info.txt"
|
33 |
-
# test_location=parent_location+"fullTest/test.txt"
|
34 |
-
elif(model_name== "ASTRA-FT-LGR" ):
|
35 |
-
finetune_task="lowGRschoolAll"
|
36 |
-
# test_info_location=parent_location+"lowGRschoolAll/test_info.txt"
|
37 |
-
# test_location=parent_location+"lowGRschoolAll/test.txt"
|
38 |
-
elif(model_name=="ASTRA-FT-FULL"):
|
39 |
-
# test_info_location=parent_location+"fullTest/test_info.txt"
|
40 |
-
# test_location=parent_location+"fullTest/test.txt"
|
41 |
-
finetune_task="fullTest"
|
42 |
-
else:
|
43 |
-
finetune_task=None
|
44 |
# Load the test_info file and the graduation rate file
|
45 |
-
test_info = pd.read_csv(
|
46 |
grad_rate_data = pd.DataFrame(pd.read_pickle('school_grduation_rate.pkl'),columns=['school_number','grad_rate']) # Load the grad_rate data
|
47 |
|
48 |
# Step 1: Extract unique school numbers from test_info
|
@@ -67,39 +50,24 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
67 |
|
68 |
# Step 7: Get indices for the sampled schools
|
69 |
indices = test_info[test_info[0].isin(random_schools)].index.tolist()
|
70 |
-
high_indices = test_info[(test_info[0].isin(high_sample))].index.tolist()
|
71 |
-
low_indices = test_info[(test_info[0].isin(low_sample))].index.tolist()
|
72 |
|
73 |
# Load the test file and select rows based on indices
|
74 |
-
test = pd.read_csv(
|
75 |
selected_rows_df2 = test.loc[indices]
|
76 |
|
77 |
# Save the selected rows to a file
|
78 |
selected_rows_df2.to_csv('selected_rows.txt', sep='\t', index=False, header=False, quoting=3, escapechar=' ')
|
79 |
|
80 |
-
|
81 |
-
'high' if idx in high_indices else 'low' for idx in selected_rows_df2.index
|
82 |
-
]
|
83 |
-
|
84 |
-
|
85 |
-
with open("roc_data2.pkl", 'rb') as file:
|
86 |
-
data = pickle.load(file)
|
87 |
-
t_label=data[0]
|
88 |
-
p_label=data[1]
|
89 |
-
# Step 1: Align graduation_group, t_label, and p_label
|
90 |
-
aligned_labels = list(zip(graduation_groups, t_label, p_label))
|
91 |
-
|
92 |
-
# Step 2: Separate the labels for high and low groups
|
93 |
-
high_t_labels = [t for grad, t, p in aligned_labels if grad == 'high']
|
94 |
-
low_t_labels = [t for grad, t, p in aligned_labels if grad == 'low']
|
95 |
-
|
96 |
-
high_p_labels = [p for grad, t, p in aligned_labels if grad == 'high']
|
97 |
-
low_p_labels = [p for grad, t, p in aligned_labels if grad == 'low']
|
98 |
-
|
99 |
-
high_roc_auc = roc_auc_score(high_t_labels, high_p_labels) if len(set(high_t_labels)) > 1 else None
|
100 |
-
low_roc_auc = roc_auc_score(low_t_labels, low_p_labels) if len(set(low_t_labels)) > 1 else None
|
101 |
# For demonstration purposes, we'll just return the content with the selected model name
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
# print(checkpoint)
|
104 |
progress(0.1, desc="Files created and saved")
|
105 |
# if (inc_val<5):
|
@@ -108,99 +76,11 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
108 |
# model_name="highGRschool10"
|
109 |
# else:
|
110 |
# model_name="highGRschool10"
|
111 |
-
|
112 |
-
def analyze_row(row):
|
113 |
-
# Split the row into fields
|
114 |
-
fields = row.split("\t")
|
115 |
-
|
116 |
-
# Define tasks for OptionalTask_1, OptionalTask_2, and FinalAnswer
|
117 |
-
optional_task_1_subtasks = ["DenominatorFactor", "NumeratorFactor", "EquationAnswer"]
|
118 |
-
optional_task_2_subtasks = [
|
119 |
-
"FirstRow2:1", "FirstRow2:2", "FirstRow1:1", "FirstRow1:2",
|
120 |
-
"SecondRow", "ThirdRow"
|
121 |
-
]
|
122 |
-
|
123 |
-
# Helper function to evaluate task attempts
|
124 |
-
def evaluate_tasks(fields, tasks):
|
125 |
-
task_status = {}
|
126 |
-
for task in tasks:
|
127 |
-
relevant_attempts = [f for f in fields if task in f]
|
128 |
-
if any("OK" in attempt for attempt in relevant_attempts):
|
129 |
-
task_status[task] = "Attempted (Successful)"
|
130 |
-
elif any("ERROR" in attempt for attempt in relevant_attempts):
|
131 |
-
task_status[task] = "Attempted (Error)"
|
132 |
-
elif any("JIT" in attempt for attempt in relevant_attempts):
|
133 |
-
task_status[task] = "Attempted (JIT)"
|
134 |
-
else:
|
135 |
-
task_status[task] = "Unattempted"
|
136 |
-
return task_status
|
137 |
-
|
138 |
-
# Evaluate tasks for each category
|
139 |
-
optional_task_1_status = evaluate_tasks(fields, optional_task_1_subtasks)
|
140 |
-
optional_task_2_status = evaluate_tasks(fields, optional_task_2_subtasks)
|
141 |
-
|
142 |
-
# Check if tasks have any successful attempt
|
143 |
-
opt1_done = any(status == "Attempted (Successful)" for status in optional_task_1_status.values())
|
144 |
-
opt2_done = any(status == "Attempted (Successful)" for status in optional_task_2_status.values())
|
145 |
-
|
146 |
-
return opt1_done, opt2_done
|
147 |
-
|
148 |
-
# Read data from test_info.txt
|
149 |
-
# Read data from test_info.txt
|
150 |
-
with open(test_info_location, "r") as file:
|
151 |
-
data = file.readlines()
|
152 |
-
|
153 |
-
# Assuming test_info[7] is a list with ideal tasks for each instance
|
154 |
-
ideal_tasks = test_info[6] # A list where each element is either 1 or 2
|
155 |
-
|
156 |
-
# Initialize counters
|
157 |
-
task_counts = {
|
158 |
-
1: {"only_opt1": 0, "only_opt2": 0, "both": 0},
|
159 |
-
2: {"only_opt1": 0, "only_opt2": 0, "both": 0}
|
160 |
-
}
|
161 |
-
|
162 |
-
# Analyze rows
|
163 |
-
for i, row in enumerate(data):
|
164 |
-
row = row.strip()
|
165 |
-
if not row:
|
166 |
-
continue
|
167 |
-
|
168 |
-
ideal_task = ideal_tasks[i] # Get the ideal task for the current row
|
169 |
-
opt1_done, opt2_done = analyze_row(row)
|
170 |
-
|
171 |
-
if ideal_task == 0:
|
172 |
-
if opt1_done and not opt2_done:
|
173 |
-
task_counts[1]["only_opt1"] += 1
|
174 |
-
elif not opt1_done and opt2_done:
|
175 |
-
task_counts[1]["only_opt2"] += 1
|
176 |
-
elif opt1_done and opt2_done:
|
177 |
-
task_counts[1]["both"] += 1
|
178 |
-
elif ideal_task == 1:
|
179 |
-
if opt1_done and not opt2_done:
|
180 |
-
task_counts[2]["only_opt1"] += 1
|
181 |
-
elif not opt1_done and opt2_done:
|
182 |
-
task_counts[2]["only_opt2"] += 1
|
183 |
-
elif opt1_done and opt2_done:
|
184 |
-
task_counts[2]["both"] += 1
|
185 |
-
|
186 |
-
# Create a string output for results
|
187 |
-
output_summary = "Task Analysis Summary:\n"
|
188 |
-
output_summary += "-----------------------\n"
|
189 |
-
|
190 |
-
for ideal_task, counts in task_counts.items():
|
191 |
-
output_summary += f"Ideal Task = OptionalTask_{ideal_task}:\n"
|
192 |
-
output_summary += f" Only OptionalTask_1 done: {counts['only_opt1']}\n"
|
193 |
-
output_summary += f" Only OptionalTask_2 done: {counts['only_opt2']}\n"
|
194 |
-
output_summary += f" Both done: {counts['both']}\n"
|
195 |
-
|
196 |
-
# print(output_summary)
|
197 |
-
|
198 |
-
progress(0.2, desc="analysis done!! Executing models")
|
199 |
-
print("finetuned task: ",finetune_task)
|
200 |
subprocess.run([
|
201 |
"python", "new_test_saved_finetuned_model.py",
|
202 |
"-workspace_name", "ratio_proportion_change3_2223/sch_largest_100-coded",
|
203 |
-
"-finetune_task",
|
204 |
"-test_dataset_path","../../../../selected_rows.txt",
|
205 |
# "-test_label_path","../../../../train_label.txt",
|
206 |
"-finetuned_bert_classifier_checkpoint",
|
@@ -218,17 +98,15 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
218 |
result[key]=value
|
219 |
else:
|
220 |
result[key]=float(value)
|
221 |
-
result["ROC score of HGR"]=high_roc_auc
|
222 |
-
result["ROC score of LGR"]=low_roc_auc
|
223 |
# Create a plot
|
224 |
with open("roc_data.pkl", "rb") as f:
|
225 |
fpr, tpr, _ = pickle.load(f)
|
226 |
-
|
227 |
roc_auc = auc(fpr, tpr)
|
228 |
fig, ax = plt.subplots()
|
229 |
ax.plot(fpr, tpr, color='blue', lw=2, label=f'ROC curve (area = {roc_auc:.2f})')
|
230 |
ax.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
|
231 |
-
ax.set(xlabel='False Positive Rate', ylabel='True Positive Rate', title=f'
|
232 |
ax.legend(loc="lower right")
|
233 |
ax.grid()
|
234 |
|
@@ -236,75 +114,30 @@ def process_file(model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
|
236 |
plot_path = "plot.png"
|
237 |
fig.savefig(plot_path)
|
238 |
plt.close(fig)
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
progress(1.0)
|
244 |
# Prepare text output
|
245 |
text_output = f"Model: {model_name}\nResult:\n{result}"
|
246 |
# Prepare text output with HTML formatting
|
247 |
text_output = f"""
|
248 |
Model: {model_name}\n
|
|
|
249 |
-----------------\n
|
250 |
-
|
|
|
251 |
Time Taken: {result['time_taken_from_start']:.2f} seconds\n
|
252 |
Total Schools in test: {len(unique_schools):.4f}\n
|
253 |
-
Total
|
254 |
-
|
255 |
-
|
256 |
-
ROC score of HGR: {high_roc_auc}\n
|
257 |
-
ROC score of LGR: {low_roc_auc}\n
|
258 |
-----------------\n
|
|
|
259 |
"""
|
260 |
-
return text_output,plot_path
|
261 |
|
262 |
# List of models for the dropdown menu
|
263 |
|
264 |
-
|
265 |
-
models = ["ASTRA-FT-HGR", "ASTRA-FT-FULL"]
|
266 |
-
content = """
|
267 |
-
<h1 style="color: white;">ASTRA: An AI Model for Analyzing Math Strategies</h1>
|
268 |
-
|
269 |
-
<h3 style="color: white;">
|
270 |
-
<a href="https://drive.google.com/file/d/1lbEpg8Se1ugTtkjreD8eXIg7qrplhWan/view" style="color: #1E90FF; text-decoration: none;">Link To Paper</a> |
|
271 |
-
<a href="https://github.com/Syudu41/ASTRA---Gates-Project" style="color: #1E90FF; text-decoration: none;">GitHub</a> |
|
272 |
-
<a href="#" style="color: #1E90FF; text-decoration: none;">Project Page</a>
|
273 |
-
</h3>
|
274 |
-
|
275 |
-
<p style="color: white;">Welcome to a demo of ASTRA. ASTRA is a collaborative research project between researchers at the
|
276 |
-
<a href="https://www.memphis.edu" style="color: #1E90FF; text-decoration: none;">University of Memphis</a> and
|
277 |
-
<a href="https://www.carnegielearning.com" style="color: #1E90FF; text-decoration: none;">Carnegie Learning</a>
|
278 |
-
to utilize AI to improve our understanding of math learning strategies.</p>
|
279 |
-
|
280 |
-
<p style="color: white;">This demo has been developed with a pre-trained model (based on an architecture similar to BERT)
|
281 |
-
that learns math strategies using data collected from hundreds of schools in the U.S. who have used
|
282 |
-
Carnegie Learning's MATHia (formerly known as Cognitive Tutor), the flagship Intelligent Tutor
|
283 |
-
that is part of a core, blended math curriculum.</p>
|
284 |
-
|
285 |
-
<p style="color: white;">For this demo, we have used data from a specific domain (teaching ratio and proportions) within
|
286 |
-
7th grade math. The fine-tuning based on the pre-trained models learns to predict which strategies
|
287 |
-
lead to correct vs. incorrect solutions.</p>
|
288 |
|
289 |
-
<p style="color: white;">To use the demo, please follow these steps:</p>
|
290 |
-
|
291 |
-
<ol style="color: white;">
|
292 |
-
<li style="color: white;">Select a fine-tuned model:
|
293 |
-
<ul style="color: white;">
|
294 |
-
<li style="color: white;">ASTRA-FT-HGR: Fine-tuned with a small sample of data from schools that have a high graduation rate.</li>
|
295 |
-
<li style="color: white;">ASTRA-FT-Full: Fine-tuned with a small sample of data from a mix of schools that have high/low graduation rates.</li>
|
296 |
-
</ul>
|
297 |
-
</li>
|
298 |
-
<li style="color: white;">Select a percentage of schools to analyze (selecting a large percentage may take a long time).</li>
|
299 |
-
<li style="color: white;">View Results:
|
300 |
-
<ul>
|
301 |
-
<li style="color: white;">The results from the fine-tuned model are displayed on the dashboard.</li>
|
302 |
-
<li style="color: white;">The results are shown separately for schools that have high and low graduation rates.</li>
|
303 |
-
</ul>
|
304 |
-
</li>
|
305 |
-
</ol>
|
306 |
-
"""
|
307 |
-
# CSS styling for white text
|
308 |
# Create the Gradio interface
|
309 |
with gr.Blocks(css="""
|
310 |
body {
|
@@ -312,7 +145,6 @@ with gr.Blocks(css="""
|
|
312 |
font-family: 'Arial', sans-serif;
|
313 |
color: #f5f5f5!important;;
|
314 |
}
|
315 |
-
|
316 |
.gradio-container {
|
317 |
max-width: 850px!important;
|
318 |
margin: 0 auto!important;;
|
@@ -484,35 +316,31 @@ tbody.svelte-18wv37q>tr.svelte-18wv37q:nth-child(odd) {
|
|
484 |
color: white;
|
485 |
background: #aca7b2;
|
486 |
}
|
487 |
-
|
488 |
.gradio-container-4-31-4 .prose h1, .gradio-container-4-31-4 .prose h2, .gradio-container-4-31-4 .prose h3, .gradio-container-4-31-4 .prose h4, .gradio-container-4-31-4 .prose h5 {
|
489 |
|
490 |
color: white;
|
491 |
-
}
|
492 |
""") as demo:
|
493 |
-
|
494 |
gr.Markdown("<h1 id='title'>ASTRA</h1>", elem_id="title")
|
495 |
-
gr.Markdown(
|
496 |
|
497 |
with gr.Row():
|
498 |
-
|
499 |
-
|
500 |
|
501 |
-
|
502 |
|
503 |
-
|
504 |
|
505 |
|
506 |
increment_slider = gr.Slider(minimum=1, maximum=100, step=1, label="Schools Percentage", value=1)
|
507 |
-
|
508 |
with gr.Row():
|
509 |
-
output_text = gr.Textbox(label="")
|
510 |
-
output_image = gr.Image(label="
|
511 |
-
output_summary = gr.Textbox(label="Summary")
|
512 |
|
513 |
btn = gr.Button("Submit")
|
514 |
|
515 |
-
btn.click(fn=process_file, inputs=[model_dropdown,increment_slider], outputs=[output_text,output_image
|
516 |
|
517 |
|
518 |
# Launch the app
|
|
|
8 |
import matplotlib.pyplot as plt
|
9 |
from sklearn.metrics import roc_curve, auc
|
10 |
import pandas as pd
|
|
|
11 |
# Define the function to process the input file and model selection
|
12 |
|
13 |
+
def process_file(file,label,info,model_name,inc_slider,progress=Progress(track_tqdm=True)):
|
14 |
# progress = gr.Progress(track_tqdm=True)
|
|
|
15 |
progress(0, desc="Starting the processing")
|
16 |
+
with open(file.name, 'r') as f:
|
17 |
+
content = f.read()
|
18 |
+
saved_test_dataset = "train.txt"
|
19 |
+
saved_test_label = "train_label.txt"
|
20 |
+
saved_train_info="train_info.txt"
|
21 |
# Save the uploaded file content to a specified location
|
22 |
+
shutil.copyfile(file.name, saved_test_dataset)
|
23 |
+
shutil.copyfile(label.name, saved_test_label)
|
24 |
+
shutil.copyfile(info.name, saved_train_info)
|
25 |
+
|
26 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# Load the test_info file and the graduation rate file
|
28 |
+
test_info = pd.read_csv('train_info.txt', sep=',', header=None, engine='python')
|
29 |
grad_rate_data = pd.DataFrame(pd.read_pickle('school_grduation_rate.pkl'),columns=['school_number','grad_rate']) # Load the grad_rate data
|
30 |
|
31 |
# Step 1: Extract unique school numbers from test_info
|
|
|
50 |
|
51 |
# Step 7: Get indices for the sampled schools
|
52 |
indices = test_info[test_info[0].isin(random_schools)].index.tolist()
|
|
|
|
|
53 |
|
54 |
# Load the test file and select rows based on indices
|
55 |
+
test = pd.read_csv('train.txt', sep=',', header=None, engine='python')
|
56 |
selected_rows_df2 = test.loc[indices]
|
57 |
|
58 |
# Save the selected rows to a file
|
59 |
selected_rows_df2.to_csv('selected_rows.txt', sep='\t', index=False, header=False, quoting=3, escapechar=' ')
|
60 |
|
61 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
# For demonstration purposes, we'll just return the content with the selected model name
|
63 |
+
if(model_name=="High Graduated Schools"):
|
64 |
+
finetune_task="highGRschool10"
|
65 |
+
elif(model_name== "Low Graduated Schools" ):
|
66 |
+
finetune_task="highGRschool10"
|
67 |
+
elif(model_name=="Full Set"):
|
68 |
+
finetune_task="highGRschool10"
|
69 |
+
else:
|
70 |
+
finetune_task=None
|
71 |
# print(checkpoint)
|
72 |
progress(0.1, desc="Files created and saved")
|
73 |
# if (inc_val<5):
|
|
|
76 |
# model_name="highGRschool10"
|
77 |
# else:
|
78 |
# model_name="highGRschool10"
|
79 |
+
progress(0.2, desc="Executing models")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
subprocess.run([
|
81 |
"python", "new_test_saved_finetuned_model.py",
|
82 |
"-workspace_name", "ratio_proportion_change3_2223/sch_largest_100-coded",
|
83 |
+
"-finetune_task", "highGRschool10",
|
84 |
"-test_dataset_path","../../../../selected_rows.txt",
|
85 |
# "-test_label_path","../../../../train_label.txt",
|
86 |
"-finetuned_bert_classifier_checkpoint",
|
|
|
98 |
result[key]=value
|
99 |
else:
|
100 |
result[key]=float(value)
|
|
|
|
|
101 |
# Create a plot
|
102 |
with open("roc_data.pkl", "rb") as f:
|
103 |
fpr, tpr, _ = pickle.load(f)
|
104 |
+
|
105 |
roc_auc = auc(fpr, tpr)
|
106 |
fig, ax = plt.subplots()
|
107 |
ax.plot(fpr, tpr, color='blue', lw=2, label=f'ROC curve (area = {roc_auc:.2f})')
|
108 |
ax.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
|
109 |
+
ax.set(xlabel='False Positive Rate', ylabel='True Positive Rate', title=f'ROC Curve: {model_name}')
|
110 |
ax.legend(loc="lower right")
|
111 |
ax.grid()
|
112 |
|
|
|
114 |
plot_path = "plot.png"
|
115 |
fig.savefig(plot_path)
|
116 |
plt.close(fig)
|
|
|
|
|
|
|
|
|
117 |
progress(1.0)
|
118 |
# Prepare text output
|
119 |
text_output = f"Model: {model_name}\nResult:\n{result}"
|
120 |
# Prepare text output with HTML formatting
|
121 |
text_output = f"""
|
122 |
Model: {model_name}\n
|
123 |
+
Result Summary:\n
|
124 |
-----------------\n
|
125 |
+
Precision: {result['precisions']:.2f}\n
|
126 |
+
Recall: {result['recalls']:.2f}\n
|
127 |
Time Taken: {result['time_taken_from_start']:.2f} seconds\n
|
128 |
Total Schools in test: {len(unique_schools):.4f}\n
|
129 |
+
Total Schools taken: {len(random_schools):.4f}\n
|
130 |
+
High grad schools: {len(high_sample):.4f}\n
|
131 |
+
Low grad schools: {len(low_sample):.4f}\n
|
|
|
|
|
132 |
-----------------\n
|
133 |
+
Note: The ROC Curve is also displayed for the evaluation.
|
134 |
"""
|
135 |
+
return text_output,plot_path
|
136 |
|
137 |
# List of models for the dropdown menu
|
138 |
|
139 |
+
models = ["High Graduated Schools", "Low Graduated Schools", "Full Set"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
# Create the Gradio interface
|
142 |
with gr.Blocks(css="""
|
143 |
body {
|
|
|
145 |
font-family: 'Arial', sans-serif;
|
146 |
color: #f5f5f5!important;;
|
147 |
}
|
|
|
148 |
.gradio-container {
|
149 |
max-width: 850px!important;
|
150 |
margin: 0 auto!important;;
|
|
|
316 |
color: white;
|
317 |
background: #aca7b2;
|
318 |
}
|
|
|
319 |
.gradio-container-4-31-4 .prose h1, .gradio-container-4-31-4 .prose h2, .gradio-container-4-31-4 .prose h3, .gradio-container-4-31-4 .prose h4, .gradio-container-4-31-4 .prose h5 {
|
320 |
|
321 |
color: white;
|
|
|
322 |
""") as demo:
|
|
|
323 |
gr.Markdown("<h1 id='title'>ASTRA</h1>", elem_id="title")
|
324 |
+
gr.Markdown("<p class='description'>Upload a .txt file and select a model from the dropdown menu.</p>")
|
325 |
|
326 |
with gr.Row():
|
327 |
+
file_input = gr.File(label="Upload a test file", file_types=['.txt'], elem_classes="file-box")
|
328 |
+
label_input = gr.File(label="Upload test labels", file_types=['.txt'], elem_classes="file-box")
|
329 |
|
330 |
+
info_input = gr.File(label="Upload test info", file_types=['.txt'], elem_classes="file-box")
|
331 |
|
332 |
+
model_dropdown = gr.Dropdown(choices=models, label="Select Finetune Task", elem_classes="dropdown-menu")
|
333 |
|
334 |
|
335 |
increment_slider = gr.Slider(minimum=1, maximum=100, step=1, label="Schools Percentage", value=1)
|
336 |
+
|
337 |
with gr.Row():
|
338 |
+
output_text = gr.Textbox(label="Output Text")
|
339 |
+
output_image = gr.Image(label="Output Plot")
|
|
|
340 |
|
341 |
btn = gr.Button("Submit")
|
342 |
|
343 |
+
btn.click(fn=process_file, inputs=[file_input,label_input,info_input,model_dropdown,increment_slider], outputs=[output_text,output_image])
|
344 |
|
345 |
|
346 |
# Launch the app
|
distinguish_high_low_label.ipynb
DELETED
@@ -1,451 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 3,
|
6 |
-
"id": "960bac80-51c7-4e9f-ad2d-84cd6c710f98",
|
7 |
-
"metadata": {},
|
8 |
-
"outputs": [],
|
9 |
-
"source": [
|
10 |
-
"import pickle\n",
|
11 |
-
"import pandas as pd"
|
12 |
-
]
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"cell_type": "code",
|
16 |
-
"execution_count": 4,
|
17 |
-
"id": "a34f21d0-0854-4a54-8f93-67718b2f969e",
|
18 |
-
"metadata": {},
|
19 |
-
"outputs": [],
|
20 |
-
"source": [
|
21 |
-
"file_path = \"roc_data2.pkl\"\n",
|
22 |
-
"\n",
|
23 |
-
"# Open and load the pickle file\n",
|
24 |
-
"with open(file_path, 'rb') as file:\n",
|
25 |
-
" data = pickle.load(file)\n",
|
26 |
-
"\n",
|
27 |
-
"\n",
|
28 |
-
"# Print or use the data\n",
|
29 |
-
"# data[2]"
|
30 |
-
]
|
31 |
-
},
|
32 |
-
{
|
33 |
-
"cell_type": "code",
|
34 |
-
"execution_count": 5,
|
35 |
-
"id": "f9febed4-ce50-4e30-96ea-4b538ce2f9a1",
|
36 |
-
"metadata": {},
|
37 |
-
"outputs": [],
|
38 |
-
"source": [
|
39 |
-
"inc_slider=1\n",
|
40 |
-
"parent_location=\"ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/\"\n",
|
41 |
-
"test_info_location=parent_location+\"fullTest/test_info.txt\"\n",
|
42 |
-
"test_location=parent_location+\"fullTest/test.txt\"\n",
|
43 |
-
"test_info = pd.read_csv(test_info_location, sep=',', header=None, engine='python')\n",
|
44 |
-
"grad_rate_data = pd.DataFrame(pd.read_pickle('school_grduation_rate.pkl'),columns=['school_number','grad_rate']) # Load the grad_rate data\n",
|
45 |
-
"\n",
|
46 |
-
"# Step 1: Extract unique school numbers from test_info\n",
|
47 |
-
"unique_schools = test_info[0].unique()\n",
|
48 |
-
"\n",
|
49 |
-
"# Step 2: Filter the grad_rate_data using the unique school numbers\n",
|
50 |
-
"schools = grad_rate_data[grad_rate_data['school_number'].isin(unique_schools)]\n",
|
51 |
-
"\n",
|
52 |
-
"# Define a threshold for high and low graduation rates (adjust as needed)\n",
|
53 |
-
"grad_rate_threshold = 0.9 \n",
|
54 |
-
"\n",
|
55 |
-
"# Step 4: Divide schools into high and low graduation rate groups\n",
|
56 |
-
"high_grad_schools = schools[schools['grad_rate'] >= grad_rate_threshold]['school_number'].unique()\n",
|
57 |
-
"low_grad_schools = schools[schools['grad_rate'] < grad_rate_threshold]['school_number'].unique()\n",
|
58 |
-
"\n",
|
59 |
-
"# Step 5: Sample percentage of schools from each group\n",
|
60 |
-
"high_sample = pd.Series(high_grad_schools).sample(frac=inc_slider/100, random_state=1).tolist()\n",
|
61 |
-
"low_sample = pd.Series(low_grad_schools).sample(frac=inc_slider/100, random_state=1).tolist()\n",
|
62 |
-
"\n",
|
63 |
-
"# Step 6: Combine the sampled schools\n",
|
64 |
-
"random_schools = high_sample + low_sample\n",
|
65 |
-
"\n",
|
66 |
-
"# Step 7: Get indices for the sampled schools\n",
|
67 |
-
"indices = test_info[test_info[0].isin(random_schools)].index.tolist()\n",
|
68 |
-
"\n"
|
69 |
-
]
|
70 |
-
},
|
71 |
-
{
|
72 |
-
"cell_type": "code",
|
73 |
-
"execution_count": 6,
|
74 |
-
"id": "fdfdf4b6-2752-4a21-9880-869af69f20cf",
|
75 |
-
"metadata": {},
|
76 |
-
"outputs": [],
|
77 |
-
"source": [
|
78 |
-
"high_indices = test_info[(test_info[0].isin(high_sample))].index.tolist()\n",
|
79 |
-
"low_indices = test_info[(test_info[0].isin(low_sample))].index.tolist()"
|
80 |
-
]
|
81 |
-
},
|
82 |
-
{
|
83 |
-
"cell_type": "code",
|
84 |
-
"execution_count": 7,
|
85 |
-
"id": "a79a4598-5702-4cc8-9f07-8e18fdda648b",
|
86 |
-
"metadata": {},
|
87 |
-
"outputs": [
|
88 |
-
{
|
89 |
-
"data": {
|
90 |
-
"text/plain": [
|
91 |
-
"997"
|
92 |
-
]
|
93 |
-
},
|
94 |
-
"execution_count": 7,
|
95 |
-
"metadata": {},
|
96 |
-
"output_type": "execute_result"
|
97 |
-
}
|
98 |
-
],
|
99 |
-
"source": [
|
100 |
-
"len(high_indices)+len(low_indices)\n"
|
101 |
-
]
|
102 |
-
},
|
103 |
-
{
|
104 |
-
"cell_type": "code",
|
105 |
-
"execution_count": 8,
|
106 |
-
"id": "4707f3e6-2f44-46d8-ad8c-b6c244f693af",
|
107 |
-
"metadata": {},
|
108 |
-
"outputs": [
|
109 |
-
{
|
110 |
-
"data": {
|
111 |
-
"text/html": [
|
112 |
-
"<div>\n",
|
113 |
-
"<style scoped>\n",
|
114 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
115 |
-
" vertical-align: middle;\n",
|
116 |
-
" }\n",
|
117 |
-
"\n",
|
118 |
-
" .dataframe tbody tr th {\n",
|
119 |
-
" vertical-align: top;\n",
|
120 |
-
" }\n",
|
121 |
-
"\n",
|
122 |
-
" .dataframe thead th {\n",
|
123 |
-
" text-align: right;\n",
|
124 |
-
" }\n",
|
125 |
-
"</style>\n",
|
126 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
127 |
-
" <thead>\n",
|
128 |
-
" <tr style=\"text-align: right;\">\n",
|
129 |
-
" <th></th>\n",
|
130 |
-
" <th>0</th>\n",
|
131 |
-
" </tr>\n",
|
132 |
-
" </thead>\n",
|
133 |
-
" <tbody>\n",
|
134 |
-
" <tr>\n",
|
135 |
-
" <th>5342</th>\n",
|
136 |
-
" <td>PercentChange-0\\tNumeratorQuantity1-0\\tNumerat...</td>\n",
|
137 |
-
" </tr>\n",
|
138 |
-
" <tr>\n",
|
139 |
-
" <th>5343</th>\n",
|
140 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
141 |
-
" </tr>\n",
|
142 |
-
" <tr>\n",
|
143 |
-
" <th>5344</th>\n",
|
144 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
145 |
-
" </tr>\n",
|
146 |
-
" <tr>\n",
|
147 |
-
" <th>5345</th>\n",
|
148 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...</td>\n",
|
149 |
-
" </tr>\n",
|
150 |
-
" <tr>\n",
|
151 |
-
" <th>5346</th>\n",
|
152 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tDenomin...</td>\n",
|
153 |
-
" </tr>\n",
|
154 |
-
" <tr>\n",
|
155 |
-
" <th>...</th>\n",
|
156 |
-
" <td>...</td>\n",
|
157 |
-
" </tr>\n",
|
158 |
-
" <tr>\n",
|
159 |
-
" <th>113359</th>\n",
|
160 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...</td>\n",
|
161 |
-
" </tr>\n",
|
162 |
-
" <tr>\n",
|
163 |
-
" <th>113360</th>\n",
|
164 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
165 |
-
" </tr>\n",
|
166 |
-
" <tr>\n",
|
167 |
-
" <th>113361</th>\n",
|
168 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
169 |
-
" </tr>\n",
|
170 |
-
" <tr>\n",
|
171 |
-
" <th>113362</th>\n",
|
172 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
173 |
-
" </tr>\n",
|
174 |
-
" <tr>\n",
|
175 |
-
" <th>113363</th>\n",
|
176 |
-
" <td>PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...</td>\n",
|
177 |
-
" </tr>\n",
|
178 |
-
" </tbody>\n",
|
179 |
-
"</table>\n",
|
180 |
-
"<p>997 rows × 1 columns</p>\n",
|
181 |
-
"</div>"
|
182 |
-
],
|
183 |
-
"text/plain": [
|
184 |
-
" 0\n",
|
185 |
-
"5342 PercentChange-0\\tNumeratorQuantity1-0\\tNumerat...\n",
|
186 |
-
"5343 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
187 |
-
"5344 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
188 |
-
"5345 PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...\n",
|
189 |
-
"5346 PercentChange-0\\tNumeratorQuantity2-0\\tDenomin...\n",
|
190 |
-
"... ...\n",
|
191 |
-
"113359 PercentChange-0\\tNumeratorQuantity2-2\\tNumerat...\n",
|
192 |
-
"113360 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
193 |
-
"113361 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
194 |
-
"113362 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
195 |
-
"113363 PercentChange-0\\tNumeratorQuantity2-0\\tNumerat...\n",
|
196 |
-
"\n",
|
197 |
-
"[997 rows x 1 columns]"
|
198 |
-
]
|
199 |
-
},
|
200 |
-
"execution_count": 8,
|
201 |
-
"metadata": {},
|
202 |
-
"output_type": "execute_result"
|
203 |
-
}
|
204 |
-
],
|
205 |
-
"source": [
|
206 |
-
"# Load the test file and select rows based on indices\n",
|
207 |
-
"test = pd.read_csv(test_location, sep=',', header=None, engine='python')\n",
|
208 |
-
"selected_rows_df2 = test.loc[indices]\n",
|
209 |
-
"selected_rows_df2"
|
210 |
-
]
|
211 |
-
},
|
212 |
-
{
|
213 |
-
"cell_type": "code",
|
214 |
-
"execution_count": 11,
|
215 |
-
"id": "1d0c3d49-061f-486b-9c19-cf20945f3207",
|
216 |
-
"metadata": {},
|
217 |
-
"outputs": [],
|
218 |
-
"source": [
|
219 |
-
"graduation_groups = [\n",
|
220 |
-
" 'high' if idx in high_indices else 'low' for idx in selected_rows_df2.index\n",
|
221 |
-
"]\n",
|
222 |
-
"# graduation_groups"
|
223 |
-
]
|
224 |
-
},
|
225 |
-
{
|
226 |
-
"cell_type": "code",
|
227 |
-
"execution_count": 43,
|
228 |
-
"id": "ad0ce4a1-27fa-4867-8061-4054dbb340df",
|
229 |
-
"metadata": {},
|
230 |
-
"outputs": [],
|
231 |
-
"source": [
|
232 |
-
"t_label=data[0]\n",
|
233 |
-
"p_label=data[1]"
|
234 |
-
]
|
235 |
-
},
|
236 |
-
{
|
237 |
-
"cell_type": "code",
|
238 |
-
"execution_count": 47,
|
239 |
-
"id": "a4f4a2b9-3134-42ac-871b-4e117098cd0e",
|
240 |
-
"metadata": {},
|
241 |
-
"outputs": [],
|
242 |
-
"source": [
|
243 |
-
"# Step 1: Align graduation_group, t_label, and p_label\n",
|
244 |
-
"aligned_labels = list(zip(graduation_groups, t_label, p_label))\n",
|
245 |
-
"\n",
|
246 |
-
"# Step 2: Separate the labels for high and low groups\n",
|
247 |
-
"high_t_labels = [t for grad, t, p in aligned_labels if grad == 'high']\n",
|
248 |
-
"low_t_labels = [t for grad, t, p in aligned_labels if grad == 'low']\n",
|
249 |
-
"\n",
|
250 |
-
"high_p_labels = [p for grad, t, p in aligned_labels if grad == 'high']\n",
|
251 |
-
"low_p_labels = [p for grad, t, p in aligned_labels if grad == 'low']\n",
|
252 |
-
"\n"
|
253 |
-
]
|
254 |
-
},
|
255 |
-
{
|
256 |
-
"cell_type": "code",
|
257 |
-
"execution_count": 50,
|
258 |
-
"id": "c8e34660-83d0-46a1-a218-95d609e11729",
|
259 |
-
"metadata": {},
|
260 |
-
"outputs": [
|
261 |
-
{
|
262 |
-
"data": {
|
263 |
-
"text/plain": [
|
264 |
-
"997"
|
265 |
-
]
|
266 |
-
},
|
267 |
-
"execution_count": 50,
|
268 |
-
"metadata": {},
|
269 |
-
"output_type": "execute_result"
|
270 |
-
}
|
271 |
-
],
|
272 |
-
"source": [
|
273 |
-
"len(low_t_labels)+len(high_t_labels)"
|
274 |
-
]
|
275 |
-
},
|
276 |
-
{
|
277 |
-
"cell_type": "code",
|
278 |
-
"execution_count": 51,
|
279 |
-
"id": "c11050db-2636-4c50-9cd4-b9943e5cee83",
|
280 |
-
"metadata": {},
|
281 |
-
"outputs": [],
|
282 |
-
"source": [
|
283 |
-
"from sklearn.metrics import precision_score, recall_score, f1_score, confusion_matrix, roc_curve, roc_auc_score"
|
284 |
-
]
|
285 |
-
},
|
286 |
-
{
|
287 |
-
"cell_type": "code",
|
288 |
-
"execution_count": 52,
|
289 |
-
"id": "e1309e93-7063-4f48-bbc7-11a0d449c34e",
|
290 |
-
"metadata": {},
|
291 |
-
"outputs": [
|
292 |
-
{
|
293 |
-
"name": "stdout",
|
294 |
-
"output_type": "stream",
|
295 |
-
"text": [
|
296 |
-
"ROC-AUC Score for High Graduation Rate Group: 0.675\n",
|
297 |
-
"ROC-AUC Score for Low Graduation Rate Group: 0.7489795918367347\n"
|
298 |
-
]
|
299 |
-
}
|
300 |
-
],
|
301 |
-
"source": [
|
302 |
-
"high_roc_auc = roc_auc_score(high_t_labels, high_p_labels) if len(set(high_t_labels)) > 1 else None\n",
|
303 |
-
"low_roc_auc = roc_auc_score(low_t_labels, low_p_labels) if len(set(low_t_labels)) > 1 else None\n",
|
304 |
-
"\n",
|
305 |
-
"print(\"ROC-AUC Score for High Graduation Rate Group:\", high_roc_auc)\n",
|
306 |
-
"print(\"ROC-AUC Score for Low Graduation Rate Group:\", low_roc_auc)"
|
307 |
-
]
|
308 |
-
},
|
309 |
-
{
|
310 |
-
"cell_type": "code",
|
311 |
-
"execution_count": 9,
|
312 |
-
"id": "a99e7812-817d-4f9f-b6fa-1a58aa3a34dc",
|
313 |
-
"metadata": {},
|
314 |
-
"outputs": [
|
315 |
-
{
|
316 |
-
"name": "stdout",
|
317 |
-
"output_type": "stream",
|
318 |
-
"text": [
|
319 |
-
"Task Analysis Summary:\n",
|
320 |
-
"-----------------------\n",
|
321 |
-
"Ideal Task = OptionalTask_1:\n",
|
322 |
-
" Only OptionalTask_1 done: 22501\n",
|
323 |
-
" Only OptionalTask_2 done: 20014\n",
|
324 |
-
" Both done: 24854\n",
|
325 |
-
"Ideal Task = OptionalTask_2:\n",
|
326 |
-
" Only OptionalTask_1 done: 12588\n",
|
327 |
-
" Only OptionalTask_2 done: 18942\n",
|
328 |
-
" Both done: 15147\n",
|
329 |
-
"\n"
|
330 |
-
]
|
331 |
-
}
|
332 |
-
],
|
333 |
-
"source": [
|
334 |
-
"def analyze_row(row):\n",
|
335 |
-
" # Split the row into fields\n",
|
336 |
-
" fields = row.split(\"\\t\")\n",
|
337 |
-
"\n",
|
338 |
-
" # Define tasks for OptionalTask_1, OptionalTask_2, and FinalAnswer\n",
|
339 |
-
" optional_task_1_subtasks = [\"DenominatorFactor\", \"NumeratorFactor\", \"EquationAnswer\"]\n",
|
340 |
-
" optional_task_2_subtasks = [\n",
|
341 |
-
" \"FirstRow2:1\", \"FirstRow2:2\", \"FirstRow1:1\", \"FirstRow1:2\", \n",
|
342 |
-
" \"SecondRow\", \"ThirdRow\"\n",
|
343 |
-
" ]\n",
|
344 |
-
"\n",
|
345 |
-
" # Helper function to evaluate task attempts\n",
|
346 |
-
" def evaluate_tasks(fields, tasks):\n",
|
347 |
-
" task_status = {}\n",
|
348 |
-
" for task in tasks:\n",
|
349 |
-
" relevant_attempts = [f for f in fields if task in f]\n",
|
350 |
-
" if any(\"OK\" in attempt for attempt in relevant_attempts):\n",
|
351 |
-
" task_status[task] = \"Attempted (Successful)\"\n",
|
352 |
-
" elif any(\"ERROR\" in attempt for attempt in relevant_attempts):\n",
|
353 |
-
" task_status[task] = \"Attempted (Error)\"\n",
|
354 |
-
" elif any(\"JIT\" in attempt for attempt in relevant_attempts):\n",
|
355 |
-
" task_status[task] = \"Attempted (JIT)\"\n",
|
356 |
-
" else:\n",
|
357 |
-
" task_status[task] = \"Unattempted\"\n",
|
358 |
-
" return task_status\n",
|
359 |
-
"\n",
|
360 |
-
" # Evaluate tasks for each category\n",
|
361 |
-
" optional_task_1_status = evaluate_tasks(fields, optional_task_1_subtasks)\n",
|
362 |
-
" optional_task_2_status = evaluate_tasks(fields, optional_task_2_subtasks)\n",
|
363 |
-
"\n",
|
364 |
-
" # Check if tasks have any successful attempt\n",
|
365 |
-
" opt1_done = any(status == \"Attempted (Successful)\" for status in optional_task_1_status.values())\n",
|
366 |
-
" opt2_done = any(status == \"Attempted (Successful)\" for status in optional_task_2_status.values())\n",
|
367 |
-
"\n",
|
368 |
-
" return opt1_done, opt2_done\n",
|
369 |
-
"\n",
|
370 |
-
"# Read data from test_info.txt\n",
|
371 |
-
"# Read data from test_info.txt\n",
|
372 |
-
"with open(test_info_location, \"r\") as file:\n",
|
373 |
-
" data = file.readlines()\n",
|
374 |
-
"\n",
|
375 |
-
"# Assuming test_info[7] is a list with ideal tasks for each instance\n",
|
376 |
-
"ideal_tasks = test_info[6] # A list where each element is either 1 or 2\n",
|
377 |
-
"\n",
|
378 |
-
"# Initialize counters\n",
|
379 |
-
"task_counts = {\n",
|
380 |
-
" 1: {\"only_opt1\": 0, \"only_opt2\": 0, \"both\": 0},\n",
|
381 |
-
" 2: {\"only_opt1\": 0, \"only_opt2\": 0, \"both\": 0}\n",
|
382 |
-
"}\n",
|
383 |
-
"\n",
|
384 |
-
"# Analyze rows\n",
|
385 |
-
"for i, row in enumerate(data):\n",
|
386 |
-
" row = row.strip()\n",
|
387 |
-
" if not row:\n",
|
388 |
-
" continue\n",
|
389 |
-
"\n",
|
390 |
-
" ideal_task = ideal_tasks[i] # Get the ideal task for the current row\n",
|
391 |
-
" opt1_done, opt2_done = analyze_row(row)\n",
|
392 |
-
"\n",
|
393 |
-
" if ideal_task == 0:\n",
|
394 |
-
" if opt1_done and not opt2_done:\n",
|
395 |
-
" task_counts[1][\"only_opt1\"] += 1\n",
|
396 |
-
" elif not opt1_done and opt2_done:\n",
|
397 |
-
" task_counts[1][\"only_opt2\"] += 1\n",
|
398 |
-
" elif opt1_done and opt2_done:\n",
|
399 |
-
" task_counts[1][\"both\"] += 1\n",
|
400 |
-
" elif ideal_task == 1:\n",
|
401 |
-
" if opt1_done and not opt2_done:\n",
|
402 |
-
" task_counts[2][\"only_opt1\"] += 1\n",
|
403 |
-
" elif not opt1_done and opt2_done:\n",
|
404 |
-
" task_counts[2][\"only_opt2\"] += 1\n",
|
405 |
-
" elif opt1_done and opt2_done:\n",
|
406 |
-
" task_counts[2][\"both\"] += 1\n",
|
407 |
-
"\n",
|
408 |
-
"# Create a string output for results\n",
|
409 |
-
"output_summary = \"Task Analysis Summary:\\n\"\n",
|
410 |
-
"output_summary += \"-----------------------\\n\"\n",
|
411 |
-
"\n",
|
412 |
-
"for ideal_task, counts in task_counts.items():\n",
|
413 |
-
" output_summary += f\"Ideal Task = OptionalTask_{ideal_task}:\\n\"\n",
|
414 |
-
" output_summary += f\" Only OptionalTask_1 done: {counts['only_opt1']}\\n\"\n",
|
415 |
-
" output_summary += f\" Only OptionalTask_2 done: {counts['only_opt2']}\\n\"\n",
|
416 |
-
" output_summary += f\" Both done: {counts['both']}\\n\"\n",
|
417 |
-
"\n",
|
418 |
-
"print(output_summary)\n"
|
419 |
-
]
|
420 |
-
},
|
421 |
-
{
|
422 |
-
"cell_type": "code",
|
423 |
-
"execution_count": null,
|
424 |
-
"id": "65ad9383-741f-44eb-8e8f-853ee7bc52a2",
|
425 |
-
"metadata": {},
|
426 |
-
"outputs": [],
|
427 |
-
"source": []
|
428 |
-
}
|
429 |
-
],
|
430 |
-
"metadata": {
|
431 |
-
"kernelspec": {
|
432 |
-
"display_name": "Python 3 (ipykernel)",
|
433 |
-
"language": "python",
|
434 |
-
"name": "python3"
|
435 |
-
},
|
436 |
-
"language_info": {
|
437 |
-
"codemirror_mode": {
|
438 |
-
"name": "ipython",
|
439 |
-
"version": 3
|
440 |
-
},
|
441 |
-
"file_extension": ".py",
|
442 |
-
"mimetype": "text/x-python",
|
443 |
-
"name": "python",
|
444 |
-
"nbconvert_exporter": "python",
|
445 |
-
"pygments_lexer": "ipython3",
|
446 |
-
"version": "3.12.4"
|
447 |
-
}
|
448 |
-
},
|
449 |
-
"nbformat": 4,
|
450 |
-
"nbformat_minor": 5
|
451 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fullTest/test.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:2a479561b801a43249b6a8aceed5f32d16cec3d2f40956ed02640b6dcab0bdfe
|
3 |
-
size 21353853
|
|
|
|
|
|
|
|
fullTest/test_info.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:dbb182b48eecce59c4e61f82a23d8af2866d9327f0543aca3546880fdb0d6003
|
3 |
-
size 166442240
|
|
|
|
|
|
|
|
fullTest/test_label.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
new_test_saved_finetuned_model.py
CHANGED
@@ -221,12 +221,9 @@ class BERTFineTuneTrainer:
|
|
221 |
for key, value in final_msg.items():
|
222 |
file.write(f"{key}: {value}\n")
|
223 |
print(final_msg)
|
224 |
-
# print(type(plabels),type(tlabels),plabels,tlabels)
|
225 |
fpr, tpr, thresholds = roc_curve(tlabels, positive_class_probs)
|
226 |
with open("roc_data.pkl", "wb") as f:
|
227 |
pickle.dump((fpr, tpr, thresholds), f)
|
228 |
-
with open("roc_data2.pkl", "wb") as f:
|
229 |
-
pickle.dump((tlabels,positive_class_probs), f)
|
230 |
print(final_msg)
|
231 |
f.close()
|
232 |
with open(self.log_folder_path+f"/log_{phase}_finetuned_info.txt", 'a') as f1:
|
@@ -429,7 +426,6 @@ class BERTFineTuneCalibratedTrainer:
|
|
429 |
auc_score = roc_auc_score(tlabels, positive_class_probs)
|
430 |
end_time = time.time()
|
431 |
final_msg = {
|
432 |
-
"this one":"this one",
|
433 |
"avg_loss": avg_loss / len(data_iter),
|
434 |
"total_acc": total_correct * 100.0 / total_element,
|
435 |
"precisions": precisions,
|
@@ -444,8 +440,7 @@ class BERTFineTuneCalibratedTrainer:
|
|
444 |
with open("result.txt", 'w') as file:
|
445 |
for key, value in final_msg.items():
|
446 |
file.write(f"{key}: {value}\n")
|
447 |
-
|
448 |
-
file.write(plabels)
|
449 |
print(final_msg)
|
450 |
fpr, tpr, thresholds = roc_curve(tlabels, positive_class_probs)
|
451 |
f.close()
|
|
|
221 |
for key, value in final_msg.items():
|
222 |
file.write(f"{key}: {value}\n")
|
223 |
print(final_msg)
|
|
|
224 |
fpr, tpr, thresholds = roc_curve(tlabels, positive_class_probs)
|
225 |
with open("roc_data.pkl", "wb") as f:
|
226 |
pickle.dump((fpr, tpr, thresholds), f)
|
|
|
|
|
227 |
print(final_msg)
|
228 |
f.close()
|
229 |
with open(self.log_folder_path+f"/log_{phase}_finetuned_info.txt", 'a') as f1:
|
|
|
426 |
auc_score = roc_auc_score(tlabels, positive_class_probs)
|
427 |
end_time = time.time()
|
428 |
final_msg = {
|
|
|
429 |
"avg_loss": avg_loss / len(data_iter),
|
430 |
"total_acc": total_correct * 100.0 / total_element,
|
431 |
"precisions": precisions,
|
|
|
440 |
with open("result.txt", 'w') as file:
|
441 |
for key, value in final_msg.items():
|
442 |
file.write(f"{key}: {value}\n")
|
443 |
+
|
|
|
444 |
print(final_msg)
|
445 |
fpr, tpr, thresholds = roc_curve(tlabels, positive_class_probs)
|
446 |
f.close()
|
plot.png
CHANGED
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:20a028aa7529f6c68f16ba09e038ef969ca61aa22ee1e41f5e0474883aabbddc
|
3 |
-
size 24775790
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test_info.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:f29c4c3585b70ef5a1fc0c107d9d96c63b7adae0659789b90f5bfab97df57026
|
3 |
-
size 123225375
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/highGRschool10_/test_label.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:35569d6f81ef85e6353f36912c1cb79bfb723fe7d2476e10afcb745c170c5130
|
3 |
-
size 24672844
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_BKT.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:dec171098a0b444d3b8a3de8497345e8806440038756ce51a575314e6c414647
|
3 |
-
size 20086086
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_info.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a6aadba0002bfdfde835b8837b3ff36cd84c64c3e23b6589ec1d002b4b62c2f4
|
3 |
-
size 122629427
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/fullTest/test_label.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/highGRschool10/test_label.txt
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e738c87fcbcc3e0362199ea2b7f9ef06093fb3f9e7a5f8c5ab828602e52230f9
|
3 |
-
size 16005023
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test_info.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:ef4862f5c282efdfa49e13ed0f6cb344abcb7ae07fdfba535d48193bb8a3c1ed
|
3 |
-
size 81939614
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/lowGRschoolAll/test_label.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:2a479561b801a43249b6a8aceed5f32d16cec3d2f40956ed02640b6dcab0bdfe
|
3 |
-
size 21353853
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test_info.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:dbb182b48eecce59c4e61f82a23d8af2866d9327f0543aca3546880fdb0d6003
|
3 |
-
size 166442240
|
|
|
|
|
|
|
|
ratio_proportion_change3_2223/sch_largest_100-coded/finetuning/test_label.txt
DELETED
The diff for this file is too large to render.
See raw diff
|
|
result.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
avg_loss: 0.
|
2 |
-
total_acc: 69.
|
3 |
-
precisions: 0.
|
4 |
-
recalls: 0.
|
5 |
-
f1_scores: 0.
|
6 |
-
time_taken_from_start:
|
7 |
-
auc_score: 0.
|
|
|
1 |
+
avg_loss: 0.5730699896812439
|
2 |
+
total_acc: 69.52861952861953
|
3 |
+
precisions: 0.7336375047795977
|
4 |
+
recalls: 0.6952861952861953
|
5 |
+
f1_scores: 0.6858177547541179
|
6 |
+
time_taken_from_start: 28.49159860610962
|
7 |
+
auc_score: 0.7738852057033876
|
roc_data.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4c4af99c21a2122f6f4c4773439bbb77976243559acf78cd9b771f24d3ae9bdc
|
3 |
+
size 5930
|
roc_data2.pkl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:41fa9d96833c12979f8495141ee61c0ba07d4a20c5fb5bc18a7f72bf4d15e8fd
|
3 |
-
size 28023
|
|
|
|
|
|
|
|
selected_rows.txt
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
test.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
train.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
train_info.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:ef4862f5c282efdfa49e13ed0f6cb344abcb7ae07fdfba535d48193bb8a3c1ed
|
3 |
-
size 81939614
|
|
|
|
|
|
|
|
train_label.txt
CHANGED
The diff for this file is too large to render.
See raw diff
|
|