Starting from:
$30

$24

Assignment 04 Solution

In this assignment, you will be using the Keras and TensorFlow systems installed on the CS Volta machine to do some exploratory work with neural networks. You will be handing in two completed Python notebooks, produced using Jupyter.







First-time set-up: To use the existing tools installed on Volta, you will be starting your inter-actions from the command line in each session, although once you have your notebook up and running, there is generally no need to do any work directly from the command line. Before you begin, you must do a bit of con guration, so that you can properly use the Jupyter notebook (you will only need to do this the rst time, after that it will be con gured for use):




Establish an ssh connection with the server at volta.cs.uwlax.edu, using your UWL log-in and password. (This will work from any standard SSH client, so long as you are either on the campus network, or using the UWL VPN.)



To set up your con guration for Jupyter, execute the following two commands, from the home directory to which you log in:



mkdir .jupyter




nano .jupyter/jupyter_notebook_config.py




(Note: be sure to include the dot before jupyter). This will create a hidden directory con-taining a new Jupyter con guration le. You can then paste in the contents of the matching con guration le that has been supplied to you with this assignment. After pasting into the le, exit by choosing Control-X and hitting return to con rm saving its contents.










Starting a Jupyter session: Once your account is con gured, you will begin a work-session by using SSH, as before, to log into volta.cs.uwlax.edu. Once you have done so:




1. Launch Jupyter with the command:




jupyter notebook &




(note that the use of the ampersand allows you to continue to access the command line if necessary while the Jupyter server is running).




When Jupyter launches, you will get a message terminating in a URL of a form similar to: http://volta:8892/?token=be6912...












1






This indicates the port number on which Volta is communicating, and includes a long token value used for authentication. Copy and paste this URL into a web browser; edit it so that the full server, volta.cs.uwlax.edu is used, instead of simply volta. This will cause your browser to open a window giving you a view onto your CS account le-system; this is the same le-system that is mounted if you log into a machine in the CS lab in 16 Wing. While any les you create will live in that le-system, any compute work you do will be on the more powerful Volta machine itself.




You will now do all your work from within the Jupyter system in your browser. See the video posted to D2L with this assignment for basic use. (There are many short tutorial posts and videos available for Jupyter online as well, if you want more information about its use.)









Assignment: You will be completing two distinct exercises in Jupyter. These will involve doing some basic and more complex machine learning tasks, and documenting some of what you saw. All of your work will end up in two di erent Jupyter notebook les, which you will turn in for credit.




(5 pts.) Choose a working directory on your le system. Upload the two les contained in the diabetes_exercise folder in the assignment materials. Opening the notebook le (ending in su x .ipynb) will open a new browser tab containing a complete, executable Jupyter notebook. Read through the material in the notebook, executing the code as you go to build a simple feed-forward classi er for the diabetes test-data supplied.



As you go, note the following:




The code contains a section that limits the memory footprint of TensorFlow. This code restricts anything you execute to use only 5% of the memory associated with each of the GPUs on Volta. This means that each GPU will only allot you 808 MB for use. For these exercises, this should be su cient, and should allow reasonable numbers of users to be on the system at the same time. If this turns out to be less memory than is required, we can talk about it.



Note: If you write your own code on the system, you need to remember to include the same restrictions on memory use. If you do not, you will monopolize the entire memory of the system, and nobody else will be able to use it. Thus, please don’t do it. If our system monitors indicate this is happening regularly, we will restrict the system to users who behave more kindly to others.




The notebook contains sections written in Markdown syntax. \Running" such a section simply renders the Markdown, making it look pretty. You can edit both code and Markdown by clicking into the relevant cells and making changes.



For this part of the assignment, you are directed to make some changes to the model that is built and trained. As you do, you will be editing the Markdown section, replacing the instructions with an explanation of what you saw. Your grade for this part will be based on the quality and accuracy of your explanation.




If you have not used Markdown before, it is quite simple. The examples given show much of its basic syntax. More information can be found at numerous online sources, as for example: https://www.markdownguide.org/cheat-sheet/







2






(35 pt.) For the second part of the assignment, you will create a new Jupyter notebook. In that notebook, you will be working on a convolutional neural network for the CIFAR-10 object-recognition task. The database for this well-known benchmark is available directly in Keras. For this part of the assignment:



Begin a new notebook. As you start to build your code, remember to include the code from the previous notebook that restricts memory usage.



There are a number of online tutorials to get started with CIFAR-10. Start by working through all of the steps in the following: http://tinyurl.com/cifar10-exercise



As you work through the exercise, add Markdown cells between the various major pieces of code (as in the notebook supplied you for the rst part of this assignment). Each Markdown cell should contain some explanatory text, indicating what each piece of the code is doing and why. Your grade will depend upon the quality of these explanations.



The tutorial, as given, works through building a classi er that gets approximately 80% accuracy. At the end of the exercise are some suggestions on how it might be improved. Work through some of these suggestions, or try other techniques of your own, and see if you can improve the classi er performance. In the notebook Markdown sections, document things you have tried, and the results (good or bad). For this part of the assignment, you will be graded not based upon the nal result (i.e., classi er accuracy improvements), but upon the clarity of your explanations and evidence of having tried something genuinely interesting.









You will hand in a single compressed archive containing the two completed notebook les.



























































































3

More products