How can I modify a PowerBook or iBook G4 to install Yosemite or Sierra?
Your Mac uses the PowerPC processor. Yosemite and Sierra require an Intel x64 compatible processor. So a software modification not practically possible. I can not directly answer the question regarding whether a hardware modification can be made. Although, I can say that usually such modifications require reusing the existing logical board, RAM and peripherals. The existing logic board, RAM and peripherals will be to slow for Yosemite and Sierra. Furthermore the video will not support the higher resolutions required by Yosemite and Sierra.

If you want to choose a current operating system, try Ubuntu (Lubuntu) or some other linux distro.