Conceptual section due Friday, February 2, 2024 at 6:00 PM EST
Programming section due Friday, February 2, 2024 at 6:00 PM EST
Welcome to the first (programming) assignment of CSCI1470/2470! This assignment will guide you through the creation of a local environment for the course and ensure that you will be all set to start on Homework 1. This assignment will be graded for completion.
An octopus doing assignment 0 (artist's rendition)
Please click here to get the stencil code. Reference this guide for more information about GitHub and GitHub Classroom.
In order to complete (programming) assignments for this course, you will need a way to code, run, and debug your own Python code. While you are always free to use department machines for this (they have a pre-installed version of the course environment that every assignment has been tested against), you are also free to work on your own machines.
Below we give you some information that is helpful for either of these situations.
In order to set up your virtual environment for this couse, we highly recommend (and only formally support) the use of Anaconda to create and manage your Python environment.
Once you have cloned the Github Classroom assignment for this assignment, you can do the following to setup your virtual environment:
Download the Anaconda installer from here, and install it on your computer. We recommend using the Graphical Installer for the correct system (Windows / (Intel) Mac / Mac M1 / Linux).
Note: If you have an existing Anaconda or Miniconda installation (such as from CS200), then you don't need to reinstall, and can just use that!
You can tell if you have an existing install if the command conda --version
is recognized.
Windows: When installing using the graphical installer, be sure to check the box which adds conda
to your PATH
.
Open a new terminal window and navigate to the root of the cloned assignment in a terminal (such as the one in VSCode) using cd
and ls
.
If you are using Windows Powershell, then you can just run ./env_setup/Other/conda_create.sh
(forward slashes), but if you are using Command Prompt, then you need to run .\env_setup\Other\conda_create.sh
(backslashes).
We provide a slightly different script which you can call from ./env_setup/"Apple M1"/conda_create_m1.sh
for those who have Apple silicon.
Just run run ./env_setup/Other/conda_create.sh
You may need to restart your terminal after installing Anaconda in order for this to work.
conda activate csci1470
. You will need to do this in every shell where you want to use the virtual environment.If you are the above procedure doesn't work for you (although we highly recommend trying to troubleshoot that first), here is another method that does not rely on conda
commands:
Install Python 3.10 (or Python 3.9, we have not found any differences in functionality between them for our projects).
Install the following packages in either a virtual environment or your main python environment
βββββββ ipython==8.8.0
βββββββ matplotlib==3.5.3
βββββββ numpy==1.23.5
βββββββ Pillow==9.4.0
βββββββ scipy==1.9.3
βββββββ tensorflow==2.11.0
βββββββ tqdm==4.64.1
python -m venv cs1470
. This will create a new virtual environment caled cs1470
.cs1470/Scripts/activate
on Windows machines or source cs1470/bin/activate
on Mac and Linux machines. Do this before starting any homework asssignment.deactivate
.pip
commands (ie pip install ipython==8.8.0
)pip install -r requirements.txt
Once this is complete, you should have a local environment to use for the course!
Note: Sometimes even if you set up your local environment correctly, you may experience unexpected bugs and errors that are unique to your local setup. To prevent this from hindering your ablity to complete assignments, we highly recommend that you familiarize yourself with the department machines, even if you expect to usually be working locally.
Department machines serve as a common, uniform way to work on and debug assignments. There are a variety of ways in which you can use department machines:
When using the department machines, you can activate the course virtual environment (which we have already installed) using:
Which will activate the course virtual environment. From here, you should be able to clone the repository (see a GitHub guide here for more information on using Git via the command line), and work on your assignment.
Note: Python files using tensorflow
may require a little more time on startup to run on department machines (likely because it is pulling files from the department filesystem), but they should all run nonetheless.
Python packages, or libraries, are external sets of code written by other industry members which might prove really helpful! (Imagine coding how to draw a graph in Python every single time)
However, different classes, tasks, and even projects, might require different sets of Python packages. We can manage these as different virtual environments which have different sets of packages installed.
If you are using conda
, you might notice the (base)
prefix in your terminal. This signifies that you're in the default (hence (base)
) environment. For example:
To access CSCI1470's virtual environment, you can use conda activate csci1470
. You should now see the (csci1470)
prefix in your terminal!
Once we're in the environment, we want to make sure that we're actually going to be running the environment's Python version. If you're on Windows call where python3
, and if you're on Linux or Mac, call which python3
. You should get something along the lines of
The important part is that you want to make sure that this path returns something inside your environment!
To return back to the base environment, you can use conda deactivate
.
Once you have configured your virtual environment (either running locally or on a department machine), run the file test_network.py
from the HW0 root directory by writing the following in your terminal:
This will run a simple neural network using TensorFlow and save the model to a file in the models/
folder, which we will use to check that you have your local environment working properly.
For every assignment in this course, you will be required to submit a brief README.md
file in your repository along with your code, explaining:
For this assignment, you should create a README.md
file, but since you didn't actually write any code for this assignment, feel free to either leave it blank or include a random message to the TAS :).
You should submit the assignment via Gradescope under the corresponding project assignment by zipping up your hw1 folder or through the GitHub integration on Gradescope (recommended). To submit through GitHub on Gradescope, commit and push all changes to your repository to GitHub. You can do this by running the following three commands (this is a good resource for learning more about them):
git add file1 file2 file3
git add -A
will stage all changed files for you.git commit -m βcommit messageβ
git push
After committing and pushing your changes to your repo (which you can check online if you're unsure if it worked), you can now just upload the repo to Gradescope! If youβre testing out code on multiple branches, you have the option to pick whichever one you want.
Wohoo! You just completed your first assignment of CSCI1470/2470!
Just like how you are set up an environment to do your assignments, octopi like to set up territory in coastal marine waters, staying in small crevices in rocks and coral.
Now that your virtual environment is setup, you should be ready to do the rest of the assignments in this course.