Skip to content

Instantly share code, notes, and snippets.

@actsasgeek
Last active September 3, 2024 17:27
Show Gist options
  • Save actsasgeek/19952660399be0c6dbb0407fe8c56ec4 to your computer and use it in GitHub Desktop.
Save actsasgeek/19952660399be0c6dbb0407fe8c56ec4 to your computer and use it in GitHub Desktop.
645_starter.md

EN605.645 Artificial Intelligence

Welcome!

This course requires knowledge of Python (the requirement is listed in the course description). If you do not know Python, you will not do well and the course will be harder than it already is.

Slack

We will be using Slack this semester for course communication/discussion. Please make sure you have Slack installed on your computer before the semester starts. You will be given a link for the course Slack workspace when the course starts.

Note: This may be different for Section 82, with Dr. Shane Strasser

Introductory Video

The course requires a specific programming style. That style is introduced in the following programming video:

Introductory Video

Infrastructure

  1. You are very strongly encouraged to use a computer upon which you have administrator/superuser privileges. I cannot help you with problems associated with the installation of software and libraries.
  2. You may have an easier time if you use "Unix"-style operating system (MacOS or Linux flavor) either directly or in a virual environment (Docker or VirtualBox). It's not required.
  3. You should have your environment up and running before the semester starts but no later than the 2nd day of class. There is a test assignment due that Wednesday.

Setup

  1. Install Anaconda for Python for your operating system: Anaconda.
  2. Set libmamba to be the default solver: $ conda config --set solver libmamba Note if this fails, you need to update Conda.
  3. Create a directory/folder for AI and move ("cd") into it.
  4. Download environment.yml into your directory (or just copy the Raw content, paste it into a file named environment.yml, and save it).
  5. Execute conda env create -f environment.yml
  6. You now have all the libraries needed for the course (as of now).
  7. Activate the new conda environment: conda activate en605645. Important the next step will not work correctly if you don't activate the en605645 environtment.
  8. Set up Jupyter notebook to use this environment: python -m ipykernel install --user --name en605645 --display-name "Python (en605645)"

NB: You "must" use this Anaconda environment and the "en605645" kernel for this class. Failure to do so has consequences that are your responsibility. These consequences may include getting a zero on assignments.

Do not use a regular code editor for you assignments. Instead use something that can correctly edit and display Jupyter notebooks (ie, Jupyter Notebooks, VS Code, etc.).

Workflow

Once the class has started, you will be able to download the Jupyter notebooks for each module. In the interim, you may want to get a feel for the environment in which you'll be working. Use the following commands:

  1. conda activate en605645 - this will activate the environment. (Use conda env list to see your installed environments).
  2. jupyter notebook - this will start the Jupyter notebook environment with the current directory as the root.
  3. When you create a new Jupyter notebook, you can select "Python (en605645)" as the kernel.

Note - jupyter notebook is eventually be "sunsetted" in favor of jupyter lab. If you want to use jupyter lab, that's fine...I seem to have more memory problems with lab, though, and not all extensions are/were/will be ported from notebook to lab. (August 2023 - I don't think notebook is sunsetted yet...).

When you're done, you can invoke conda deactivate.

Programming Requirements

You should download the following two files and put them in your AI directory:

  1. Python in a Functional Style
  2. QuickSort Example

After the quick overview, install your environment and download the two files above, putting them in the referenced AI directory/folder.

References

  1. Python 3
  2. PEP8
  3. Jupyter notebooks (YouTube)
    1. Jupyter Notebooks for Beginners (blog)
    2. Advanced Jupyter Notebooks (blog)
  4. Markdown

Codewars is a great way to increase fluency with Python. Look for idiomatic Python solutions.

@actsasgeek
Copy link
Author

Trouble-shooting for install environment.yml :

Sometimes you will run into permission issues when trying to write to the /opt/anaconda3/pkgs/cache directory. The main reason is that the Conda installation is in a system-level directory that requires elevated permissions for certain operations. You can run the command with sudo to give it the necessary permissions:

sudo conda env create -f environment.yml

I did not have this issue on my installation but it's good to have documentation for major things that can go wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment