Thuta Learning
ရှာဖွေရန်
ProjectsData & Databasesintermediate

Student Score Project - Part 3: Final Report

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Student Score Project - Part 3: Final Report ကို လက်တွေ့ project ထဲမှာ အသုံးချတတ်မယ်
  • ကိုယ်တိုင် code ရေးပြီး run ကြည့်တတ်မယ်
  • Project တစ်ခုလုံးကို အဆင့်လိုက် ဆောက်တတ်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

ဒီနောက်ဆုံးအဆင့်မှာ Part 2 ရဲ့ curved_scores ကို base ယူပြီး subject weight (Math ကို weight ပိုပေး) နဲ့ weighted final score ကို np.dot() matrix multiplication နဲ့ တွက်ပါမယ်။ ပြီးရင် np.random.seed() နဲ့ reproducible random bonus quiz score တစ်ခု generate လုပ်ပြီး final score ပေါ်ထပ်ပေါင်းပါမယ်။ နောက်ဆုံး np.argsort() သုံးပြီး student တွေကို score အမြင့်ဆုံးကနေ အနိမ့်ဆုံး rank ချပြီး, print formatting နဲ့ final report table တစ်ခု ထုတ်ပြီး project ကို ပြီးမြောက်ပါမယ်။ ဒီအဆင့်က tutorial တစ်လျှောက် သင်ခဲ့တဲ့ array creation, indexing, aggregation, broadcasting, linear algebra, random module အားလုံးကို တစ်နေရာတည်းမှာ ပေါင်းစပ်သုံးကြည့်တာဖြစ်ပါတယ်။

လက်တွေ့ ဆောက်ကြည့်မယ်

weight array (Math 0.3, Myanmar 0.2, English 0.2, Science 0.3) ကို ဖန်တီးပြီး np.dot(curved_scores, weights) နဲ့ student တိုင်းရဲ့ weighted final score ကို တွက်ပါ။ np.random.seed(42) ဖြင့် seed ချပြီး np.random.randint(0, 10, size=5) နဲ့ student 5 ယောက်အတွက် random bonus quiz score generate လုပ်ပါ။ final_score = weighted_score + bonus ကို တွက်ပြီး, np.argsort(final_score)[::-1] နဲ့ rank order (အမြင့်ဆုံးအရင်) ကို ရှာပါ။ for loop ဖြင့် rank အလိုက် student name, final score ကို formatted string နဲ့ print ထုတ်ပြီး final report ပြီးအောင်လုပ်ပါ။

Code နမူနာ

python
import numpy as np

students = ["Aye", "Bo", "Cho", "Dan", "Eaint"]

curved_scores = np.array([
    [80, 90, 90, 75],
    [66, 75, 58, 83],
    [97, 93, 92, 94],
    [52, 65, 55, 51],
    [84, 84, 84, 91]
])

weights = np.array([0.3, 0.2, 0.2, 0.3])
weighted_score = np.dot(curved_scores, weights)

np.random.seed(42)
bonus = np.random.randint(0, 10, size=5)

final_score = weighted_score + bonus

# rank: highest final_score first
rank_order = np.argsort(final_score)[::-1]

print("=== Final Report ===")
for rank, idx in enumerate(rank_order, start=1):
    print(f"{rank}. {students[idx]:<6} weighted={weighted_score[idx]:.1f} bonus={bonus[idx]} final={final_score[idx]:.1f}")
You should see
=== Final Report === label အောက်မှာ student 5 ယောက်ကို final_score အမြင့်ဆုံးကနေ rank 1 to 5 order နဲ့ weighted, bonus, final score တန်ဖိုးတွေနဲ့ formatted line 5 ကြောင်း ထွက်ပါလိမ့်မယ်။

၅ မိနစ် စမ်းကြည့်

weight array ကို Science ကို weight ပိုပေးတဲ့ [0.2, 0.2, 0.2, 0.4] အသစ်နဲ့ ပြောင်းပြီး rank order ပြောင်းလဲသွားလား စစ်ကြည့်ပါ (5 minutes)။

သတိလေးတစ်ချက်

np.dot(matrix, vector) အတွက် vector ရဲ့ length က matrix ရဲ့ column count နဲ့ တူမှ ရပါမယ် - subject count ပြောင်းတိုင်း weights array length ကိုပါ update လုပ်ဖို့ မမေ့ပါနဲ့။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • np.dot() အတွက် weights vector length ကို scores column count (subject count) နဲ့ မကိုက်အောင်ရေးမိပြီး shape mismatch error တက်တာ
  • np.random.seed() ကို မချဘဲ run တိုင်း bonus value ပြောင်းနေလို့ report result reproducible မဖြစ်တာ

အခု ကိုယ်တိုင် စမ်းကြည့်

weight array ကို Science ကို weight ပိုပေးတဲ့ [0.2, 0.2, 0.2, 0.4] အသစ်နဲ့ ပြောင်းပြီး rank order ပြောင်းလဲသွားလား စစ်ကြည့်ပါ (5 minutes)။

You'll know it worked when: === Final Report === label အောက်မှာ student 5 ယောက်ကို final_score အမြင့်ဆုံးကနေ rank 1 to 5 order နဲ့ weighted, bonus, final score တန်ဖိုးတွေနဲ့ formatted line 5 ကြောင်း ထွက်ပါလိမ့်မယ်။

Student Score Project - Part 3: Final Report | Thuta Learning