Uploaded by opbbqplnenyhrhyvkg

CI002 HW1

advertisement
‫ﺩﺍﻧﺸﻜﺪﻩ ﻣﻬﻨﺪﺳﻲ ﻛﺎﻣﭙﻴﻮﺗﺮ‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﺯﻣﺴﺘﺎﻥ ‪۱۴۰۰‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫ﭘﺮﺳﭙﺘﺮﻭﻥ ﻭ ﺷﺒﻜﻪﻫﺎﻱ ﻋﺼﺒﻲ ﭼﻨﺪﻻﻳﻪ‬
‫ﺍﺳﺘﺎﺩ ﺩﺭﺱ ‪ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .‬ﺩﻛﺘﺮ ﻣﺰﻳﻨﻲ‬
‫ﻃﺮﺍﺣﻲ ﻭ ﺗﺪﻭﻳﻦ ‪ . . . . . . . . . . . . . . . .‬ﻣﺤﻤﺪﺣﺴﻴﻦ ﻛﺮﻳﻤﻴﺎﻥ ‪ -‬ﺁﺭﻣﺎﻥ ﺣﻴﺪﺭﻱ‬
‫ﺗﺎﺭﻳﺦ ﺍﻧﺘﺸﺎﺭ ‪ ۸ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .‬ﺍﺳﻔﻨﺪ ‪۱۴۰۰‬‬
‫ﺗﺎﺭﻳﺦ ﺗﺤﻮﻳﻞ ‪ ۲۲ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .‬ﺍﺳﻔﻨﺪ ‪۱۴۰۰‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﻗﻮﺍﻧﻴﻦ‬
‫‪ .۱‬ﺍﻧﺠﺎﻡ ﺗﻤﺮﻳﻦ ﺑﻪ ﺻﻮﺭﺕ ﺍﻧﻔﺮﺍﺩﻱ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺩﺭ ﺻﻮﺭﺕ ﻣﺸﺎﻫﺪﻩ ﻫﺮﮔﻮﻧﻪ ﺗﻘﻠﺐ ﻳﺎ ﻛﭙﻲ ﺍﺯ ﺍﻳﻨﺘﺮﻧﺖ‪،‬‬
‫ﻧﻤﺮﻩ ﺳﻮﺍﻝ ﺑﺮﺍﻱ ﻫﺮ ﺩﻭ ﻧﻔﺮ ‪ ۰‬ﻣﻨﻈﻮﺭ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬
‫‪ .۲‬ﺗﺤﻮﻳﻞ ﺗﻤﺮﻳﻦ ﺍﺯ ﻃﺮﻳﻖ ﺳﺎﻳﺖ ‪ Gradescope‬ﺧﻮﺍﻫﺪ ﺑﻮﺩ‪ .‬ﻟﻄﻔﺎ ﭘﺲ ﺍﺯ ﺛﺒﺖ ﻧﺎﻡ ﺑﺎ ﻛﺪ ﺫﻛﺮ ﺷﺪﻩ‬
‫ﻭﺍﺭﺩ ﻛﻼﺱ ﺷﻮﻳﺪ‪RWJJYZ .‬‬
‫‪ .۳‬ﺩﺭ ﻃﻮﻝ ﺗﺮﻡ ﻣﺠﺎﺯ ﺑﻪ ‪ ۷‬ﺭﻭﺯ ﺗﺎﺧﻴﺮ ﻫﺴﺘﻴﺪ ﻛﻪ ﺑﻪ ﺻﻮﺭﺕ ﺩﻗﻴﻘﻪﺍﻱ ﻣﺤﺎﺳﺒﻪ ﺧﻮﺍﻫﺪ ﺷﺪ‪ .‬ﺍﮔﺮ ﺗﻤﺮﻳﻨﻲ‬
‫ﺑﻌﺪ ﺍﺯ ﺩﺩﻻﻳﻦ ﻓﺮﺳﺘﺎﺩﻩ ﺷﻮﺩ ﻭ ‪ ۷‬ﺭﻭﺯ ﺣﻖ ﺗﺎﺧﻴﺮ ﻫﻢ ﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ ﺑﺎﺷﺪ ﻧﻤﺮﻩ ﺁﻥ ﺗﻤﺮﻳﻦ ﺭﺍ ﻛﺎﻣﻼ‬
‫ﺍﺯ ﺩﺳﺖ ﺧﻮﺍﻫﻴﺪ ﺩﺍﺩ‪ .‬ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻦ ﻣﻜﺎﻧﻴﺰﻡ ﺗﺎﺧﻴﺮ ﻫﻴﭻ ﺗﻤﺮﻳﻨﻲ ﺗﻤﺪﻳﺪ ﻧﺨﻮﺍﻫﺪ ﺷﺪ‪.‬‬
‫‪ .۴‬ﻓﺎﻳﻞ ﮔﺰﺍﺭﺵ ﺍﺭﺳﺎﻟﻲ ﺣﺘﻤﺎ ﺑﺎﻳﺪ ﺑﻪ ﺻﻮﺭﺕ ﺗﺎﻳﭗ ﺷﺪﻩ ﺑﺎﺷﺪ‪.‬‬
‫‪ .۵‬ﭘﻴﺸﻨﻬﺎﺩ ﻣﻲﺷﻮﺩ ﺟﻬﺖ ﺍﻧﺠﺎﻡ ﺗﻤﺮﻳﻦ ﺍﺯ ﻣﺤﻴﻂ ﻛﻮﻟﺐ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪.‬‬
‫‪ .۶‬ﺟﻬﺖ ﺗﺤﻮﻳﻞ ﺗﻤﺮﻳﻦ ﻋﻤﻠﻲ ﻗﺒﻞ ﺍﺯ ﺁﭘﻠﻮﺩ ﻛﺪ‪ ،‬ﺗﻤﺎﻡ ﺳﻠﻮﻝﻫﺎﻱ ‪ Notebook‬ﺭﺍ ﺩﻭﺑﺎﺭﻩ ‪Run‬‬
‫ﻛﻨﻴﺪ‪ .‬ﻫﻤﭽﻨﻴﻦ ﺧﺮﻭﺟﻲ ﺑﺎﻳﺪ ﺷﺎﻣﻞ ﺗﻤﺎﻡ ﻣﺮﺍﺣﻞ ﺧﻮﺍﺳﺘﻪ ﺷﺪﻩ ﺩﺭ ﺻﻮﺭﺕ ﺳﻮﺍﻝ ﺑﺎﺷﺪ‪.‬‬
‫‪ .۷‬ﻫﺮ ﺗﻤﺮﻳﻦ ﺷﺎﻣﻞ ﺳﻪ ﻧﻮﻉ ﺳﻮﺍﻝ ﺗﺸﺮﻳﺤﻲ‪ ،‬ﻋﻤﻠﻲ ﻭ ﺗﺮﻛﻴﺒﻲ ﺍﺳﺖ‪ .‬ﺩﺭ ﮔﺰﺍﺭﺵ ﺍﺭﺳﺎﻟﻲ ﺧﻮﺩ ﺑﺎﻳﺴﺘﻲ‬
‫ﺑﻪ ﺗﻤﺎﻡ ﺳﻮﺍﻻﺕ ﺗﺸﺮﻳﺤﻲ ﭘﺎﺳﺦ ﺩﻫﻴﺪ‪ ،‬ﻧﺘﺎﻳﺞ ﺑﻪ ﺩﺳﺖ ﺁﻣﺪﻩ ﺭﺍ ﺫﻛﺮ ﻭ ﺗﺤﻠﻴﻞ ﻛﻨﻴﺪ‪.‬‬
‫‪ .۸‬ﺑﺨﺸﻲ ﺍﺯ ﻧﻤﺮﻩ ﻫﺮ ﺳﻮﺍﻝ ﻋﻤﻠﻲ ﻣﺮﺑﻮﻁ ﺑﻪ ﺗﻮﺿﻴﺤﺎﺕ ﻭ ﮔﺰﺍﺭﺵ ﻛﺪ ﺁﻥ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺗﻮﺿﻴﺤﺎﺕ ﺩﺭ‬
‫ﻗﺎﻟﺐ ‪ Note‬ﺩﺭ ﺳﻠﻮﻝ ‪ Notebook‬ﺍﺿﺎﻓﻪ ﺷﻮﺩ ﻭ ﺷﺎﻣﻞ ﻭﺭﻭﺩﻱ ﻭ ﺧﺮﻭﺟﻲ‪ ،‬ﻧﺤﻮﻩ ﻋﻤﻠﻜﺮﺩ ﺗﻮﺍﺑﻊ‬
‫ﻭ ﻣﺮﺍﺣﻞ ﻣﻬﻢ ﺍﻟﮕﻮﺭﻳﺘﻢ ﻣﻲﺑﺎﺷﺪ‪ .‬ﻻﺯﻡ ﻧﻴﺴﺖ ﺍﻳﻦ ﺗﻮﺿﻴﺤﺎﺕ ﺩﺭ ﻓﺎﻳﻞ ﮔﺰﺍﺭﺵ ﺫﻛﺮ ﺷﻮﺩ‪.‬‬
‫‪ .۹‬ﺭﻳﺰ ﻧﻤﺮﺍﺕ ﻫﺮ ﺳﻮﺍﻝ ﺭﺍ ﻣﻲﺗﻮﺍﻧﻴﺪ ﺍﺯ ﺳﺎﻳﺖ ﮔﺮﻳﺪ ﺍﺳﻜﻮﭖ ﻣﺸﺎﻫﺪﻩ ﻧﻤﺎﻳﻴﺪ‪.‬‬
‫‪ .۱۰‬ﺳﻮﺍﻻﺕ ﺧﻮﺩ ﺭﺍ ﺍﺯ ﻃﺮﻳﻖ ﮔﺮﻭﻩ ﺗﻠﮕﺮﺍﻡ ﻣﻄﺮﺡ ﻛﻨﻴﺪ‪.‬‬
‫‪۱‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﻧﻜﺎﺕ‬
‫‪ .۱‬ﻣﺤﺎﺳﺒﺎﺕ ﺑﻪ ﺻﻮﺭﺕ ﻛﺎﻣﻼ ‪ Vectorize‬ﺑﺎﺷﺪ‪ .‬ﺗﻨﻬﺎ ﺩﺭ ‪ Epoch‬ﻭ ‪ Batch‬ﻫﺎ ﻣﻲﺗﻮﺍﻧﻴﺪ ﺍﺯ ﺣﻠﻘﻪ‬
‫‪ For‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪ .‬ﺩﺭ ﻏﻴﺮ ﺍﻳﻦ ﺻﻮﺭﺕ ﺳﺮﻋﺖ ﺍﺟﺮﺍﻱ ﺑﺮﻧﺎﻣﻪ ﺷﻤﺎ ﺑﺴﻴﺎﺭ ﻛﻢ ﺧﻮﺍﻫﺪ ﺑﻮﺩ‪.‬‬
‫‪ .۲‬ﺩﺭ ﭘﺎﻳﺎﻥ ﻫﺮ ‪ Epoch‬ﻣﻘﺎﺩﻳﺮ ﺩﻗﺖ ﻭ ﺧﻄﺎﻱ ﺷﺒﻜﻪ ﺭﺍ ﮔﺰﺍﺭﺵ ﻛﻨﻴﺪ ﻭ ﺩﺭ ﺍﻧﺘﻬﺎ ﻧﻤﻮﺩﺍﺭ ﺁﻥﻫﺎ ﺭﺍ ﺭﺳﻢ‬
‫ﻛﻨﻴﺪ‪.‬‬
‫‪ .۳‬ﺑﺮﺍﻱ ﺗﺮﺳﻴﻢ ﻧﻤﻮﺩﺍﺭﻫﺎ ﻣﻲﺗﻮﺍﻧﻴﺪ ﺍﺯ ﻛﺘﺎﺏﺧﺎﻧﻪ ‪ matplotlib‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪.‬‬
‫‪ .۴‬ﻫﺎﻳﭙﺮﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺷﺒﻜﻪ ﺑﻪ ﺻﻮﺭﺕ ﺁﺭﮔﻮﻣﺎﻥ ﻭﺭﻭﺩﻱ ﻗﺎﺑﻞ ﺗﻨﻈﻴﻢ ﺷﺪﻥ ﺑﺎﺷﻨﺪ‪(Epochs, .‬‬
‫)‪Batch Size, Learning Rate, ...‬‬
‫‪ .۵‬ﺑﺨﺸﻲ ﺍﺯ ﻧﻤﺮﻩ ﺍﻳﻦ ﺗﻤﺮﻳﻦ ﻣﺮﺑﻮﻁ ﺑﻪ ﺩﻗﺖ‪ ،‬ﺧﻄﺎ ﻭ ﺳﺮﻋﺖ ﻣﻨﺎﺳﺐ ﻣﻲﺑﺎﺷﺪ‪ .‬ﭘﺲ ﺩﺭ ﺍﻧﺘﺨﺎﺏ‬
‫ﻫﺎﻳﭙﺮﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺷﺒﻜﻪ ﺩﻗﺖ ﻛﻨﻴﺪ‪.‬‬
‫‪ .۶‬ﺩﺭ ﺻﻮﺭﺕ ﻧﻴﺎﺯ ﺩﺍﺩﻩﻫﺎﻱ ﻭﺭﻭﺩﻱ ﺭﺍ ﻗﺒﻞ ﺍﺯ ‪ Feed‬ﺷﺪﻥ ﺑﻪ ﺷﺒﻜﻪ ﻧﺮﻣﺎﻝ ﻛﻨﻴﺪ‪.‬‬
‫ﻣﻮﻓﻖ ﺑﺎﺷﻴﺪ‪.‬‬
‫‪۲‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫‪۱‬‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﺳﻮﺍﻝ ﺗﺸﺮﻳﺤﻲ )‪ ۲۰) - (Backpropagation‬ﻧﻤﺮﻩ(‬
‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪ ، Back-Propagation‬ﺍﻟﮕﻮﻫﺎﻱ ﻭﺭﻭﺩﻱ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺩﺭ ﺷﻜﻞ ﺯﻳﺮ‬
‫ﺭﺍ ﺩﺳﺘﻪ ﺑﻨﺪﻱ ﻛﻨﻴﺪ‪.‬‬
‫ﺷﻜﻞ ‪ :۱‬ﺩﺳﺘﻪ ﺑﻨﺪﻱ ﺍﻟﮕﻮ‬
‫ﺩﺭ ﺩﺳﺘﻪ ﺑﻨﺪﻱ ﺧﻮﺩ ﺑﻪ ﻣﻮﺍﺭﺩ ﺯﻳﺮ ﺗﻮﺟﻪ ﻛﻨﻴﺪ‪:‬‬
‫• ﺍﺯ ﻳﻚ ‪ MLP‬ﻛﻪ ﺩﺍﺭﺍﻱ ﻳﻚ ﻻﻳﻪ ﻣﻴﺎﻧﻲ ﺑﺎ ﺳﻪ ﻧﻮﺭﻭﻥ ﺍﺳﺖ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪.‬‬
‫• ﺑﺮﺍﻱ ﻻﻳﻪ ﻣﻴﺎﻧﻲ ﺍﺯ ﺗﺎﺑﻊ ﻓﻌﺎﻝ ﺳﺎﺯﻱ ‪ ReLU‬ﻭ ﺩﺭ ﻻﻳﻪ ﺁﺧﺮ ﺍﺯ ﺗﺎﺑﻊ ﻓﻌﺎﻝ ﺳﺎﺯﻱ ‪Sigmoid‬‬
‫ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪.‬‬
‫• ﺳﺎﺧﺘﺎﺭ ﺷﺒﻜﻪ ﺭﺍ ﺭﺳﻢ ﻛﻨﻴﺪ‪.‬‬
‫• ﻛﻠﻴﻪ ﻣﺤﺎﺳﺒﺎﺕ ﺭﻳﺎﺿﻲ ﻭ ﻋﻤﻠﻴﺎﺕﻫﺎﻱ ‪ forward-pass‬ﻭ ‪ backward-pass‬ﺭﺍ ﺩﺭ ﻫﺮ ﻣﺮﺣﻠﻪ‬
‫ﺑﻨﻮﻳﺴﻴﺪ‪.‬‬
‫ﺁﻳﺎ ﺍﻳﻦ ﻣﺴﺌﻠﻪ ﺑﺎ ﺷﺒﻜﻪ ‪ Adaline‬ﻗﺎﺑﻞ ﺣﻞ ﺍﺳﺖ؟ ﺗﻮﺿﻴﺢ ﺩﻫﻴﺪ‪.‬‬
‫‪۳‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫‪۲‬‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﭘﺮﺳﭙﺘﺮﻭﻥ ﭼﻨﺪ ﻻﻳﻪ )‪ ۴۰) - (MLP‬ﻧﻤﺮﻩ(‬
‫ﺩﺭ ﺍﻳﻦ ﺳﻮﺍﻝ ﺑﺎﻳﺪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﺘﺎﺑﺨﺎﻧﻪ ‪ NumPy‬ﻳﻚ ﭘﺮﺳﭙﺘﺮﻭﻥ ﭼﻨﺪ ﻻﻳﻪ ﺑﺮﺍﻱ ﻣﺠﻤﻮﻋﻪ ﺩﺍﺩﻩ‬
‫ﺯﻳﺮ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﻛﻨﻴﺪ‪ .‬ﺍﻳﻦ ﻣﺠﻤﻮﻋﻪ ﺩﺍﺩﻩ ﺩﺭ ﻧﻮﺗﺒﻮﻙ ﺗﻤﺮﻳﻦ ﻣﻮﺟﻮﺩ ﺍﺳﺖ ﻛﻪ ﺷﺎﻣﻞ ﻳﻚ ﺁﺭﺍﻳﻪ ﺩﻭ ﺑﻌﺪﻱ‬
‫ﺍﺳﺖ ﻛﻪ ﺑﻴﺎﻧﮕﺮ ﻣﺨﺘﺼﺎﺕ ﻧﻘﺎﻁ ﺍﺳﺖ‪.‬‬
‫ﺷﻜﻞ ‪ :۲‬ﺩﻳﺘﺎﺳﺖ‬
‫ﺩﺭ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺧﻮﺩ ﻧﻜﺎﺕ ﺯﻳﺮ ﺭﺍ ﺭﻋﺎﻳﺖ ﻛﻨﻴﺪ‪:‬‬
‫‪ .۱‬ﺗﻌﺪﺍﺩ ﻻﻳﻪﻫﺎ‪ ،‬ﺗﻌﺪﺍﺩ ﻧﻮﺭﻭﻥ ﺩﺭ ﻫﺮ ﻻﻳﻪ ﻭ ‪ Learning Rate‬ﺭﺍ ﺑﺘﻮﺍﻥ ﺑﻪ ﻃﻮﺭ ﺩﻟﺨﻮﺍﻩ ﺗﻌﻴﻴﻦ ﻛﺮﺩ‪.‬‬
‫ﺑﺮﺍﻱ ﺍﻳﻦ ﻛﺎﺭ ﻣﻲﺗﻮﺍﻧﻴﺪ ﻛﺪ ﺭﺍ ﺩﺍﺧﻞ ﺗﺎﺑﻌﻲ ﺑﺰﻧﻴﺪ ﻛﻪ ﻋﻼﻭﻩ ﺑﺮ ‪ Epoch‬ﻭ ‪Learning Rate‬‬
‫ﺁﺭﺍﻳﻪﺍﻱ ﺭﺍ ﺩﺭ ﻭﺭﻭﺩﻱ ﺧﻮﺩ ﺑﮕﻴﺮﺩ ﻛﻪ ﻃﻮﻝ ﺁﺭﺍﻳﻪ ﺑﺮﺍﺑﺮ ﺗﻌﺪﺍﺩ ﻻﻳﻪﻫﺎ ﻭ ﻣﻘﺪﺍﺭ ﻫﺮ ﻋﻀﻮ ﺁﺭﺍﻳﻪ ﺑﺮﺍﺑﺮ‬
‫ﺗﻌﺪﺍﺩ ﻧﻮﺭﻭﻥﻫﺎ ﺩﺭ ﺁﻥ ﻻﻳﻪ ﺑﺎﺷﺪ‪.‬‬
‫‪ .۲‬ﺩﺭ ﭘﺎﻳﺎﻥ ﻛﺎﺭ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ matplotlib‬ﻧﻤﻮﺩﺍﺭ ﺗﻮﺍﺑﻊ ‪ Loss‬ﻭ ‪ Accuracy‬ﺭﺍ ﺭﺳﻢ ﻛﻨﻴﺪ‪.‬‬
‫‪ .۳‬ﻧﺎﺣﻴﻪ ﺑﻨﺪﻱ ﺍﻧﺠﺎﻡ ﺷﺪﻩ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ﺗﺎﻥ ﺭﺍ ﺭﺳﻢ ﻛﻨﻴﺪ‪(Decision Boundary) .‬‬
‫‪ .۴‬ﺑﺎ ﺍﻣﺘﺤﺎﻥ ﻛﺮﺩﻥ ﻣﻘﺎﺩﻳﺮ ﻣﺨﺘﻠﻒ ﺑﺮﺍﻱ ﺗﻌﺪﺍﺩ ﻻﻳﻪﻫﺎ ﻭ ﺗﻌﺪﺍﺩ ﻧﻮﺭﻭﻥﻫﺎﻱ ﻫﺮ ﻻﻳﻪ‪ ،‬ﺑﻴﺎﻥ ﻛﻨﻴﺪ ﻛﻪ‬
‫ﺍﮔﺮ ﺍﻳﻦ ﺗﻌﺪﺍﺩ ﺯﻳﺎﺩ ﺑﺎﺷﺪ ﭼﻪ ﻣﺸﻜﻠﻲ ﺑﻪ ﻭﺟﻮﺩ ﻣﻲﺁﻳﺪ‪ .‬ﻧﺘﺎﻳﺞ ﺧﻮﺩ ﺭﺍ ﺩﺭ ‪ Report‬ﺗﻤﺮﻳﻦ ﺫﻛﺮ ﻭ‬
‫ﺗﺤﻠﻴﻞ ﻛﻨﻴﺪ‪.‬‬
‫‪۴‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫‪ ۲۵) - Keras ۳‬ﻧﻤﺮﻩ(‬
‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﺘﺎﺏﺧﺎﻧﻪ ‪ Keras‬ﻳﻚ ﺷﺒﻜﻪ ﭘﺮﺳﭙﺘﺮﻭﻥ ﭼﻨﺪ ﻻﻳﻪ ﻃﺮﺍﺣﻲ ﻛﻨﻴﺪ ﺗﺎ ﻋﻤﻠﻴﺎﺕ ﺩﺳﺘﻪﺑﻨﺪﻱ‬
‫ﺭﺍ ﺑﺮ ﺭﻭﻱ ﺩﻳﺘﺎﺳﺖ ‪ CIFAR-10‬ﺍﻧﺠﺎﻡ ﺩﻫﺪ‪.‬‬
‫‪۱.۳‬‬
‫‪Neural Network‬‬
‫ﺍﺑﺘﺪﺍ ﺩﻳﺘﺎﺳﺖ ﺭﺍ ﻣﻌﺮﻓﻲ ﻛﻨﻴﺪ ﻭ ﺗﻮﺿﻴﺤﺎﺗﻲ ﺩﺭﺑﺎﺭﻩ ﻛﻼﺱﻫﺎﻱ ﺁﻥ ﻭ ﻧﺤﻮﻩ ‪ Load‬ﻛﺮﺩﻥ ﺁﻥ ﺍﺭﺍﺋﻪ‬
‫ﺩﻫﻴﺪ‪ .‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺧﻮﺩ ﺭﺍ ﺑﺮﺍﻱ ﭼﻨﺪ ﺷﺒﻜﻪ ﭼﻨﺪ ﻻﻳﻪ ﻣﺨﺘﻠﻒ ﺁﺯﻣﺎﻳﺶ ﻛﻨﻴﺪ ﻭ ﺑﻬﺘﺮﻳﻦ ﺁﻥ ﻫﺎ ﺭﺍ ﻣﻌﺮﻓﻲ‬
‫ﻛﻨﻴﺪ‪ .‬ﺳﻌﻲ ﻛﻨﻴﺪ ﺗﺤﻠﻴﻠﻲ ﺍﺯ ﻣﻘﺎﻳﺴﻪ ﺷﺒﻜﻪﻫﺎﻱ ﻣﺨﺘﻠﻒ ﺧﻮﺩ ﺍﺭﺍﺋﻪ ﺩﻫﻴﺪ‪.‬‬
‫‪Momentum ۲.۳‬‬
‫ﺑﺎ ﻣﻄﺎﻟﻌﻪ ﺍﻳﻦ ﻟﻴﻨﻚ ﻧﺘﻴﺠﻪ ﺍﻟﮕﻮﺭﻳﺘﻢ ﺧﻮﺩ ﺭﺍ ﺩﺭ ﺣﺎﻟﺖ ﻓﻌﺎﻝ ﺑﻮﺩﻥ ‪ Momentum‬ﻭ ﻏﻴﺮﻓﻌﺎﻝ ﺑﻮﺩﻥ‬
‫ﺁﻥ ﻣﻘﺎﻳﺴﻪ ﻛﻨﻴﺪ ﻭ ﺩﻟﻴﻞ ﺗﺎﺛﻴﺮ ﺁﻥ ﺭﺍ ﺩﺭ ﮔﺰﺍﺭﺵ ﺧﻮﺩ ﺑﻴﺎﻥ ﻛﻨﻴﺪ‪.‬‬
‫‪Weight Decay ۳.۳‬‬
‫ﺑﺎ ﻣﻄﺎﻟﻌﻪ ﺍﻳﻦ ﻟﻴﻨﻚ ﻧﺘﻴﺠﻪ ﺍﻟﮕﻮﺭﻳﺘﻢ ﺧﻮﺩ ﺭﺍ ﺩﺭ ﺣﺎﻟﺖ ﻓﻌﺎﻝ ﺑﻮﺩﻥ ‪ Weight Decay‬ﻭ ﻏﻴﺮﻓﻌﺎﻝ‬
‫ﺑﻮﺩﻥ ﺁﻥ ﻣﻘﺎﻳﺴﻪ ﻛﻨﻴﺪ ﻭ ﺩﻟﻴﻞ ﺗﺎﺛﻴﺮ ﺁﻥ ﺭﺍ ﺩﺭ ﮔﺰﺍﺭﺵ ﺧﻮﺩ ﺑﻴﺎﻥ ﻛﻨﻴﺪ‪.‬‬
‫‪۵‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫‪۴‬‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﺳﻮﺍﻻﺕ ﺗﺸﺮﻳﺤﻲ ‪ ۱۵) -‬ﻧﻤﺮﻩ(‬
‫‪ .۱‬ﺑﻪ ﻧﻈﺮ ﺷﻤﺎ ﻗﺎﺑﻠﻴﺖ ﺗﻌﻤﻴﻢ ﺩﺭ ﻛﺪﺍﻣﻴﻚ ﺍﺯ ﺷﺒﻜﻪﻫﺎﻱ ﻋﺼﺒﻲ ‪،Adaline ،Perceptron‬‬
‫‪ Madaline‬ﻭ ‪ MLP‬ﺑﻴﺸﺘﺮ ﻭ ﺩﺭ ﻛﺪﺍﻣﻴﻚ ﻛﻤﺘﺮ ﺍﺳﺖ؟ ﺗﻮﺿﻴﺢ ﺩﻫﻴﺪ‪.‬‬
‫‪ .۲‬ﭼﻪ ﺯﻣﺎﻧﻲ ﻣﻲﮔﻮﻳﻴﻢ ﺷﺒﻜﻪ ﺩﭼﺎﺭ ‪ Overfit‬ﺷﺪﻩ ﺍﺳﺖ؟ ﺩﻻﻳﻞ ﻣﺨﺘﻠﻒ ﺁﻥ ﺭﺍ ﺗﻮﺿﻴﺢ ﺩﻫﻴﺪ‪.‬‬
‫‪ .۳‬ﭼﻪ ﺭﻭﺵﻫﺎﻳﻲ ﺑﺮﺍﻱ ﺟﻠﻮﮔﻴﺮﻱ ﻭ ﺣﻞ ﻣﺸﻜﻞ ‪ Overfit‬ﺩﺭ ﺷﺒﻜﻪﻫﺎﻱ ﭘﺮﺳﭙﺘﺮﻭﻥ ﭼﻨﺪ ﻻﻳﻪ ﻭﺟﻮﺩ‬
‫ﺩﺍﺭﺩ؟‬
‫‪ .۴‬ﭘﺪﻳﺪﻩ ‪ Underfit‬ﺩﺭ ﺷﺒﻜﻪﻫﺎﻱ ﭘﺮﺳﭙﺘﺮﻭﻥ ﭼﻨﺪ ﻻﻳﻪ ﺭﺍ ﺗﻮﺿﻴﺢ ﺩﻫﻴﺪ‪.‬‬
‫‪۶‬‬
‫ﺗﻤﺮﻳﻦ ﺳﺮﻱ ﺍﻭﻝ‬
‫‪۵‬‬
‫ﻣﺒﺎﻧﻲ ﻫﻮﺵ ﻣﺤﺎﺳﺒﺎﺗﻲ‬
‫ﺳﻮﺍﻝ ﺍﻣﺘﻴﺎﺯﻱ ‪ ۲۰) -‬ﻧﻤﺮﻩ(‬
‫ﻓﺮﺽ ﻛﻨﻴﺪ ﻳﻚ ﺷﺒﻜﻪ ﻋﺼﺒﻲ ﺩﺍﺭﻳﻢ ﻛﻪ ﺩﺍﺭﺍﻱ ‪ ۲‬ﻭﺭﻭﺩﻱ ﻭ ‪ ۱‬ﺧﺮﻭﺟﻲ ﺍﺳﺖ ﻭ ﺭﺍﺑﻄﻪ ﺯﻳﺮ ﺑﻴﻦ ﻭﺭﻭﺩﻱ‬
‫ﻭ ﺧﺮﻭﺟﻲ ﺁﻥ ﺑﺮﻗﺮﺍﺭ ﺍﺳﺖ‪ a, b, c, d .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻗﺎﺑﻞ ﺁﻣﻮﺯﺵ ﺷﺒﻜﻪ ﻫﺴﺘﻨﺪ‪.‬‬
‫‪y = ax21 + bx22 + cx1 x2 + d‬‬
‫ﺍﮔﺮ ﺩﺍﺩﻩﻫﺎﻱ ﺁﻣﻮﺯﺷﻲ ﺍﻭﻟﻴﻪ ﺑﻪ ﺻﻮﺭﺕ ﺟﺪﻭﻝ ﺯﻳﺮ ﺑﺎﺷﻨﺪ‪ ،‬ﻭ ﺍﺯ ﻧﻘﻄﻪ ﺍﻭﻟﻴﻪ ﺩﺍﺩﻩ ﺷﺪﻩ ﺷﺮﻭﻉ ﻛﻨﻴﻢ‪،‬‬
‫ﻧﺘﻴﺠﻪ ﺣﺎﺻﻞ ﺭﺍ ﺩﺭ ﺩﻭ ‪ Epoch‬ﻭ ﺑﺎ ﻓﺮﺽ ﺑﻬﻴﻨﻪ ﺳﺎﺯ ‪ Stochastic Gradient Descent‬ﺑﻪ‬
‫ﻫﻤﺮﺍﻩ ‪ Momentum‬ﻭ ﺗﺎﺑﻊ ﺿﺮﺭ ‪ MSE‬ﻣﺤﺎﺳﺒﻪ ﻛﻨﻴﺪ‪.‬‬
‫ﻧﻘﻄﻪ ﺷﺮﻭﻉ ﻭ ﻫﺎﻳﭙﺮﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻣﺨﺘﻠﻒ ﺭﺍ ﻣﺎﻧﻨﺪ ﺯﻳﺮ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ‪:‬‬
‫‪BatchSize = 4, LearningRate = 0.01, ρ = 0.9‬‬
‫‪a = −1, b = 1, c = −1, d = 2‬‬
‫ﺭﻭﺍﺑﻂ ﺭﻳﺎﺿﻲ ﺍﻳﻦ ﺷﺒﻜﻪ ﺭﺍ ﺩﺭ ﮔﺰﺍﺭﺵ ﺧﻮﺩ ﺑﻪ ﺩﺳﺖ ﺁﻭﺭﻳﺪ‪ .‬ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﻣﺤﺎﺳﺒﺎﺕ ﺭﺍ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ‬
‫ﺗﻮﺍﺑﻊ ﭘﺎﻳﻪ ﭘﺎﻳﺘﻮﻥ ﺍﻧﺠﺎﻡ ﺩﻫﻴﺪ‪ .‬ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﻛﺪ ﻧﻮﺷﺘﻪ ﺭﺍ ﻫﻢ ﺩﺭ ﻧﻮﺗﺒﻮﻙ ﺗﻤﺮﻳﻦ ﺑﻴﺎﻭﺭﻳﺪ‪.‬‬
‫‪۷‬‬
Download