📄 النص الكامل للصفحة
# load the train and testing data.
imdb_train_reviews=pd.read_csv('imdb_data/imdb_train.csv')
imdb_test_reviews=pd.read_csv('imdb_data/imdb_test.csv')
imdb_train_reviews
وكما يتضح في الشكل 3.3، فإن
مجموعة بيانات DataFrame
تحتوي على عمودين:
• نص التقييم.
• القيم (الصنف).
القيمة 0 تمثل تقييمًا سلبيًا
بينما القيمة 1 تمثل تقييمًا إيجابيًا.
الخطوة التالية هي إسناد أعمدة النص والقيم إلى متغيرات مستقلة في أمثلة التدريب والاختبار الممثلة كمجموعة
بيانات DataFrame كما يلي:
يُستخدم الرمزان X و Y عادة في
التعلم الموجه فيعبر X عن البيانات
المدخلة للتنبؤ، و Y عن القيم
المستهدفة.
# extract the text from the 'text' column for both training and testing.
X_train_text=imdb_train_reviews['text']
X_test_text=imdb_test_reviews['text']
# extract the labels from the 'label' column for both training and testing.
Y_train=imdb_train_reviews['label']
Y_test=imdb_test_reviews['label']
X_train_text # training data in text format
شكل 3.3: مجموعة بيانات التدريب المعنونة
شكل 3.4: صورة من أمثلة التدريب (X_train_text) من مجموعة بيانات DataFrame
وزارة التعليم
Ministry of Education
2023 - 1447
136
--- VISUAL CONTEXT ---
**TABLE**: شكل 3.3: مجموعة بيانات التدريب المعنونة
Description: A Pandas DataFrame displaying movie review text and corresponding sentiment labels. It shows the first 5 and last 5 rows of a dataset with 40,000 entries.
Table Structure:
Headers: text | label
Rows:
Row 1: I grew up (b. 1965) watching and loving the Th... | 0
Row 2: When I put this movie in my DVD player, and sa... | 0
Row 3: Why do people who do not know what a particula... | 0
Row 4: Even though I have great interest in Biblical ... | 0
Row 5: Im a die hard Dads Army fan and nothing will e... | 1
Row 6: ... | ...
Row 7: "Western Union" is something of a forgotten cl... | 1
Row 8: This movie is an incredible piece of work. It ... | 1
Row 9: My wife and I watched this movie because we pl... | 0
Row 10: When I first watched Flatliners, I was amazed.... | 1
Row 11: Why would this film be so good, but only gross... | 1
Data: The DataFrame has two columns: 'text' containing movie review strings and 'label' containing binary sentiment indicators (0 or 1).
Key Values: 40000 rows × 2 columns
Context: This DataFrame serves as an example of a labeled dataset used in machine learning for tasks like sentiment analysis, where text input is associated with a target output (sentiment label).
**DIAGRAM**: Untitled
Description: A flow diagram illustrating the mapping of numerical labels to sentiment categories. An arrow connects 'label: 1' from the DataFrame to a blue oval labeled 'تقييم إيجابي' (Positive review). Another arrow connects 'label: 0' to a blue oval labeled 'تقييم سلبي' (Negative review).
Key Values: تقييم إيجابي, تقييم سلبي
Context: This diagram clarifies the meaning of the binary labels (0 and 1) used in the dataset, which represent negative and positive sentiment respectively, crucial for understanding the sentiment analysis task.
**TABLE**: شكل 3.4: صورة من أمثلة التدريب (X_train_text) من مجموعة بيانات DataFrame
Description: A Pandas Series representing the 'text' column extracted from the imdb_train_reviews DataFrame. It shows the index and the review text, along with metadata about the Series.
Table Structure:
Headers: N/A
Rows:
Row 1: 0 I grew up (b. 1965) watching and loving the Th...
Row 2: 1 When I put this movie in my DVD player, and sa...
Row 3: 2 Why do people who do not know what a particula...
Row 4: 3 Even though I have great interest in Biblical ...
Row 5: 4 Im a die hard Dads Army fan and nothing will e...
Row 6: ...
Row 7: 39995 "Western Union" is something of a forgotten cl...
Row 8: 39996 This movie is an incredible piece of work. It ...
Row 9: 39997 My wife and I watched this movie because we pl...
Row 10: 39998 When I first watched Flatliners, I was amazed....
Row 11: 39999 Why would this film be so good, but only gross...
Data: The Series contains 40,000 entries of type 'object' (strings), representing the movie review texts.
Key Values: Name: text, Length: 40000, dtype: object
Context: This visual demonstrates the extraction of a specific feature (the text content) from the main dataset to be used as the independent variable (X) in a supervised machine learning model.
🎴 بطاقات تعليمية للمراجعة
عدد البطاقات: 5 بطاقة لهذه الصفحة
ما هو الغرض من تحميل مجموعتي بيانات imdb_train_reviews و imdb_test_reviews؟
الإجابة: يتم تحميل مجموعتي البيانات لتحليل مشاعر تقييمات الأفلام (sentiment analysis)، حيث تحتويان على نصوص التقييمات والقيم المصنفة (إيجابية أو سلبية).
الشرح: الغرض من تحميل هذه البيانات هو استخدامها كمدخلات لنموذج تعلم آلي لتدريبه على التمييز بين التقييمات الإيجابية والسلبية للأفلام.
تلميح: فكر في الغرض الأساسي من استخدام بيانات التقييم في مجال التعلم الآلي.
ما هي الأعمدة المتوفرة في مجموعة بيانات DataFrame عند تحميل ملفات CSV؟
الإجابة: تحتوي مجموعة بيانات DataFrame على عمودين رئيسيين: 'text' (نص التقييم) و 'label' (القيمة المصنفة للتقييم).
الشرح: العمود 'text' يحمل نص التقييم الذي سيتم تحليله، والعمود 'label' يحمل القيمة التي تمثل إيجابية (1) أو سلبية (0) هذا التقييم.
تلميح: ما هي المعلومات التي تمثل كل صف في البيانات؟
ماذا تمثل القيمة '0' والقيمة '1' في عمود 'label'؟
الإجابة: القيمة '0' تمثل تقييمًا سلبيًا، بينما القيمة '1' تمثل تقييمًا إيجابيًا.
الشرح: هذه القيم تستخدم لتمثيل المشاعر المرتبطة بكل تقييم، حيث '0' للسلبية و '1' للإيجابية، وهي أساس عملية التصنيف في التعلم الموجه.
تلميح: فكر في العلاقة بين الأرقام وما تعبر عنه في سياق تقييمات الأفلام.
لماذا يُستخدم الرمزان X و Y في التعلم الموجه؟ وماذا يمثل كل منهما؟
الإجابة: يُستخدم الرمزان X و Y في التعلم الموجه حيث يمثل X البيانات المدخلة للتنبؤ (مثل نصوص التقييمات)، ويمثل Y القيم المستهدفة أو التصنيفات (مثل كون التقييم إيجابيًا أو سلبيًا).
الشرح: X هي المتغيرات المستقلة التي يستخدمها النموذج للتعلم، و Y هي المتغيرات التابعة التي يحاول النموذج التنبؤ بها بناءً على X.
تلميح: ما هو الدور الذي تلعبه البيانات في عملية التنبؤ؟ وما هو الهدف النهائي؟
ما هي البيانات التي يتم استخلاصها في الخطوات التالية بعد تحميل البيانات؟
الإجابة: يتم استخلاص أعمدة النص ('text') والقيم ('label') من مجموعتي بيانات التدريب والاختبار وتعيينها لمتغيرات مستقلة (X) وقيم مستهدفة (Y).
الشرح: عملية استخلاص هذه الأعمدة تجهز البيانات بالشكل المطلوب لتغذيتها لنماذج التعلم الآلي، حيث يتم فصل مدخلات التدريب (X) عن مخرجاتها المستهدفة (Y).
تلميح: ما هي الأجزاء الأساسية من البيانات التي نحتاجها لتدريب النموذج؟