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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 26,
|
6 |
+
"id": "51d0f551",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [
|
9 |
+
{
|
10 |
+
"name": "stdout",
|
11 |
+
"output_type": "stream",
|
12 |
+
"text": [
|
13 |
+
"Requirement already satisfied: nltk in ./anaconda3/lib/python3.11/site-packages (3.8.1)\n",
|
14 |
+
"Requirement already satisfied: click in ./anaconda3/lib/python3.11/site-packages (from nltk) (8.0.4)\n",
|
15 |
+
"Requirement already satisfied: joblib in ./anaconda3/lib/python3.11/site-packages (from nltk) (1.2.0)\n",
|
16 |
+
"Requirement already satisfied: regex>=2021.8.3 in ./anaconda3/lib/python3.11/site-packages (from nltk) (2022.7.9)\n",
|
17 |
+
"Requirement already satisfied: tqdm in ./anaconda3/lib/python3.11/site-packages (from nltk) (4.65.0)\n",
|
18 |
+
"Requirement already satisfied: tensorflow in ./anaconda3/lib/python3.11/site-packages (2.17.0)\n",
|
19 |
+
"Requirement already satisfied: absl-py>=1.0.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (2.1.0)\n",
|
20 |
+
"Requirement already satisfied: astunparse>=1.6.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (1.6.3)\n",
|
21 |
+
"Requirement already satisfied: flatbuffers>=24.3.25 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (24.3.25)\n",
|
22 |
+
"Requirement already satisfied: gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (0.6.0)\n",
|
23 |
+
"Requirement already satisfied: google-pasta>=0.1.1 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (0.2.0)\n",
|
24 |
+
"Requirement already satisfied: h5py>=3.10.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (3.11.0)\n",
|
25 |
+
"Requirement already satisfied: libclang>=13.0.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (18.1.1)\n",
|
26 |
+
"Requirement already satisfied: ml-dtypes<0.5.0,>=0.3.1 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (0.4.0)\n",
|
27 |
+
"Requirement already satisfied: opt-einsum>=2.3.2 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (3.3.0)\n",
|
28 |
+
"Requirement already satisfied: packaging in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (23.1)\n",
|
29 |
+
"Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (4.25.4)\n",
|
30 |
+
"Requirement already satisfied: requests<3,>=2.21.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (2.31.0)\n",
|
31 |
+
"Requirement already satisfied: setuptools in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (68.0.0)\n",
|
32 |
+
"Requirement already satisfied: six>=1.12.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (1.16.0)\n",
|
33 |
+
"Requirement already satisfied: termcolor>=1.1.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (2.4.0)\n",
|
34 |
+
"Requirement already satisfied: typing-extensions>=3.6.6 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (4.9.0)\n",
|
35 |
+
"Requirement already satisfied: wrapt>=1.11.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (1.14.1)\n",
|
36 |
+
"Requirement already satisfied: grpcio<2.0,>=1.24.3 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (1.65.4)\n",
|
37 |
+
"Requirement already satisfied: tensorboard<2.18,>=2.17 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (2.17.0)\n",
|
38 |
+
"Requirement already satisfied: keras>=3.2.0 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (3.4.1)\n",
|
39 |
+
"Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.23.1 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (0.37.1)\n",
|
40 |
+
"Requirement already satisfied: numpy<2.0.0,>=1.23.5 in ./anaconda3/lib/python3.11/site-packages (from tensorflow) (1.24.3)\n",
|
41 |
+
"Requirement already satisfied: wheel<1.0,>=0.23.0 in ./anaconda3/lib/python3.11/site-packages (from astunparse>=1.6.0->tensorflow) (0.38.4)\n",
|
42 |
+
"Requirement already satisfied: rich in ./anaconda3/lib/python3.11/site-packages (from keras>=3.2.0->tensorflow) (13.7.1)\n",
|
43 |
+
"Requirement already satisfied: namex in ./anaconda3/lib/python3.11/site-packages (from keras>=3.2.0->tensorflow) (0.0.8)\n",
|
44 |
+
"Requirement already satisfied: optree in ./anaconda3/lib/python3.11/site-packages (from keras>=3.2.0->tensorflow) (0.12.1)\n",
|
45 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in ./anaconda3/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow) (2.0.4)\n",
|
46 |
+
"Requirement already satisfied: idna<4,>=2.5 in ./anaconda3/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow) (3.4)\n",
|
47 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in ./anaconda3/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow) (1.26.16)\n",
|
48 |
+
"Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.11/site-packages (from requests<3,>=2.21.0->tensorflow) (2023.7.22)\n",
|
49 |
+
"Requirement already satisfied: markdown>=2.6.8 in ./anaconda3/lib/python3.11/site-packages (from tensorboard<2.18,>=2.17->tensorflow) (3.4.1)\n",
|
50 |
+
"Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in ./anaconda3/lib/python3.11/site-packages (from tensorboard<2.18,>=2.17->tensorflow) (0.7.2)\n",
|
51 |
+
"Requirement already satisfied: werkzeug>=1.0.1 in ./anaconda3/lib/python3.11/site-packages (from tensorboard<2.18,>=2.17->tensorflow) (2.2.3)\n",
|
52 |
+
"Requirement already satisfied: MarkupSafe>=2.1.1 in ./anaconda3/lib/python3.11/site-packages (from werkzeug>=1.0.1->tensorboard<2.18,>=2.17->tensorflow) (2.1.1)\n",
|
53 |
+
"Requirement already satisfied: markdown-it-py>=2.2.0 in ./anaconda3/lib/python3.11/site-packages (from rich->keras>=3.2.0->tensorflow) (2.2.0)\n",
|
54 |
+
"Requirement already satisfied: pygments<3.0.0,>=2.13.0 in ./anaconda3/lib/python3.11/site-packages (from rich->keras>=3.2.0->tensorflow) (2.15.1)\n",
|
55 |
+
"Requirement already satisfied: mdurl~=0.1 in ./anaconda3/lib/python3.11/site-packages (from markdown-it-py>=2.2.0->rich->keras>=3.2.0->tensorflow) (0.1.0)\n"
|
56 |
+
]
|
57 |
+
}
|
58 |
+
],
|
59 |
+
"source": [
|
60 |
+
"!pip install nltk\n",
|
61 |
+
"!pip install tensorflow"
|
62 |
+
]
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"cell_type": "code",
|
66 |
+
"execution_count": 27,
|
67 |
+
"id": "16af452c",
|
68 |
+
"metadata": {},
|
69 |
+
"outputs": [
|
70 |
+
{
|
71 |
+
"name": "stderr",
|
72 |
+
"output_type": "stream",
|
73 |
+
"text": [
|
74 |
+
"[nltk_data] Downloading package punkt to\n",
|
75 |
+
"[nltk_data] /Users/preethamreddygollapalli/nltk_data...\n",
|
76 |
+
"[nltk_data] Package punkt is already up-to-date!\n"
|
77 |
+
]
|
78 |
+
},
|
79 |
+
{
|
80 |
+
"data": {
|
81 |
+
"text/plain": [
|
82 |
+
"True"
|
83 |
+
]
|
84 |
+
},
|
85 |
+
"execution_count": 27,
|
86 |
+
"metadata": {},
|
87 |
+
"output_type": "execute_result"
|
88 |
+
}
|
89 |
+
],
|
90 |
+
"source": [
|
91 |
+
"import pandas as pd\n",
|
92 |
+
"import numpy as np\n",
|
93 |
+
"import re\n",
|
94 |
+
"import string\n",
|
95 |
+
"import nltk\n",
|
96 |
+
"from nltk.tokenize import sent_tokenize # tries to convert paragraph to sentences\n",
|
97 |
+
"from nltk.tokenize import word_tokenize\n",
|
98 |
+
"from nltk.stem import WordNetLemmatizer\n",
|
99 |
+
"from nltk.corpus import stopwords\n",
|
100 |
+
"from gensim.models import Word2Vec\n",
|
101 |
+
"import ast\n",
|
102 |
+
"import tensorflow as tf\n",
|
103 |
+
"from sklearn.model_selection import train_test_split\n",
|
104 |
+
"from sklearn.preprocessing import LabelEncoder\n",
|
105 |
+
"from keras.preprocessing.sequence import pad_sequences\n",
|
106 |
+
"from tensorflow.keras.models import Sequential\n",
|
107 |
+
"from tensorflow.keras.layers import Dense, Dropout, LSTM, Embedding\n",
|
108 |
+
"from tensorflow.keras.metrics import MeanAbsoluteError\n",
|
109 |
+
"from sklearn.metrics import r2_score\n",
|
110 |
+
"\n",
|
111 |
+
"nltk.download('punkt')"
|
112 |
+
]
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"cell_type": "code",
|
116 |
+
"execution_count": 28,
|
117 |
+
"id": "4ada6af5",
|
118 |
+
"metadata": {},
|
119 |
+
"outputs": [
|
120 |
+
{
|
121 |
+
"data": {
|
122 |
+
"text/html": [
|
123 |
+
"<div>\n",
|
124 |
+
"<style scoped>\n",
|
125 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
126 |
+
" vertical-align: middle;\n",
|
127 |
+
" }\n",
|
128 |
+
"\n",
|
129 |
+
" .dataframe tbody tr th {\n",
|
130 |
+
" vertical-align: top;\n",
|
131 |
+
" }\n",
|
132 |
+
"\n",
|
133 |
+
" .dataframe thead th {\n",
|
134 |
+
" text-align: right;\n",
|
135 |
+
" }\n",
|
136 |
+
"</style>\n",
|
137 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
138 |
+
" <thead>\n",
|
139 |
+
" <tr style=\"text-align: right;\">\n",
|
140 |
+
" <th></th>\n",
|
141 |
+
" <th>Story Name</th>\n",
|
142 |
+
" <th>Test case Acceptance criteria</th>\n",
|
143 |
+
" <th>Test Steps</th>\n",
|
144 |
+
" <th>Test Data</th>\n",
|
145 |
+
" <th>Expected Result</th>\n",
|
146 |
+
" </tr>\n",
|
147 |
+
" </thead>\n",
|
148 |
+
" <tbody>\n",
|
149 |
+
" <tr>\n",
|
150 |
+
" <th>0</th>\n",
|
151 |
+
" <td>ACIP-247941</td>\n",
|
152 |
+
" <td>Weekly Ad - tap on any product offer - tap on ...</td>\n",
|
153 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
154 |
+
" <td>Email: [email protected], Albertsons= 8...</td>\n",
|
155 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
156 |
+
" </tr>\n",
|
157 |
+
" <tr>\n",
|
158 |
+
" <th>1</th>\n",
|
159 |
+
" <td>ACIP-95038</td>\n",
|
160 |
+
" <td>As a PdM, I want to ensure that the L2 entry p...</td>\n",
|
161 |
+
" <td>Login UMA app with valid email/ mobile no. Ver...</td>\n",
|
162 |
+
" <td>NaN</td>\n",
|
163 |
+
" <td>User should be able to login successfully and ...</td>\n",
|
164 |
+
" </tr>\n",
|
165 |
+
" <tr>\n",
|
166 |
+
" <th>2</th>\n",
|
167 |
+
" <td>US-41769</td>\n",
|
168 |
+
" <td>As a customer, I should see age restriction me...</td>\n",
|
169 |
+
" <td>Login UMA app with valid email/ mobile no. Ent...</td>\n",
|
170 |
+
" <td>NaN</td>\n",
|
171 |
+
" <td>Your order contains age-restricted items. Some...</td>\n",
|
172 |
+
" </tr>\n",
|
173 |
+
" <tr>\n",
|
174 |
+
" <th>3</th>\n",
|
175 |
+
" <td>ACIP-237923</td>\n",
|
176 |
+
" <td>Verify Banner navigation for the below banners...</td>\n",
|
177 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
178 |
+
" <td>Email: [email protected], Albertsons= 8...</td>\n",
|
179 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
180 |
+
" </tr>\n",
|
181 |
+
" <tr>\n",
|
182 |
+
" <th>4</th>\n",
|
183 |
+
" <td>ACIP-234885</td>\n",
|
184 |
+
" <td>Display the Meal Plans banner based on the ban...</td>\n",
|
185 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
186 |
+
" <td>Email: [email protected] / any new user...</td>\n",
|
187 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
188 |
+
" </tr>\n",
|
189 |
+
" </tbody>\n",
|
190 |
+
"</table>\n",
|
191 |
+
"</div>"
|
192 |
+
],
|
193 |
+
"text/plain": [
|
194 |
+
" Story Name Test case Acceptance criteria \\\n",
|
195 |
+
"0 ACIP-247941 Weekly Ad - tap on any product offer - tap on ... \n",
|
196 |
+
"1 ACIP-95038 As a PdM, I want to ensure that the L2 entry p... \n",
|
197 |
+
"2 US-41769 As a customer, I should see age restriction me... \n",
|
198 |
+
"3 ACIP-237923 Verify Banner navigation for the below banners... \n",
|
199 |
+
"4 ACIP-234885 Display the Meal Plans banner based on the ban... \n",
|
200 |
+
"\n",
|
201 |
+
" Test Steps \\\n",
|
202 |
+
"0 User logs into UMA application with valid user... \n",
|
203 |
+
"1 Login UMA app with valid email/ mobile no. Ver... \n",
|
204 |
+
"2 Login UMA app with valid email/ mobile no. Ent... \n",
|
205 |
+
"3 User logs into UMA application with valid user... \n",
|
206 |
+
"4 User logs into UMA application with valid user... \n",
|
207 |
+
"\n",
|
208 |
+
" Test Data \\\n",
|
209 |
+
"0 Email: [email protected], Albertsons= 8... \n",
|
210 |
+
"1 NaN \n",
|
211 |
+
"2 NaN \n",
|
212 |
+
"3 Email: [email protected], Albertsons= 8... \n",
|
213 |
+
"4 Email: [email protected] / any new user... \n",
|
214 |
+
"\n",
|
215 |
+
" Expected Result \n",
|
216 |
+
"0 User navigates to Home page on UMA application... \n",
|
217 |
+
"1 User should be able to login successfully and ... \n",
|
218 |
+
"2 Your order contains age-restricted items. Some... \n",
|
219 |
+
"3 User navigates to Home page on UMA application... \n",
|
220 |
+
"4 User navigates to Home page on UMA application... "
|
221 |
+
]
|
222 |
+
},
|
223 |
+
"execution_count": 28,
|
224 |
+
"metadata": {},
|
225 |
+
"output_type": "execute_result"
|
226 |
+
}
|
227 |
+
],
|
228 |
+
"source": [
|
229 |
+
"df = pd.read_csv(\"/Users/preethamreddygollapalli/Downloads/AI Test cases (2).csv\")\n",
|
230 |
+
"df.head(5)"
|
231 |
+
]
|
232 |
+
},
|
233 |
+
{
|
234 |
+
"cell_type": "code",
|
235 |
+
"execution_count": 29,
|
236 |
+
"id": "b74aecf9",
|
237 |
+
"metadata": {},
|
238 |
+
"outputs": [
|
239 |
+
{
|
240 |
+
"data": {
|
241 |
+
"text/plain": [
|
242 |
+
"Story Name object\n",
|
243 |
+
"Test case Acceptance criteria object\n",
|
244 |
+
"Test Steps object\n",
|
245 |
+
"Test Data object\n",
|
246 |
+
"Expected Result object\n",
|
247 |
+
"dtype: object"
|
248 |
+
]
|
249 |
+
},
|
250 |
+
"execution_count": 29,
|
251 |
+
"metadata": {},
|
252 |
+
"output_type": "execute_result"
|
253 |
+
}
|
254 |
+
],
|
255 |
+
"source": [
|
256 |
+
"df.dtypes"
|
257 |
+
]
|
258 |
+
},
|
259 |
+
{
|
260 |
+
"cell_type": "code",
|
261 |
+
"execution_count": 30,
|
262 |
+
"id": "1468adf1",
|
263 |
+
"metadata": {},
|
264 |
+
"outputs": [
|
265 |
+
{
|
266 |
+
"data": {
|
267 |
+
"text/plain": [
|
268 |
+
"(5, 5)"
|
269 |
+
]
|
270 |
+
},
|
271 |
+
"execution_count": 30,
|
272 |
+
"metadata": {},
|
273 |
+
"output_type": "execute_result"
|
274 |
+
}
|
275 |
+
],
|
276 |
+
"source": [
|
277 |
+
"df.shape"
|
278 |
+
]
|
279 |
+
},
|
280 |
+
{
|
281 |
+
"cell_type": "code",
|
282 |
+
"execution_count": 31,
|
283 |
+
"id": "bf818e79",
|
284 |
+
"metadata": {},
|
285 |
+
"outputs": [
|
286 |
+
{
|
287 |
+
"data": {
|
288 |
+
"text/html": [
|
289 |
+
"<div>\n",
|
290 |
+
"<style scoped>\n",
|
291 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
292 |
+
" vertical-align: middle;\n",
|
293 |
+
" }\n",
|
294 |
+
"\n",
|
295 |
+
" .dataframe tbody tr th {\n",
|
296 |
+
" vertical-align: top;\n",
|
297 |
+
" }\n",
|
298 |
+
"\n",
|
299 |
+
" .dataframe thead th {\n",
|
300 |
+
" text-align: right;\n",
|
301 |
+
" }\n",
|
302 |
+
"</style>\n",
|
303 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
304 |
+
" <thead>\n",
|
305 |
+
" <tr style=\"text-align: right;\">\n",
|
306 |
+
" <th></th>\n",
|
307 |
+
" <th>Story Name</th>\n",
|
308 |
+
" <th>Test case Acceptance criteria</th>\n",
|
309 |
+
" <th>Test Steps</th>\n",
|
310 |
+
" <th>Test Data</th>\n",
|
311 |
+
" <th>Expected Result</th>\n",
|
312 |
+
" </tr>\n",
|
313 |
+
" </thead>\n",
|
314 |
+
" <tbody>\n",
|
315 |
+
" <tr>\n",
|
316 |
+
" <th>count</th>\n",
|
317 |
+
" <td>5</td>\n",
|
318 |
+
" <td>5</td>\n",
|
319 |
+
" <td>5</td>\n",
|
320 |
+
" <td>3</td>\n",
|
321 |
+
" <td>5</td>\n",
|
322 |
+
" </tr>\n",
|
323 |
+
" <tr>\n",
|
324 |
+
" <th>unique</th>\n",
|
325 |
+
" <td>5</td>\n",
|
326 |
+
" <td>5</td>\n",
|
327 |
+
" <td>5</td>\n",
|
328 |
+
" <td>3</td>\n",
|
329 |
+
" <td>5</td>\n",
|
330 |
+
" </tr>\n",
|
331 |
+
" <tr>\n",
|
332 |
+
" <th>top</th>\n",
|
333 |
+
" <td>ACIP-247941</td>\n",
|
334 |
+
" <td>Weekly Ad - tap on any product offer - tap on ...</td>\n",
|
335 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
336 |
+
" <td>Email: [email protected], Albertsons= 8...</td>\n",
|
337 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
338 |
+
" </tr>\n",
|
339 |
+
" <tr>\n",
|
340 |
+
" <th>freq</th>\n",
|
341 |
+
" <td>1</td>\n",
|
342 |
+
" <td>1</td>\n",
|
343 |
+
" <td>1</td>\n",
|
344 |
+
" <td>1</td>\n",
|
345 |
+
" <td>1</td>\n",
|
346 |
+
" </tr>\n",
|
347 |
+
" </tbody>\n",
|
348 |
+
"</table>\n",
|
349 |
+
"</div>"
|
350 |
+
],
|
351 |
+
"text/plain": [
|
352 |
+
" Story Name Test case Acceptance criteria \\\n",
|
353 |
+
"count 5 5 \n",
|
354 |
+
"unique 5 5 \n",
|
355 |
+
"top ACIP-247941 Weekly Ad - tap on any product offer - tap on ... \n",
|
356 |
+
"freq 1 1 \n",
|
357 |
+
"\n",
|
358 |
+
" Test Steps \\\n",
|
359 |
+
"count 5 \n",
|
360 |
+
"unique 5 \n",
|
361 |
+
"top User logs into UMA application with valid user... \n",
|
362 |
+
"freq 1 \n",
|
363 |
+
"\n",
|
364 |
+
" Test Data \\\n",
|
365 |
+
"count 3 \n",
|
366 |
+
"unique 3 \n",
|
367 |
+
"top Email: [email protected], Albertsons= 8... \n",
|
368 |
+
"freq 1 \n",
|
369 |
+
"\n",
|
370 |
+
" Expected Result \n",
|
371 |
+
"count 5 \n",
|
372 |
+
"unique 5 \n",
|
373 |
+
"top User navigates to Home page on UMA application... \n",
|
374 |
+
"freq 1 "
|
375 |
+
]
|
376 |
+
},
|
377 |
+
"execution_count": 31,
|
378 |
+
"metadata": {},
|
379 |
+
"output_type": "execute_result"
|
380 |
+
}
|
381 |
+
],
|
382 |
+
"source": [
|
383 |
+
"df.describe()"
|
384 |
+
]
|
385 |
+
},
|
386 |
+
{
|
387 |
+
"cell_type": "code",
|
388 |
+
"execution_count": 32,
|
389 |
+
"id": "dd77a3b7",
|
390 |
+
"metadata": {},
|
391 |
+
"outputs": [
|
392 |
+
{
|
393 |
+
"data": {
|
394 |
+
"text/html": [
|
395 |
+
"<div>\n",
|
396 |
+
"<style scoped>\n",
|
397 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
398 |
+
" vertical-align: middle;\n",
|
399 |
+
" }\n",
|
400 |
+
"\n",
|
401 |
+
" .dataframe tbody tr th {\n",
|
402 |
+
" vertical-align: top;\n",
|
403 |
+
" }\n",
|
404 |
+
"\n",
|
405 |
+
" .dataframe thead th {\n",
|
406 |
+
" text-align: right;\n",
|
407 |
+
" }\n",
|
408 |
+
"</style>\n",
|
409 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
410 |
+
" <thead>\n",
|
411 |
+
" <tr style=\"text-align: right;\">\n",
|
412 |
+
" <th></th>\n",
|
413 |
+
" <th>Test case Acceptance criteria</th>\n",
|
414 |
+
" <th>Test Steps</th>\n",
|
415 |
+
" <th>Expected Result</th>\n",
|
416 |
+
" </tr>\n",
|
417 |
+
" </thead>\n",
|
418 |
+
" <tbody>\n",
|
419 |
+
" <tr>\n",
|
420 |
+
" <th>0</th>\n",
|
421 |
+
" <td>Weekly Ad - tap on any product offer - tap on ...</td>\n",
|
422 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
423 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
424 |
+
" </tr>\n",
|
425 |
+
" <tr>\n",
|
426 |
+
" <th>1</th>\n",
|
427 |
+
" <td>As a PdM, I want to ensure that the L2 entry p...</td>\n",
|
428 |
+
" <td>Login UMA app with valid email/ mobile no. Ver...</td>\n",
|
429 |
+
" <td>User should be able to login successfully and ...</td>\n",
|
430 |
+
" </tr>\n",
|
431 |
+
" <tr>\n",
|
432 |
+
" <th>2</th>\n",
|
433 |
+
" <td>As a customer, I should see age restriction me...</td>\n",
|
434 |
+
" <td>Login UMA app with valid email/ mobile no. Ent...</td>\n",
|
435 |
+
" <td>Your order contains age-restricted items. Some...</td>\n",
|
436 |
+
" </tr>\n",
|
437 |
+
" <tr>\n",
|
438 |
+
" <th>3</th>\n",
|
439 |
+
" <td>Verify Banner navigation for the below banners...</td>\n",
|
440 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
441 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
442 |
+
" </tr>\n",
|
443 |
+
" <tr>\n",
|
444 |
+
" <th>4</th>\n",
|
445 |
+
" <td>Display the Meal Plans banner based on the ban...</td>\n",
|
446 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
447 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
448 |
+
" </tr>\n",
|
449 |
+
" </tbody>\n",
|
450 |
+
"</table>\n",
|
451 |
+
"</div>"
|
452 |
+
],
|
453 |
+
"text/plain": [
|
454 |
+
" Test case Acceptance criteria \\\n",
|
455 |
+
"0 Weekly Ad - tap on any product offer - tap on ... \n",
|
456 |
+
"1 As a PdM, I want to ensure that the L2 entry p... \n",
|
457 |
+
"2 As a customer, I should see age restriction me... \n",
|
458 |
+
"3 Verify Banner navigation for the below banners... \n",
|
459 |
+
"4 Display the Meal Plans banner based on the ban... \n",
|
460 |
+
"\n",
|
461 |
+
" Test Steps \\\n",
|
462 |
+
"0 User logs into UMA application with valid user... \n",
|
463 |
+
"1 Login UMA app with valid email/ mobile no. Ver... \n",
|
464 |
+
"2 Login UMA app with valid email/ mobile no. Ent... \n",
|
465 |
+
"3 User logs into UMA application with valid user... \n",
|
466 |
+
"4 User logs into UMA application with valid user... \n",
|
467 |
+
"\n",
|
468 |
+
" Expected Result \n",
|
469 |
+
"0 User navigates to Home page on UMA application... \n",
|
470 |
+
"1 User should be able to login successfully and ... \n",
|
471 |
+
"2 Your order contains age-restricted items. Some... \n",
|
472 |
+
"3 User navigates to Home page on UMA application... \n",
|
473 |
+
"4 User navigates to Home page on UMA application... "
|
474 |
+
]
|
475 |
+
},
|
476 |
+
"execution_count": 32,
|
477 |
+
"metadata": {},
|
478 |
+
"output_type": "execute_result"
|
479 |
+
}
|
480 |
+
],
|
481 |
+
"source": [
|
482 |
+
"df = df.drop(['Story Name', 'Test Data'], axis = 1)\n",
|
483 |
+
"df.head(5)"
|
484 |
+
]
|
485 |
+
},
|
486 |
+
{
|
487 |
+
"cell_type": "code",
|
488 |
+
"execution_count": 9,
|
489 |
+
"id": "b775b74d",
|
490 |
+
"metadata": {},
|
491 |
+
"outputs": [
|
492 |
+
{
|
493 |
+
"data": {
|
494 |
+
"text/html": [
|
495 |
+
"<div>\n",
|
496 |
+
"<style scoped>\n",
|
497 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
498 |
+
" vertical-align: middle;\n",
|
499 |
+
" }\n",
|
500 |
+
"\n",
|
501 |
+
" .dataframe tbody tr th {\n",
|
502 |
+
" vertical-align: top;\n",
|
503 |
+
" }\n",
|
504 |
+
"\n",
|
505 |
+
" .dataframe thead th {\n",
|
506 |
+
" text-align: right;\n",
|
507 |
+
" }\n",
|
508 |
+
"</style>\n",
|
509 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
510 |
+
" <thead>\n",
|
511 |
+
" <tr style=\"text-align: right;\">\n",
|
512 |
+
" <th></th>\n",
|
513 |
+
" <th>Test case Acceptance criteria</th>\n",
|
514 |
+
" <th>Test Steps</th>\n",
|
515 |
+
" <th>Expected Result</th>\n",
|
516 |
+
" <th>Test_case_Acceptance_criteria</th>\n",
|
517 |
+
" <th>Test_Steps</th>\n",
|
518 |
+
" <th>Expected_Result</th>\n",
|
519 |
+
" </tr>\n",
|
520 |
+
" </thead>\n",
|
521 |
+
" <tbody>\n",
|
522 |
+
" <tr>\n",
|
523 |
+
" <th>0</th>\n",
|
524 |
+
" <td>Weekly Ad - tap on any product offer - tap on ...</td>\n",
|
525 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
526 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
527 |
+
" <td>[Weekly, Ad, -, tap, on, any, product, offer, ...</td>\n",
|
528 |
+
" <td>[User, logs, into, UMA, application, with, val...</td>\n",
|
529 |
+
" <td>[User, navigates, to, Home, page, on, UMA, app...</td>\n",
|
530 |
+
" </tr>\n",
|
531 |
+
" <tr>\n",
|
532 |
+
" <th>1</th>\n",
|
533 |
+
" <td>As a PdM, I want to ensure that the L2 entry p...</td>\n",
|
534 |
+
" <td>Login UMA app with valid email/ mobile no. Ver...</td>\n",
|
535 |
+
" <td>User should be able to login successfully and ...</td>\n",
|
536 |
+
" <td>[As, a, PdM,, I, want, to, ensure, that, the, ...</td>\n",
|
537 |
+
" <td>[Login, UMA, app, with, valid, email/, mobile,...</td>\n",
|
538 |
+
" <td>[User, should, be, able, to, login, successful...</td>\n",
|
539 |
+
" </tr>\n",
|
540 |
+
" <tr>\n",
|
541 |
+
" <th>2</th>\n",
|
542 |
+
" <td>As a customer, I should see age restriction me...</td>\n",
|
543 |
+
" <td>Login UMA app with valid email/ mobile no. Ent...</td>\n",
|
544 |
+
" <td>Your order contains age-restricted items. Some...</td>\n",
|
545 |
+
" <td>[As, a, customer,, I, should, see, age, restri...</td>\n",
|
546 |
+
" <td>[Login, UMA, app, with, valid, email/, mobile,...</td>\n",
|
547 |
+
" <td>[Your, order, contains, age-restricted, items....</td>\n",
|
548 |
+
" </tr>\n",
|
549 |
+
" <tr>\n",
|
550 |
+
" <th>3</th>\n",
|
551 |
+
" <td>Verify Banner navigation for the below banners...</td>\n",
|
552 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
553 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
554 |
+
" <td>[Verify, Banner, navigation, for, the, below, ...</td>\n",
|
555 |
+
" <td>[User, logs, into, UMA, application, with, val...</td>\n",
|
556 |
+
" <td>[User, navigates, to, Home, page, on, UMA, app...</td>\n",
|
557 |
+
" </tr>\n",
|
558 |
+
" <tr>\n",
|
559 |
+
" <th>4</th>\n",
|
560 |
+
" <td>Display the Meal Plans banner based on the ban...</td>\n",
|
561 |
+
" <td>User logs into UMA application with valid user...</td>\n",
|
562 |
+
" <td>User navigates to Home page on UMA application...</td>\n",
|
563 |
+
" <td>[Display, the, Meal, Plans, banner, based, on,...</td>\n",
|
564 |
+
" <td>[User, logs, into, UMA, application, with, val...</td>\n",
|
565 |
+
" <td>[User, navigates, to, Home, page, on, UMA, app...</td>\n",
|
566 |
+
" </tr>\n",
|
567 |
+
" </tbody>\n",
|
568 |
+
"</table>\n",
|
569 |
+
"</div>"
|
570 |
+
],
|
571 |
+
"text/plain": [
|
572 |
+
" Test case Acceptance criteria \\\n",
|
573 |
+
"0 Weekly Ad - tap on any product offer - tap on ... \n",
|
574 |
+
"1 As a PdM, I want to ensure that the L2 entry p... \n",
|
575 |
+
"2 As a customer, I should see age restriction me... \n",
|
576 |
+
"3 Verify Banner navigation for the below banners... \n",
|
577 |
+
"4 Display the Meal Plans banner based on the ban... \n",
|
578 |
+
"\n",
|
579 |
+
" Test Steps \\\n",
|
580 |
+
"0 User logs into UMA application with valid user... \n",
|
581 |
+
"1 Login UMA app with valid email/ mobile no. Ver... \n",
|
582 |
+
"2 Login UMA app with valid email/ mobile no. Ent... \n",
|
583 |
+
"3 User logs into UMA application with valid user... \n",
|
584 |
+
"4 User logs into UMA application with valid user... \n",
|
585 |
+
"\n",
|
586 |
+
" Expected Result \\\n",
|
587 |
+
"0 User navigates to Home page on UMA application... \n",
|
588 |
+
"1 User should be able to login successfully and ... \n",
|
589 |
+
"2 Your order contains age-restricted items. Some... \n",
|
590 |
+
"3 User navigates to Home page on UMA application... \n",
|
591 |
+
"4 User navigates to Home page on UMA application... \n",
|
592 |
+
"\n",
|
593 |
+
" Test_case_Acceptance_criteria \\\n",
|
594 |
+
"0 [Weekly, Ad, -, tap, on, any, product, offer, ... \n",
|
595 |
+
"1 [As, a, PdM,, I, want, to, ensure, that, the, ... \n",
|
596 |
+
"2 [As, a, customer,, I, should, see, age, restri... \n",
|
597 |
+
"3 [Verify, Banner, navigation, for, the, below, ... \n",
|
598 |
+
"4 [Display, the, Meal, Plans, banner, based, on,... \n",
|
599 |
+
"\n",
|
600 |
+
" Test_Steps \\\n",
|
601 |
+
"0 [User, logs, into, UMA, application, with, val... \n",
|
602 |
+
"1 [Login, UMA, app, with, valid, email/, mobile,... \n",
|
603 |
+
"2 [Login, UMA, app, with, valid, email/, mobile,... \n",
|
604 |
+
"3 [User, logs, into, UMA, application, with, val... \n",
|
605 |
+
"4 [User, logs, into, UMA, application, with, val... \n",
|
606 |
+
"\n",
|
607 |
+
" Expected_Result \n",
|
608 |
+
"0 [User, navigates, to, Home, page, on, UMA, app... \n",
|
609 |
+
"1 [User, should, be, able, to, login, successful... \n",
|
610 |
+
"2 [Your, order, contains, age-restricted, items.... \n",
|
611 |
+
"3 [User, navigates, to, Home, page, on, UMA, app... \n",
|
612 |
+
"4 [User, navigates, to, Home, page, on, UMA, app... "
|
613 |
+
]
|
614 |
+
},
|
615 |
+
"execution_count": 9,
|
616 |
+
"metadata": {},
|
617 |
+
"output_type": "execute_result"
|
618 |
+
}
|
619 |
+
],
|
620 |
+
"source": [
|
621 |
+
"# Tokenize the strings by splitting on spaces\n",
|
622 |
+
"df['Test_case_Acceptance_criteria'] = df['Test case Acceptance criteria'].apply(lambda x: x.split() if isinstance(x, str) else [])\n",
|
623 |
+
"df['Test_Steps'] = df['Test Steps'].apply(lambda x: x.split() if isinstance(x, str) else [])\n",
|
624 |
+
"df['Expected_Result'] = df['Expected Result'].apply(lambda x: x.split() if isinstance(x, str) else [])\n",
|
625 |
+
"\n",
|
626 |
+
"# Inspect the tokenized data\n",
|
627 |
+
"df.head(5)"
|
628 |
+
]
|
629 |
+
},
|
630 |
+
{
|
631 |
+
"cell_type": "code",
|
632 |
+
"execution_count": 10,
|
633 |
+
"id": "61e06a49",
|
634 |
+
"metadata": {},
|
635 |
+
"outputs": [
|
636 |
+
{
|
637 |
+
"name": "stdout",
|
638 |
+
"output_type": "stream",
|
639 |
+
"text": [
|
640 |
+
"Test case Acceptance criteria 0\n",
|
641 |
+
"Test Steps 0\n",
|
642 |
+
"Expected Result 0\n",
|
643 |
+
"Test_case_Acceptance_criteria 0\n",
|
644 |
+
"Test_Steps 0\n",
|
645 |
+
"Expected_Result 0\n",
|
646 |
+
"dtype: int64\n"
|
647 |
+
]
|
648 |
+
}
|
649 |
+
],
|
650 |
+
"source": [
|
651 |
+
"print(df.isna().sum())"
|
652 |
+
]
|
653 |
+
},
|
654 |
+
{
|
655 |
+
"cell_type": "code",
|
656 |
+
"execution_count": 11,
|
657 |
+
"id": "ca46d0a6",
|
658 |
+
"metadata": {},
|
659 |
+
"outputs": [
|
660 |
+
{
|
661 |
+
"data": {
|
662 |
+
"text/html": [
|
663 |
+
"<div>\n",
|
664 |
+
"<style scoped>\n",
|
665 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
666 |
+
" vertical-align: middle;\n",
|
667 |
+
" }\n",
|
668 |
+
"\n",
|
669 |
+
" .dataframe tbody tr th {\n",
|
670 |
+
" vertical-align: top;\n",
|
671 |
+
" }\n",
|
672 |
+
"\n",
|
673 |
+
" .dataframe thead th {\n",
|
674 |
+
" text-align: right;\n",
|
675 |
+
" }\n",
|
676 |
+
"</style>\n",
|
677 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
678 |
+
" <thead>\n",
|
679 |
+
" <tr style=\"text-align: right;\">\n",
|
680 |
+
" <th></th>\n",
|
681 |
+
" <th>Test_case_Acceptance_criteria</th>\n",
|
682 |
+
" <th>Test_Steps</th>\n",
|
683 |
+
" <th>Expected_Result</th>\n",
|
684 |
+
" </tr>\n",
|
685 |
+
" </thead>\n",
|
686 |
+
" <tbody>\n",
|
687 |
+
" <tr>\n",
|
688 |
+
" <th>0</th>\n",
|
689 |
+
" <td>[Weekly, Ad, -, tap, on, any, product, offer, ...</td>\n",
|
690 |
+
" <td>[User, logs, into, UMA, application, with, val...</td>\n",
|
691 |
+
" <td>[User, navigates, to, Home, page, on, UMA, app...</td>\n",
|
692 |
+
" </tr>\n",
|
693 |
+
" <tr>\n",
|
694 |
+
" <th>1</th>\n",
|
695 |
+
" <td>[As, a, PdM,, I, want, to, ensure, that, the, ...</td>\n",
|
696 |
+
" <td>[Login, UMA, app, with, valid, email/, mobile,...</td>\n",
|
697 |
+
" <td>[User, should, be, able, to, login, successful...</td>\n",
|
698 |
+
" </tr>\n",
|
699 |
+
" <tr>\n",
|
700 |
+
" <th>2</th>\n",
|
701 |
+
" <td>[As, a, customer,, I, should, see, age, restri...</td>\n",
|
702 |
+
" <td>[Login, UMA, app, with, valid, email/, mobile,...</td>\n",
|
703 |
+
" <td>[Your, order, contains, age-restricted, items....</td>\n",
|
704 |
+
" </tr>\n",
|
705 |
+
" <tr>\n",
|
706 |
+
" <th>3</th>\n",
|
707 |
+
" <td>[Verify, Banner, navigation, for, the, below, ...</td>\n",
|
708 |
+
" <td>[User, logs, into, UMA, application, with, val...</td>\n",
|
709 |
+
" <td>[User, navigates, to, Home, page, on, UMA, app...</td>\n",
|
710 |
+
" </tr>\n",
|
711 |
+
" <tr>\n",
|
712 |
+
" <th>4</th>\n",
|
713 |
+
" <td>[Display, the, Meal, Plans, banner, based, on,...</td>\n",
|
714 |
+
" <td>[User, logs, into, UMA, application, with, val...</td>\n",
|
715 |
+
" <td>[User, navigates, to, Home, page, on, UMA, app...</td>\n",
|
716 |
+
" </tr>\n",
|
717 |
+
" </tbody>\n",
|
718 |
+
"</table>\n",
|
719 |
+
"</div>"
|
720 |
+
],
|
721 |
+
"text/plain": [
|
722 |
+
" Test_case_Acceptance_criteria \\\n",
|
723 |
+
"0 [Weekly, Ad, -, tap, on, any, product, offer, ... \n",
|
724 |
+
"1 [As, a, PdM,, I, want, to, ensure, that, the, ... \n",
|
725 |
+
"2 [As, a, customer,, I, should, see, age, restri... \n",
|
726 |
+
"3 [Verify, Banner, navigation, for, the, below, ... \n",
|
727 |
+
"4 [Display, the, Meal, Plans, banner, based, on,... \n",
|
728 |
+
"\n",
|
729 |
+
" Test_Steps \\\n",
|
730 |
+
"0 [User, logs, into, UMA, application, with, val... \n",
|
731 |
+
"1 [Login, UMA, app, with, valid, email/, mobile,... \n",
|
732 |
+
"2 [Login, UMA, app, with, valid, email/, mobile,... \n",
|
733 |
+
"3 [User, logs, into, UMA, application, with, val... \n",
|
734 |
+
"4 [User, logs, into, UMA, application, with, val... \n",
|
735 |
+
"\n",
|
736 |
+
" Expected_Result \n",
|
737 |
+
"0 [User, navigates, to, Home, page, on, UMA, app... \n",
|
738 |
+
"1 [User, should, be, able, to, login, successful... \n",
|
739 |
+
"2 [Your, order, contains, age-restricted, items.... \n",
|
740 |
+
"3 [User, navigates, to, Home, page, on, UMA, app... \n",
|
741 |
+
"4 [User, navigates, to, Home, page, on, UMA, app... "
|
742 |
+
]
|
743 |
+
},
|
744 |
+
"execution_count": 11,
|
745 |
+
"metadata": {},
|
746 |
+
"output_type": "execute_result"
|
747 |
+
}
|
748 |
+
],
|
749 |
+
"source": [
|
750 |
+
"df = df.drop(['Test case Acceptance criteria', 'Test Steps', 'Expected Result'], axis = 1)\n",
|
751 |
+
"df.head(5)"
|
752 |
+
]
|
753 |
+
},
|
754 |
+
{
|
755 |
+
"cell_type": "code",
|
756 |
+
"execution_count": 12,
|
757 |
+
"id": "f211722a",
|
758 |
+
"metadata": {},
|
759 |
+
"outputs": [
|
760 |
+
{
|
761 |
+
"data": {
|
762 |
+
"text/html": [
|
763 |
+
"<div>\n",
|
764 |
+
"<style scoped>\n",
|
765 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
766 |
+
" vertical-align: middle;\n",
|
767 |
+
" }\n",
|
768 |
+
"\n",
|
769 |
+
" .dataframe tbody tr th {\n",
|
770 |
+
" vertical-align: top;\n",
|
771 |
+
" }\n",
|
772 |
+
"\n",
|
773 |
+
" .dataframe thead th {\n",
|
774 |
+
" text-align: right;\n",
|
775 |
+
" }\n",
|
776 |
+
"</style>\n",
|
777 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
778 |
+
" <thead>\n",
|
779 |
+
" <tr style=\"text-align: right;\">\n",
|
780 |
+
" <th></th>\n",
|
781 |
+
" <th>Test_case_Acceptance_criteria</th>\n",
|
782 |
+
" <th>Test_Steps</th>\n",
|
783 |
+
" <th>Expected_Result</th>\n",
|
784 |
+
" </tr>\n",
|
785 |
+
" </thead>\n",
|
786 |
+
" <tbody>\n",
|
787 |
+
" <tr>\n",
|
788 |
+
" <th>0</th>\n",
|
789 |
+
" <td>[Weekly, Ad, -, tap, product, offer, -, tap, A...</td>\n",
|
790 |
+
" <td>[User, logs, UMA, application, valid, user's, ...</td>\n",
|
791 |
+
" <td>[User, navigates, Home, page, UMA, application...</td>\n",
|
792 |
+
" </tr>\n",
|
793 |
+
" <tr>\n",
|
794 |
+
" <th>1</th>\n",
|
795 |
+
" <td>[PdM,, want, ensure, L2, entry, points, workin...</td>\n",
|
796 |
+
" <td>[Login, UMA, app, valid, email/, mobile, no., ...</td>\n",
|
797 |
+
" <td>[User, able, login, successfully, home, page, ...</td>\n",
|
798 |
+
" </tr>\n",
|
799 |
+
" <tr>\n",
|
800 |
+
" <th>2</th>\n",
|
801 |
+
" <td>[customer,, see, age, restriction, message, ch...</td>\n",
|
802 |
+
" <td>[Login, UMA, app, valid, email/, mobile, no., ...</td>\n",
|
803 |
+
" <td>[order, contains, age-restricted, items., Some...</td>\n",
|
804 |
+
" </tr>\n",
|
805 |
+
" <tr>\n",
|
806 |
+
" <th>3</th>\n",
|
807 |
+
" <td>[Verify, Banner, navigation, banners, places, ...</td>\n",
|
808 |
+
" <td>[User, logs, UMA, application, valid, user's, ...</td>\n",
|
809 |
+
" <td>[User, navigates, Home, page, UMA, application...</td>\n",
|
810 |
+
" </tr>\n",
|
811 |
+
" <tr>\n",
|
812 |
+
" <th>4</th>\n",
|
813 |
+
" <td>[Display, Meal, Plans, banner, based, banner.,...</td>\n",
|
814 |
+
" <td>[User, logs, UMA, application, valid, user's, ...</td>\n",
|
815 |
+
" <td>[User, navigates, Home, page, UMA, application...</td>\n",
|
816 |
+
" </tr>\n",
|
817 |
+
" </tbody>\n",
|
818 |
+
"</table>\n",
|
819 |
+
"</div>"
|
820 |
+
],
|
821 |
+
"text/plain": [
|
822 |
+
" Test_case_Acceptance_criteria \\\n",
|
823 |
+
"0 [Weekly, Ad, -, tap, product, offer, -, tap, A... \n",
|
824 |
+
"1 [PdM,, want, ensure, L2, entry, points, workin... \n",
|
825 |
+
"2 [customer,, see, age, restriction, message, ch... \n",
|
826 |
+
"3 [Verify, Banner, navigation, banners, places, ... \n",
|
827 |
+
"4 [Display, Meal, Plans, banner, based, banner.,... \n",
|
828 |
+
"\n",
|
829 |
+
" Test_Steps \\\n",
|
830 |
+
"0 [User, logs, UMA, application, valid, user's, ... \n",
|
831 |
+
"1 [Login, UMA, app, valid, email/, mobile, no., ... \n",
|
832 |
+
"2 [Login, UMA, app, valid, email/, mobile, no., ... \n",
|
833 |
+
"3 [User, logs, UMA, application, valid, user's, ... \n",
|
834 |
+
"4 [User, logs, UMA, application, valid, user's, ... \n",
|
835 |
+
"\n",
|
836 |
+
" Expected_Result \n",
|
837 |
+
"0 [User, navigates, Home, page, UMA, application... \n",
|
838 |
+
"1 [User, able, login, successfully, home, page, ... \n",
|
839 |
+
"2 [order, contains, age-restricted, items., Some... \n",
|
840 |
+
"3 [User, navigates, Home, page, UMA, application... \n",
|
841 |
+
"4 [User, navigates, Home, page, UMA, application... "
|
842 |
+
]
|
843 |
+
},
|
844 |
+
"execution_count": 12,
|
845 |
+
"metadata": {},
|
846 |
+
"output_type": "execute_result"
|
847 |
+
}
|
848 |
+
],
|
849 |
+
"source": [
|
850 |
+
"stop_words = set(stopwords.words('english'))\n",
|
851 |
+
"\n",
|
852 |
+
"# Function to remove stopwords\n",
|
853 |
+
"def remove_stopwords(tokens):\n",
|
854 |
+
" return [token for token in tokens if token.lower() not in stop_words]\n",
|
855 |
+
"\n",
|
856 |
+
"# Apply stopwords removal\n",
|
857 |
+
"df['Test_case_Acceptance_criteria'] = df['Test_case_Acceptance_criteria'].apply(remove_stopwords)\n",
|
858 |
+
"df['Test_Steps'] = df['Test_Steps'].apply(remove_stopwords)\n",
|
859 |
+
"df['Expected_Result'] = df['Expected_Result'].apply(remove_stopwords)\n",
|
860 |
+
"\n",
|
861 |
+
"# Inspect the data after stopwords removal\n",
|
862 |
+
"df.head(5)"
|
863 |
+
]
|
864 |
+
},
|
865 |
+
{
|
866 |
+
"cell_type": "code",
|
867 |
+
"execution_count": 14,
|
868 |
+
"id": "057555fe",
|
869 |
+
"metadata": {},
|
870 |
+
"outputs": [
|
871 |
+
{
|
872 |
+
"data": {
|
873 |
+
"text/html": [
|
874 |
+
"<div>\n",
|
875 |
+
"<style scoped>\n",
|
876 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
877 |
+
" vertical-align: middle;\n",
|
878 |
+
" }\n",
|
879 |
+
"\n",
|
880 |
+
" .dataframe tbody tr th {\n",
|
881 |
+
" vertical-align: top;\n",
|
882 |
+
" }\n",
|
883 |
+
"\n",
|
884 |
+
" .dataframe thead th {\n",
|
885 |
+
" text-align: right;\n",
|
886 |
+
" }\n",
|
887 |
+
"</style>\n",
|
888 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
889 |
+
" <thead>\n",
|
890 |
+
" <tr style=\"text-align: right;\">\n",
|
891 |
+
" <th></th>\n",
|
892 |
+
" <th>Test_case_Acceptance_criteria</th>\n",
|
893 |
+
" <th>Test_Steps</th>\n",
|
894 |
+
" <th>Expected_Result</th>\n",
|
895 |
+
" </tr>\n",
|
896 |
+
" </thead>\n",
|
897 |
+
" <tbody>\n",
|
898 |
+
" <tr>\n",
|
899 |
+
" <th>0</th>\n",
|
900 |
+
" <td>[Weekly, Ad, -, tap, product, offer, -, tap, A...</td>\n",
|
901 |
+
" <td>[User, log, UMA, application, valid, user's, c...</td>\n",
|
902 |
+
" <td>[User, navigate, Home, page, UMA, application....</td>\n",
|
903 |
+
" </tr>\n",
|
904 |
+
" <tr>\n",
|
905 |
+
" <th>1</th>\n",
|
906 |
+
" <td>[PdM,, want, ensure, L2, entry, point, work, f...</td>\n",
|
907 |
+
" <td>[Login, UMA, app, valid, email/, mobile, no., ...</td>\n",
|
908 |
+
" <td>[User, able, login, successfully, home, page, ...</td>\n",
|
909 |
+
" </tr>\n",
|
910 |
+
" <tr>\n",
|
911 |
+
" <th>2</th>\n",
|
912 |
+
" <td>[customer,, see, age, restriction, message, ch...</td>\n",
|
913 |
+
" <td>[Login, UMA, app, valid, email/, mobile, no., ...</td>\n",
|
914 |
+
" <td>[order, contain, age-restricted, items., Someo...</td>\n",
|
915 |
+
" </tr>\n",
|
916 |
+
" <tr>\n",
|
917 |
+
" <th>3</th>\n",
|
918 |
+
" <td>[Verify, Banner, navigation, banner, place, di...</td>\n",
|
919 |
+
" <td>[User, log, UMA, application, valid, user's, c...</td>\n",
|
920 |
+
" <td>[User, navigate, Home, page, UMA, application,...</td>\n",
|
921 |
+
" </tr>\n",
|
922 |
+
" <tr>\n",
|
923 |
+
" <th>4</th>\n",
|
924 |
+
" <td>[Display, Meal, Plans, banner, base, banner., ...</td>\n",
|
925 |
+
" <td>[User, log, UMA, application, valid, user's, c...</td>\n",
|
926 |
+
" <td>[User, navigate, Home, page, UMA, application....</td>\n",
|
927 |
+
" </tr>\n",
|
928 |
+
" </tbody>\n",
|
929 |
+
"</table>\n",
|
930 |
+
"</div>"
|
931 |
+
],
|
932 |
+
"text/plain": [
|
933 |
+
" Test_case_Acceptance_criteria \\\n",
|
934 |
+
"0 [Weekly, Ad, -, tap, product, offer, -, tap, A... \n",
|
935 |
+
"1 [PdM,, want, ensure, L2, entry, point, work, f... \n",
|
936 |
+
"2 [customer,, see, age, restriction, message, ch... \n",
|
937 |
+
"3 [Verify, Banner, navigation, banner, place, di... \n",
|
938 |
+
"4 [Display, Meal, Plans, banner, base, banner., ... \n",
|
939 |
+
"\n",
|
940 |
+
" Test_Steps \\\n",
|
941 |
+
"0 [User, log, UMA, application, valid, user's, c... \n",
|
942 |
+
"1 [Login, UMA, app, valid, email/, mobile, no., ... \n",
|
943 |
+
"2 [Login, UMA, app, valid, email/, mobile, no., ... \n",
|
944 |
+
"3 [User, log, UMA, application, valid, user's, c... \n",
|
945 |
+
"4 [User, log, UMA, application, valid, user's, c... \n",
|
946 |
+
"\n",
|
947 |
+
" Expected_Result \n",
|
948 |
+
"0 [User, navigate, Home, page, UMA, application.... \n",
|
949 |
+
"1 [User, able, login, successfully, home, page, ... \n",
|
950 |
+
"2 [order, contain, age-restricted, items., Someo... \n",
|
951 |
+
"3 [User, navigate, Home, page, UMA, application,... \n",
|
952 |
+
"4 [User, navigate, Home, page, UMA, application.... "
|
953 |
+
]
|
954 |
+
},
|
955 |
+
"execution_count": 14,
|
956 |
+
"metadata": {},
|
957 |
+
"output_type": "execute_result"
|
958 |
+
}
|
959 |
+
],
|
960 |
+
"source": [
|
961 |
+
"lemmatizer = WordNetLemmatizer()\n",
|
962 |
+
"\n",
|
963 |
+
"# Function to lemmatize tokens\n",
|
964 |
+
"def lemmatize_tokens(tokens):\n",
|
965 |
+
" return [lemmatizer.lemmatize(token, pos = 'v') for token in tokens]\n",
|
966 |
+
"\n",
|
967 |
+
"# Apply lemmatization\n",
|
968 |
+
"df['Test_case_Acceptance_criteria'] = df['Test_case_Acceptance_criteria'].apply(lemmatize_tokens)\n",
|
969 |
+
"df['Test_Steps'] = df['Test_Steps'].apply(lemmatize_tokens)\n",
|
970 |
+
"df['Expected_Result'] = df['Expected_Result'].apply(lemmatize_tokens)\n",
|
971 |
+
"\n",
|
972 |
+
"# Inspect the data after lemmatization\n",
|
973 |
+
"df.head(5)"
|
974 |
+
]
|
975 |
+
},
|
976 |
+
{
|
977 |
+
"cell_type": "code",
|
978 |
+
"execution_count": 15,
|
979 |
+
"id": "249dd661",
|
980 |
+
"metadata": {},
|
981 |
+
"outputs": [
|
982 |
+
{
|
983 |
+
"data": {
|
984 |
+
"text/html": [
|
985 |
+
"<div>\n",
|
986 |
+
"<style scoped>\n",
|
987 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
988 |
+
" vertical-align: middle;\n",
|
989 |
+
" }\n",
|
990 |
+
"\n",
|
991 |
+
" .dataframe tbody tr th {\n",
|
992 |
+
" vertical-align: top;\n",
|
993 |
+
" }\n",
|
994 |
+
"\n",
|
995 |
+
" .dataframe thead th {\n",
|
996 |
+
" text-align: right;\n",
|
997 |
+
" }\n",
|
998 |
+
"</style>\n",
|
999 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1000 |
+
" <thead>\n",
|
1001 |
+
" <tr style=\"text-align: right;\">\n",
|
1002 |
+
" <th></th>\n",
|
1003 |
+
" <th>Test_case_Acceptance_criteria</th>\n",
|
1004 |
+
" <th>Test_Steps</th>\n",
|
1005 |
+
" <th>Expected_Result</th>\n",
|
1006 |
+
" <th>Acceptance_criteria_embeddings</th>\n",
|
1007 |
+
" <th>Test_Steps_embeddings</th>\n",
|
1008 |
+
" <th>Expected_Result_embeddings</th>\n",
|
1009 |
+
" </tr>\n",
|
1010 |
+
" </thead>\n",
|
1011 |
+
" <tbody>\n",
|
1012 |
+
" <tr>\n",
|
1013 |
+
" <th>0</th>\n",
|
1014 |
+
" <td>[Weekly, Ad, -, tap, product, offer, -, tap, A...</td>\n",
|
1015 |
+
" <td>[User, log, UMA, application, valid, user's, c...</td>\n",
|
1016 |
+
" <td>[User, navigate, Home, page, UMA, application....</td>\n",
|
1017 |
+
" <td>[2.9078821e-05, 0.0009868374, 0.0006897929, 0....</td>\n",
|
1018 |
+
" <td>[-0.00090376585, 0.0015351841, 0.00077817513, ...</td>\n",
|
1019 |
+
" <td>[-0.00075740286, 0.0017703008, 7.018649e-05, 0...</td>\n",
|
1020 |
+
" </tr>\n",
|
1021 |
+
" <tr>\n",
|
1022 |
+
" <th>1</th>\n",
|
1023 |
+
" <td>[PdM,, want, ensure, L2, entry, point, work, f...</td>\n",
|
1024 |
+
" <td>[Login, UMA, app, valid, email/, mobile, no., ...</td>\n",
|
1025 |
+
" <td>[User, able, login, successfully, home, page, ...</td>\n",
|
1026 |
+
" <td>[4.9687253e-05, -0.0002648631, -0.0011476703, ...</td>\n",
|
1027 |
+
" <td>[-0.0007915226, 0.0008593759, 0.00056966604, -...</td>\n",
|
1028 |
+
" <td>[0.00035405744, 0.0019673503, -0.00071650144, ...</td>\n",
|
1029 |
+
" </tr>\n",
|
1030 |
+
" <tr>\n",
|
1031 |
+
" <th>2</th>\n",
|
1032 |
+
" <td>[customer,, see, age, restriction, message, ch...</td>\n",
|
1033 |
+
" <td>[Login, UMA, app, valid, email/, mobile, no., ...</td>\n",
|
1034 |
+
" <td>[order, contain, age-restricted, items., Someo...</td>\n",
|
1035 |
+
" <td>[-0.0019043502, -0.0007733393, -0.00047627056,...</td>\n",
|
1036 |
+
" <td>[-0.0010107799, -0.0004325275, 0.0025766247, 0...</td>\n",
|
1037 |
+
" <td>[-0.0022062701, -0.0032818727, 0.0012025184, -...</td>\n",
|
1038 |
+
" </tr>\n",
|
1039 |
+
" <tr>\n",
|
1040 |
+
" <th>3</th>\n",
|
1041 |
+
" <td>[Verify, Banner, navigation, banner, place, di...</td>\n",
|
1042 |
+
" <td>[User, log, UMA, application, valid, user's, c...</td>\n",
|
1043 |
+
" <td>[User, navigate, Home, page, UMA, application,...</td>\n",
|
1044 |
+
" <td>[0.00079187436, 0.001024591, -0.00025014183, -...</td>\n",
|
1045 |
+
" <td>[-0.00082380656, 0.0015335361, 0.0008829938, 0...</td>\n",
|
1046 |
+
" <td>[-0.0007905865, 0.0017265088, 0.00018967084, 0...</td>\n",
|
1047 |
+
" </tr>\n",
|
1048 |
+
" <tr>\n",
|
1049 |
+
" <th>4</th>\n",
|
1050 |
+
" <td>[Display, Meal, Plans, banner, base, banner., ...</td>\n",
|
1051 |
+
" <td>[User, log, UMA, application, valid, user's, c...</td>\n",
|
1052 |
+
" <td>[User, navigate, Home, page, UMA, application....</td>\n",
|
1053 |
+
" <td>[0.0006987122, 0.0025012388, 0.00094601634, -0...</td>\n",
|
1054 |
+
" <td>[-0.0006520124, 0.00076459144, 0.0014451812, 0...</td>\n",
|
1055 |
+
" <td>[-0.00028285536, 0.0013591949, -0.00073397934,...</td>\n",
|
1056 |
+
" </tr>\n",
|
1057 |
+
" </tbody>\n",
|
1058 |
+
"</table>\n",
|
1059 |
+
"</div>"
|
1060 |
+
],
|
1061 |
+
"text/plain": [
|
1062 |
+
" Test_case_Acceptance_criteria \\\n",
|
1063 |
+
"0 [Weekly, Ad, -, tap, product, offer, -, tap, A... \n",
|
1064 |
+
"1 [PdM,, want, ensure, L2, entry, point, work, f... \n",
|
1065 |
+
"2 [customer,, see, age, restriction, message, ch... \n",
|
1066 |
+
"3 [Verify, Banner, navigation, banner, place, di... \n",
|
1067 |
+
"4 [Display, Meal, Plans, banner, base, banner., ... \n",
|
1068 |
+
"\n",
|
1069 |
+
" Test_Steps \\\n",
|
1070 |
+
"0 [User, log, UMA, application, valid, user's, c... \n",
|
1071 |
+
"1 [Login, UMA, app, valid, email/, mobile, no., ... \n",
|
1072 |
+
"2 [Login, UMA, app, valid, email/, mobile, no., ... \n",
|
1073 |
+
"3 [User, log, UMA, application, valid, user's, c... \n",
|
1074 |
+
"4 [User, log, UMA, application, valid, user's, c... \n",
|
1075 |
+
"\n",
|
1076 |
+
" Expected_Result \\\n",
|
1077 |
+
"0 [User, navigate, Home, page, UMA, application.... \n",
|
1078 |
+
"1 [User, able, login, successfully, home, page, ... \n",
|
1079 |
+
"2 [order, contain, age-restricted, items., Someo... \n",
|
1080 |
+
"3 [User, navigate, Home, page, UMA, application,... \n",
|
1081 |
+
"4 [User, navigate, Home, page, UMA, application.... \n",
|
1082 |
+
"\n",
|
1083 |
+
" Acceptance_criteria_embeddings \\\n",
|
1084 |
+
"0 [2.9078821e-05, 0.0009868374, 0.0006897929, 0.... \n",
|
1085 |
+
"1 [4.9687253e-05, -0.0002648631, -0.0011476703, ... \n",
|
1086 |
+
"2 [-0.0019043502, -0.0007733393, -0.00047627056,... \n",
|
1087 |
+
"3 [0.00079187436, 0.001024591, -0.00025014183, -... \n",
|
1088 |
+
"4 [0.0006987122, 0.0025012388, 0.00094601634, -0... \n",
|
1089 |
+
"\n",
|
1090 |
+
" Test_Steps_embeddings \\\n",
|
1091 |
+
"0 [-0.00090376585, 0.0015351841, 0.00077817513, ... \n",
|
1092 |
+
"1 [-0.0007915226, 0.0008593759, 0.00056966604, -... \n",
|
1093 |
+
"2 [-0.0010107799, -0.0004325275, 0.0025766247, 0... \n",
|
1094 |
+
"3 [-0.00082380656, 0.0015335361, 0.0008829938, 0... \n",
|
1095 |
+
"4 [-0.0006520124, 0.00076459144, 0.0014451812, 0... \n",
|
1096 |
+
"\n",
|
1097 |
+
" Expected_Result_embeddings \n",
|
1098 |
+
"0 [-0.00075740286, 0.0017703008, 7.018649e-05, 0... \n",
|
1099 |
+
"1 [0.00035405744, 0.0019673503, -0.00071650144, ... \n",
|
1100 |
+
"2 [-0.0022062701, -0.0032818727, 0.0012025184, -... \n",
|
1101 |
+
"3 [-0.0007905865, 0.0017265088, 0.00018967084, 0... \n",
|
1102 |
+
"4 [-0.00028285536, 0.0013591949, -0.00073397934,... "
|
1103 |
+
]
|
1104 |
+
},
|
1105 |
+
"execution_count": 15,
|
1106 |
+
"metadata": {},
|
1107 |
+
"output_type": "execute_result"
|
1108 |
+
}
|
1109 |
+
],
|
1110 |
+
"source": [
|
1111 |
+
"all_tokens = df['Test_case_Acceptance_criteria'].tolist() + df['Test_Steps'].tolist() + df['Expected_Result'].tolist()\n",
|
1112 |
+
"\n",
|
1113 |
+
"# Train the Word2Vec model\n",
|
1114 |
+
"word2vec_model = Word2Vec(sentences=all_tokens, vector_size=100, window=5, min_count=1, sg=0)\n",
|
1115 |
+
"\n",
|
1116 |
+
"# Function to get embeddings for tokens\n",
|
1117 |
+
"def get_embeddings(tokens, model):\n",
|
1118 |
+
" embeddings = []\n",
|
1119 |
+
" for token in tokens:\n",
|
1120 |
+
" if token in model.wv:\n",
|
1121 |
+
" embeddings.append(model.wv[token])\n",
|
1122 |
+
" else:\n",
|
1123 |
+
" embeddings.append(np.zeros(model.vector_size)) # Handle out-of-vocabulary words\n",
|
1124 |
+
" return np.mean(embeddings, axis=0) # Mean vector for the document\n",
|
1125 |
+
"\n",
|
1126 |
+
"# Apply the function to each column\n",
|
1127 |
+
"df['Acceptance_criteria_embeddings'] = df['Test_case_Acceptance_criteria'].apply(lambda tokens: get_embeddings(tokens, word2vec_model) if tokens else np.nan)\n",
|
1128 |
+
"df['Test_Steps_embeddings'] = df['Test_Steps'].apply(lambda tokens: get_embeddings(tokens, word2vec_model) if tokens else np.nan)\n",
|
1129 |
+
"df['Expected_Result_embeddings'] = df['Expected_Result'].apply(lambda tokens: get_embeddings(tokens, word2vec_model) if tokens else np.nan)\n",
|
1130 |
+
"\n",
|
1131 |
+
"# Verify the final DataFrame\n",
|
1132 |
+
"df.head(5)"
|
1133 |
+
]
|
1134 |
+
},
|
1135 |
+
{
|
1136 |
+
"cell_type": "code",
|
1137 |
+
"execution_count": 16,
|
1138 |
+
"id": "f36d8564",
|
1139 |
+
"metadata": {},
|
1140 |
+
"outputs": [
|
1141 |
+
{
|
1142 |
+
"data": {
|
1143 |
+
"text/html": [
|
1144 |
+
"<div>\n",
|
1145 |
+
"<style scoped>\n",
|
1146 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
1147 |
+
" vertical-align: middle;\n",
|
1148 |
+
" }\n",
|
1149 |
+
"\n",
|
1150 |
+
" .dataframe tbody tr th {\n",
|
1151 |
+
" vertical-align: top;\n",
|
1152 |
+
" }\n",
|
1153 |
+
"\n",
|
1154 |
+
" .dataframe thead th {\n",
|
1155 |
+
" text-align: right;\n",
|
1156 |
+
" }\n",
|
1157 |
+
"</style>\n",
|
1158 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
1159 |
+
" <thead>\n",
|
1160 |
+
" <tr style=\"text-align: right;\">\n",
|
1161 |
+
" <th></th>\n",
|
1162 |
+
" <th>Acceptance_criteria_embeddings</th>\n",
|
1163 |
+
" <th>Test_Steps_embeddings</th>\n",
|
1164 |
+
" <th>Expected_Result_embeddings</th>\n",
|
1165 |
+
" </tr>\n",
|
1166 |
+
" </thead>\n",
|
1167 |
+
" <tbody>\n",
|
1168 |
+
" <tr>\n",
|
1169 |
+
" <th>0</th>\n",
|
1170 |
+
" <td>[2.9078821e-05, 0.0009868374, 0.0006897929, 0....</td>\n",
|
1171 |
+
" <td>[-0.00090376585, 0.0015351841, 0.00077817513, ...</td>\n",
|
1172 |
+
" <td>[-0.00075740286, 0.0017703008, 7.018649e-05, 0...</td>\n",
|
1173 |
+
" </tr>\n",
|
1174 |
+
" <tr>\n",
|
1175 |
+
" <th>1</th>\n",
|
1176 |
+
" <td>[4.9687253e-05, -0.0002648631, -0.0011476703, ...</td>\n",
|
1177 |
+
" <td>[-0.0007915226, 0.0008593759, 0.00056966604, -...</td>\n",
|
1178 |
+
" <td>[0.00035405744, 0.0019673503, -0.00071650144, ...</td>\n",
|
1179 |
+
" </tr>\n",
|
1180 |
+
" <tr>\n",
|
1181 |
+
" <th>2</th>\n",
|
1182 |
+
" <td>[-0.0019043502, -0.0007733393, -0.00047627056,...</td>\n",
|
1183 |
+
" <td>[-0.0010107799, -0.0004325275, 0.0025766247, 0...</td>\n",
|
1184 |
+
" <td>[-0.0022062701, -0.0032818727, 0.0012025184, -...</td>\n",
|
1185 |
+
" </tr>\n",
|
1186 |
+
" <tr>\n",
|
1187 |
+
" <th>3</th>\n",
|
1188 |
+
" <td>[0.00079187436, 0.001024591, -0.00025014183, -...</td>\n",
|
1189 |
+
" <td>[-0.00082380656, 0.0015335361, 0.0008829938, 0...</td>\n",
|
1190 |
+
" <td>[-0.0007905865, 0.0017265088, 0.00018967084, 0...</td>\n",
|
1191 |
+
" </tr>\n",
|
1192 |
+
" <tr>\n",
|
1193 |
+
" <th>4</th>\n",
|
1194 |
+
" <td>[0.0006987122, 0.0025012388, 0.00094601634, -0...</td>\n",
|
1195 |
+
" <td>[-0.0006520124, 0.00076459144, 0.0014451812, 0...</td>\n",
|
1196 |
+
" <td>[-0.00028285536, 0.0013591949, -0.00073397934,...</td>\n",
|
1197 |
+
" </tr>\n",
|
1198 |
+
" </tbody>\n",
|
1199 |
+
"</table>\n",
|
1200 |
+
"</div>"
|
1201 |
+
],
|
1202 |
+
"text/plain": [
|
1203 |
+
" Acceptance_criteria_embeddings \\\n",
|
1204 |
+
"0 [2.9078821e-05, 0.0009868374, 0.0006897929, 0.... \n",
|
1205 |
+
"1 [4.9687253e-05, -0.0002648631, -0.0011476703, ... \n",
|
1206 |
+
"2 [-0.0019043502, -0.0007733393, -0.00047627056,... \n",
|
1207 |
+
"3 [0.00079187436, 0.001024591, -0.00025014183, -... \n",
|
1208 |
+
"4 [0.0006987122, 0.0025012388, 0.00094601634, -0... \n",
|
1209 |
+
"\n",
|
1210 |
+
" Test_Steps_embeddings \\\n",
|
1211 |
+
"0 [-0.00090376585, 0.0015351841, 0.00077817513, ... \n",
|
1212 |
+
"1 [-0.0007915226, 0.0008593759, 0.00056966604, -... \n",
|
1213 |
+
"2 [-0.0010107799, -0.0004325275, 0.0025766247, 0... \n",
|
1214 |
+
"3 [-0.00082380656, 0.0015335361, 0.0008829938, 0... \n",
|
1215 |
+
"4 [-0.0006520124, 0.00076459144, 0.0014451812, 0... \n",
|
1216 |
+
"\n",
|
1217 |
+
" Expected_Result_embeddings \n",
|
1218 |
+
"0 [-0.00075740286, 0.0017703008, 7.018649e-05, 0... \n",
|
1219 |
+
"1 [0.00035405744, 0.0019673503, -0.00071650144, ... \n",
|
1220 |
+
"2 [-0.0022062701, -0.0032818727, 0.0012025184, -... \n",
|
1221 |
+
"3 [-0.0007905865, 0.0017265088, 0.00018967084, 0... \n",
|
1222 |
+
"4 [-0.00028285536, 0.0013591949, -0.00073397934,... "
|
1223 |
+
]
|
1224 |
+
},
|
1225 |
+
"execution_count": 16,
|
1226 |
+
"metadata": {},
|
1227 |
+
"output_type": "execute_result"
|
1228 |
+
}
|
1229 |
+
],
|
1230 |
+
"source": [
|
1231 |
+
"df = df.drop(['Test_case_Acceptance_criteria', 'Test_Steps', 'Expected_Result'], axis = 1)\n",
|
1232 |
+
"df.head(5)"
|
1233 |
+
]
|
1234 |
+
},
|
1235 |
+
{
|
1236 |
+
"cell_type": "code",
|
1237 |
+
"execution_count": 17,
|
1238 |
+
"id": "53d82554",
|
1239 |
+
"metadata": {},
|
1240 |
+
"outputs": [],
|
1241 |
+
"source": [
|
1242 |
+
"X = np.array(df['Acceptance_criteria_embeddings'].tolist())\n",
|
1243 |
+
"y_test_steps = np.array(df['Test_Steps_embeddings'].tolist())\n",
|
1244 |
+
"y_expected_result = np.array(df['Expected_Result_embeddings'].tolist())\n",
|
1245 |
+
"\n",
|
1246 |
+
"# Reshape data for LSTM: (samples, timesteps, features)\n",
|
1247 |
+
"X = X.reshape((X.shape[0], 1, X.shape[1]))\n",
|
1248 |
+
"y_test_steps = y_test_steps.reshape((y_test_steps.shape[0], 1, y_test_steps.shape[1]))\n",
|
1249 |
+
"y_expected_result = y_expected_result.reshape((y_expected_result.shape[0], 1, y_expected_result.shape[1]))\n",
|
1250 |
+
"\n",
|
1251 |
+
"# Split the data into training and testing sets\n",
|
1252 |
+
"X_train, X_test, y_train_test_steps, y_test_test_steps = train_test_split(X, y_test_steps, test_size=0.2, random_state=42)\n",
|
1253 |
+
"_, _, y_train_expected_result, y_test_expected_result = train_test_split(X, y_expected_result, test_size=0.2, random_state=42)"
|
1254 |
+
]
|
1255 |
+
},
|
1256 |
+
{
|
1257 |
+
"cell_type": "code",
|
1258 |
+
"execution_count": 18,
|
1259 |
+
"id": "dc4930ed",
|
1260 |
+
"metadata": {},
|
1261 |
+
"outputs": [
|
1262 |
+
{
|
1263 |
+
"name": "stderr",
|
1264 |
+
"output_type": "stream",
|
1265 |
+
"text": [
|
1266 |
+
"/Users/preethamreddygollapalli/anaconda3/lib/python3.11/site-packages/keras/src/layers/rnn/rnn.py:204: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n",
|
1267 |
+
" super().__init__(**kwargs)\n"
|
1268 |
+
]
|
1269 |
+
}
|
1270 |
+
],
|
1271 |
+
"source": [
|
1272 |
+
"from tensorflow.keras.layers import LSTM, Dense, TimeDistributed\n",
|
1273 |
+
"\n",
|
1274 |
+
"# Define the model for Test Steps\n",
|
1275 |
+
"model_test_steps = Sequential([\n",
|
1276 |
+
" LSTM(50, activation='relu', input_shape=(X_train.shape[1], X_train.shape[2]), return_sequences=True),\n",
|
1277 |
+
" TimeDistributed(Dense(X_train.shape[2]))\n",
|
1278 |
+
"])\n",
|
1279 |
+
"\n",
|
1280 |
+
"model_test_steps.compile(optimizer='adam', loss='mse')\n",
|
1281 |
+
"\n",
|
1282 |
+
"# Define the model for Expected Result\n",
|
1283 |
+
"model_expected_result = Sequential([\n",
|
1284 |
+
" LSTM(50, activation='relu', input_shape=(X_train.shape[1], X_train.shape[2]), return_sequences=True),\n",
|
1285 |
+
" TimeDistributed(Dense(X_train.shape[2]))\n",
|
1286 |
+
"])\n",
|
1287 |
+
"\n",
|
1288 |
+
"model_expected_result.compile(optimizer='adam', loss='mse')"
|
1289 |
+
]
|
1290 |
+
},
|
1291 |
+
{
|
1292 |
+
"cell_type": "code",
|
1293 |
+
"execution_count": 19,
|
1294 |
+
"id": "f7e70874",
|
1295 |
+
"metadata": {},
|
1296 |
+
"outputs": [
|
1297 |
+
{
|
1298 |
+
"name": "stdout",
|
1299 |
+
"output_type": "stream",
|
1300 |
+
"text": [
|
1301 |
+
"Epoch 1/10\n",
|
1302 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 533ms/step - loss: 2.2174e-06 - val_loss: 9.4766e-07\n",
|
1303 |
+
"Epoch 2/10\n",
|
1304 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 13ms/step - loss: 1.0551e-06 - val_loss: 6.0476e-07\n",
|
1305 |
+
"Epoch 3/10\n",
|
1306 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 8.6695e-07 - val_loss: 6.1300e-07\n",
|
1307 |
+
"Epoch 4/10\n",
|
1308 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 9.7589e-07 - val_loss: 6.2904e-07\n",
|
1309 |
+
"Epoch 5/10\n",
|
1310 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 1.0319e-06 - val_loss: 6.0141e-07\n",
|
1311 |
+
"Epoch 6/10\n",
|
1312 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 9.9991e-07 - val_loss: 5.6963e-07\n",
|
1313 |
+
"Epoch 7/10\n",
|
1314 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 27ms/step - loss: 9.3908e-07 - val_loss: 5.5550e-07\n",
|
1315 |
+
"Epoch 8/10\n",
|
1316 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 8.8153e-07 - val_loss: 5.5216e-07\n",
|
1317 |
+
"Epoch 9/10\n",
|
1318 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 8.3433e-07 - val_loss: 5.5272e-07\n",
|
1319 |
+
"Epoch 10/10\n",
|
1320 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 8.0194e-07 - val_loss: 5.5084e-07\n",
|
1321 |
+
"Epoch 1/10\n",
|
1322 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 617ms/step - loss: 2.4237e-06 - val_loss: 1.0210e-06\n",
|
1323 |
+
"Epoch 2/10\n",
|
1324 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 1.4453e-06 - val_loss: 8.3659e-07\n",
|
1325 |
+
"Epoch 3/10\n",
|
1326 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 1.2441e-06 - val_loss: 9.3372e-07\n",
|
1327 |
+
"Epoch 4/10\n",
|
1328 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 1.3035e-06 - val_loss: 1.0286e-06\n",
|
1329 |
+
"Epoch 5/10\n",
|
1330 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 1.3807e-06 - val_loss: 1.0422e-06\n",
|
1331 |
+
"Epoch 6/10\n",
|
1332 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step - loss: 1.3993e-06 - val_loss: 9.8222e-07\n",
|
1333 |
+
"Epoch 7/10\n",
|
1334 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 1.3536e-06 - val_loss: 8.9309e-07\n",
|
1335 |
+
"Epoch 8/10\n",
|
1336 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 1.2750e-06 - val_loss: 8.2297e-07\n",
|
1337 |
+
"Epoch 9/10\n",
|
1338 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 15ms/step - loss: 1.2075e-06 - val_loss: 7.9015e-07\n",
|
1339 |
+
"Epoch 10/10\n",
|
1340 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 16ms/step - loss: 1.1735e-06 - val_loss: 7.8403e-07\n"
|
1341 |
+
]
|
1342 |
+
},
|
1343 |
+
{
|
1344 |
+
"data": {
|
1345 |
+
"text/plain": [
|
1346 |
+
"<keras.src.callbacks.history.History at 0x3215e4750>"
|
1347 |
+
]
|
1348 |
+
},
|
1349 |
+
"execution_count": 19,
|
1350 |
+
"metadata": {},
|
1351 |
+
"output_type": "execute_result"
|
1352 |
+
}
|
1353 |
+
],
|
1354 |
+
"source": [
|
1355 |
+
"# Train the model for Test Steps\n",
|
1356 |
+
"model_test_steps.fit(X_train, y_train_test_steps, epochs=10, batch_size=32, validation_split=0.2)\n",
|
1357 |
+
"\n",
|
1358 |
+
"# Train the model for Expected Result\n",
|
1359 |
+
"model_expected_result.fit(X_train, y_train_expected_result, epochs=10, batch_size=32, validation_split=0.2)"
|
1360 |
+
]
|
1361 |
+
},
|
1362 |
+
{
|
1363 |
+
"cell_type": "code",
|
1364 |
+
"execution_count": 20,
|
1365 |
+
"id": "ba6fa0de",
|
1366 |
+
"metadata": {},
|
1367 |
+
"outputs": [
|
1368 |
+
{
|
1369 |
+
"name": "stdout",
|
1370 |
+
"output_type": "stream",
|
1371 |
+
"text": [
|
1372 |
+
"Mean Squared Error for Test Steps: 2.547742951719556e-06\n",
|
1373 |
+
"Mean Squared Error for Expected Result: 1.5647674445062876e-06\n"
|
1374 |
+
]
|
1375 |
+
}
|
1376 |
+
],
|
1377 |
+
"source": [
|
1378 |
+
"mse_test_steps = model_test_steps.evaluate(X_test, y_test_test_steps, verbose=0)\n",
|
1379 |
+
"print(f'Mean Squared Error for Test Steps: {mse_test_steps}')\n",
|
1380 |
+
"\n",
|
1381 |
+
"# Evaluate the model for Expected Result\n",
|
1382 |
+
"mse_expected_result = model_expected_result.evaluate(X_test, y_test_expected_result, verbose=0)\n",
|
1383 |
+
"print(f'Mean Squared Error for Expected Result: {mse_expected_result}')"
|
1384 |
+
]
|
1385 |
+
},
|
1386 |
+
{
|
1387 |
+
"cell_type": "code",
|
1388 |
+
"execution_count": 21,
|
1389 |
+
"id": "b25dda8b",
|
1390 |
+
"metadata": {},
|
1391 |
+
"outputs": [
|
1392 |
+
{
|
1393 |
+
"name": "stdout",
|
1394 |
+
"output_type": "stream",
|
1395 |
+
"text": [
|
1396 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 63ms/step\n",
|
1397 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 46ms/step\n",
|
1398 |
+
"Predicted Test Steps Embeddings: [[[-8.4391527e-04 8.3808292e-04 9.2794985e-04 6.3661160e-04\n",
|
1399 |
+
" 1.4777145e-04 -4.8993941e-04 6.3069363e-04 2.0756002e-03\n",
|
1400 |
+
" -8.7469915e-04 -1.1720757e-03 -6.2859093e-04 -9.6428773e-04\n",
|
1401 |
+
" 1.0144784e-03 -6.3690939e-05 -3.8700749e-04 -7.1150030e-04\n",
|
1402 |
+
" 5.5333151e-04 9.2034061e-05 -1.0463977e-03 -5.2145477e-03\n",
|
1403 |
+
" 8.5559912e-04 -5.3791492e-04 2.6520165e-03 -8.6638553e-04\n",
|
1404 |
+
" -7.5741264e-04 5.9628719e-04 -6.6239189e-04 -8.7471894e-04\n",
|
1405 |
+
" -9.9208625e-04 8.2071731e-04 4.4646338e-04 8.4726338e-04\n",
|
1406 |
+
" 9.5180282e-04 -8.4265345e-04 -5.4202758e-04 1.6481500e-03\n",
|
1407 |
+
" -2.2101693e-04 -9.7025535e-04 -6.7334180e-04 -2.8382645e-03\n",
|
1408 |
+
" 6.2619505e-04 -1.0893656e-03 -8.7078079e-04 -2.0926578e-04\n",
|
1409 |
+
" 8.1423775e-04 8.4379961e-04 -1.6668448e-04 -9.9032815e-04\n",
|
1410 |
+
" 9.5974747e-04 8.5376378e-05 6.4395380e-04 -2.3663426e-03\n",
|
1411 |
+
" -7.3024776e-04 4.5859173e-04 -1.1602787e-03 5.6848535e-04\n",
|
1412 |
+
" 2.6010780e-04 -1.0128880e-03 -2.1443174e-03 -2.6855108e-04\n",
|
1413 |
+
" -4.5336629e-04 6.6400541e-04 8.6696784e-04 -8.9265942e-04\n",
|
1414 |
+
" -2.0976812e-03 8.8741013e-04 1.0340458e-03 9.4049744e-04\n",
|
1415 |
+
" -2.5883170e-03 1.6136141e-03 -9.2293258e-04 8.5503218e-04\n",
|
1416 |
+
" 1.2474646e-03 -1.5019166e-05 9.6433581e-04 2.4179585e-04\n",
|
1417 |
+
" 7.6161108e-05 6.6559250e-04 -2.3543791e-04 1.0006825e-03\n",
|
1418 |
+
" 2.9814860e-04 -7.5365568e-04 -2.1536734e-03 8.8814070e-04\n",
|
1419 |
+
" -1.2573856e-03 -1.0502129e-03 5.2467862e-04 -6.8704574e-04\n",
|
1420 |
+
" 7.3569722e-04 -4.7312939e-04 2.2936910e-03 8.2683226e-04\n",
|
1421 |
+
" 9.9437268e-05 -1.2628101e-04 3.2667362e-03 9.2687435e-04\n",
|
1422 |
+
" 8.7968190e-04 -8.3866203e-04 -8.7905704e-05 -1.0417018e-03]]]\n",
|
1423 |
+
"Predicted Expected Result Embeddings: [[[-6.00951666e-04 -8.71340380e-05 2.10425234e-04 1.77528680e-04\n",
|
1424 |
+
" 8.00210983e-05 -1.85253297e-03 4.65850317e-04 3.56995873e-03\n",
|
1425 |
+
" -8.36861320e-04 -6.41276536e-04 9.27919289e-04 -5.45815798e-04\n",
|
1426 |
+
" -3.05406691e-04 7.55917281e-04 1.03734914e-04 2.38866487e-05\n",
|
1427 |
+
" 7.79760536e-04 -8.88810202e-04 -8.77981714e-04 -2.83502182e-03\n",
|
1428 |
+
" 4.05026833e-04 6.70524372e-04 4.63965582e-04 -7.13920599e-05\n",
|
1429 |
+
" -1.02403646e-04 -8.36344901e-04 -6.75997231e-04 7.48908031e-04\n",
|
1430 |
+
" -1.09156314e-03 7.66666722e-04 1.19300978e-03 -7.83136347e-04\n",
|
1431 |
+
" 8.18963978e-04 -1.27818645e-03 -1.85861718e-03 2.35299161e-03\n",
|
1432 |
+
" 9.13300086e-04 -3.06413101e-04 -1.55945239e-03 -9.19050653e-04\n",
|
1433 |
+
" -5.39628905e-04 -6.51296170e-04 -1.40835065e-04 -4.40066768e-04\n",
|
1434 |
+
" 1.64291263e-03 -9.18515027e-04 -3.14408244e-04 2.30843452e-05\n",
|
1435 |
+
" 6.91586174e-04 6.74205832e-04 -6.55808544e-05 -4.83483251e-04\n",
|
1436 |
+
" -1.72121217e-04 -6.61872444e-04 -8.81674583e-04 -8.80461157e-05\n",
|
1437 |
+
" -5.44943148e-04 1.00790197e-03 -1.34598825e-03 1.66665553e-03\n",
|
1438 |
+
" 3.33746721e-04 8.65762937e-04 8.99292936e-04 -9.54890158e-04\n",
|
1439 |
+
" -5.94305107e-04 9.11348965e-04 2.88407644e-03 7.95712927e-04\n",
|
1440 |
+
" -1.11689197e-03 2.58971867e-03 -6.90977846e-04 2.21353053e-04\n",
|
1441 |
+
" 7.32570188e-05 -5.61508466e-04 8.17475026e-04 9.93824913e-04\n",
|
1442 |
+
" 8.48811760e-04 5.58658561e-04 -8.79892672e-04 -1.04590645e-03\n",
|
1443 |
+
" -6.82677957e-04 8.21857655e-04 -8.91812611e-04 1.62078207e-03\n",
|
1444 |
+
" -1.80392992e-03 2.16952423e-04 3.11806944e-04 5.39015047e-04\n",
|
1445 |
+
" -9.99061740e-08 9.94091504e-04 3.61588714e-03 2.67144089e-04\n",
|
1446 |
+
" -1.72064669e-04 -8.35217419e-04 1.40309369e-03 -4.59492789e-04\n",
|
1447 |
+
" 9.69752960e-04 -8.42938258e-04 -3.16075137e-04 1.21560282e-04]]]\n"
|
1448 |
+
]
|
1449 |
+
}
|
1450 |
+
],
|
1451 |
+
"source": [
|
1452 |
+
"new_acceptance_criteria = df['Acceptance_criteria_embeddings'].tolist()[0]\n",
|
1453 |
+
"new_acceptance_criteria = np.array(new_acceptance_criteria).reshape((1, 1, len(new_acceptance_criteria)))\n",
|
1454 |
+
"\n",
|
1455 |
+
"# Make predictions\n",
|
1456 |
+
"predicted_test_steps = model_test_steps.predict(new_acceptance_criteria)\n",
|
1457 |
+
"predicted_expected_result = model_expected_result.predict(new_acceptance_criteria)\n",
|
1458 |
+
"\n",
|
1459 |
+
"print(f'Predicted Test Steps Embeddings: {predicted_test_steps}')\n",
|
1460 |
+
"print(f'Predicted Expected Result Embeddings: {predicted_expected_result}')"
|
1461 |
+
]
|
1462 |
+
},
|
1463 |
+
{
|
1464 |
+
"cell_type": "code",
|
1465 |
+
"execution_count": 24,
|
1466 |
+
"id": "cf073637",
|
1467 |
+
"metadata": {},
|
1468 |
+
"outputs": [],
|
1469 |
+
"source": [
|
1470 |
+
"mae_test_steps = MeanAbsoluteError()\n",
|
1471 |
+
"mae_expected_result = MeanAbsoluteError()"
|
1472 |
+
]
|
1473 |
+
},
|
1474 |
+
{
|
1475 |
+
"cell_type": "code",
|
1476 |
+
"execution_count": 25,
|
1477 |
+
"id": "d77deaa0",
|
1478 |
+
"metadata": {},
|
1479 |
+
"outputs": [
|
1480 |
+
{
|
1481 |
+
"name": "stdout",
|
1482 |
+
"output_type": "stream",
|
1483 |
+
"text": [
|
1484 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 14ms/step\n",
|
1485 |
+
"\u001b[1m1/1\u001b[0m \u001b[32mββββββββββββββββββββ\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 9ms/step\n",
|
1486 |
+
"Mean Absolute Error for Test Steps: 0.0012983311899006367\n",
|
1487 |
+
"Mean Absolute Error for Expected Result: 0.0009957090951502323\n",
|
1488 |
+
"R-squared for Test Steps: 0.13273363428637874\n",
|
1489 |
+
"R-squared for Expected Result: 0.1580453613077316\n"
|
1490 |
+
]
|
1491 |
+
}
|
1492 |
+
],
|
1493 |
+
"source": [
|
1494 |
+
"y_pred_test_steps = model_test_steps.predict(X_test)\n",
|
1495 |
+
"y_pred_expected_result = model_expected_result.predict(X_test)\n",
|
1496 |
+
"\n",
|
1497 |
+
"# Calculate MAE for Test Steps\n",
|
1498 |
+
"mae_test_steps_value = mae_test_steps(y_test_test_steps, y_pred_test_steps).numpy()\n",
|
1499 |
+
"print(f'Mean Absolute Error for Test Steps: {mae_test_steps_value}')\n",
|
1500 |
+
"\n",
|
1501 |
+
"# Calculate MAE for Expected Result\n",
|
1502 |
+
"mae_expected_result_value = mae_expected_result(y_test_expected_result, y_pred_expected_result).numpy()\n",
|
1503 |
+
"print(f'Mean Absolute Error for Expected Result: {mae_expected_result_value}')\n",
|
1504 |
+
"\n",
|
1505 |
+
"# Calculate R-squared for Test Steps\n",
|
1506 |
+
"r2_test_steps = r2_score(y_test_test_steps.flatten(), y_pred_test_steps.flatten())\n",
|
1507 |
+
"print(f'R-squared for Test Steps: {r2_test_steps}')\n",
|
1508 |
+
"\n",
|
1509 |
+
"# Calculate R-squared for Expected Result\n",
|
1510 |
+
"r2_expected_result = r2_score(y_test_expected_result.flatten(), y_pred_expected_result.flatten())\n",
|
1511 |
+
"print(f'R-squared for Expected Result: {r2_expected_result}')"
|
1512 |
+
]
|
1513 |
+
},
|
1514 |
+
{
|
1515 |
+
"cell_type": "code",
|
1516 |
+
"execution_count": null,
|
1517 |
+
"id": "ea62b59f",
|
1518 |
+
"metadata": {},
|
1519 |
+
"outputs": [],
|
1520 |
+
"source": []
|
1521 |
+
}
|
1522 |
+
],
|
1523 |
+
"metadata": {
|
1524 |
+
"kernelspec": {
|
1525 |
+
"display_name": "Python 3 (ipykernel)",
|
1526 |
+
"language": "python",
|
1527 |
+
"name": "python3"
|
1528 |
+
},
|
1529 |
+
"language_info": {
|
1530 |
+
"codemirror_mode": {
|
1531 |
+
"name": "ipython",
|
1532 |
+
"version": 3
|
1533 |
+
},
|
1534 |
+
"file_extension": ".py",
|
1535 |
+
"mimetype": "text/x-python",
|
1536 |
+
"name": "python",
|
1537 |
+
"nbconvert_exporter": "python",
|
1538 |
+
"pygments_lexer": "ipython3",
|
1539 |
+
"version": "3.11.5"
|
1540 |
+
}
|
1541 |
+
},
|
1542 |
+
"nbformat": 4,
|
1543 |
+
"nbformat_minor": 5
|
1544 |
+
}
|
model_expected_result.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ee100706f6b0dbe1210944b92e6ec17edbee4d8876c006ea730bbf4e5d627435
|
3 |
+
size 452632
|
model_test_steps.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8b00a6397c7000ff46f63afeb41675a64fe1c319abae9459cace8deea528d8f7
|
3 |
+
size 453080
|
word2vec_model (1).bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:09880657bc9da02e6aa6d8d2adfd483516a1f2e3e677c8e5bb6dc0d5e80f6f14
|
3 |
+
size 272565
|