Demystifying Algorithms

BIO331 Introduction to Bioinformatics

Prof. Harbert

What is an algorithm

"A repeatable process for determining the solution to a problem."

Presentation content adapted from GDI-San Francisco presentation on algorithms under a (CC)BY-NC license.

Algorithms in "real-life"

  • Finding a fruit in the grocery store
  • Alphabetizing a list of names
  • Re-organizing your kitchen/room/desk to find things easier
  • Finding lost keys
  • Diagnosing car problems
  • Making your go-to dinner

What are some other examples of algorithms you use?

What is the goal of any algorithm? Why formalize your route to a solution?

  • Solve your problem
  • Be repeatable/reproducible

BYOA: Build your own algorithm

In teams of two pick an algorithm that you use to make decisions. Then map out the process on the whiteboard.

  • Show your thought process.
  • Solve the most obvious problem first.
  • Identify your tradeoffs and improve it.

E.g., Make N servings of pancakes.

How do you know if your algorithm is good?

Complexity of an algorithm can be measured by:

  • Time Complexity: How long does it take to find the solution?
  • Space Complexity: How much space does it use? (memory)

The best algorithms minimize both, but often tradeoffs between these factors are limiting.

For Bioinformatics

Algorithms are ubiquitous in bioinformatics. Many of the programs we will use are implementations of complex algorithms. It is not always necessary to understand exactly how an algorithm works, but it is important to be able to evaluate the performance for your task.

  • Is this program time efficient enough for my task?
  • Can this program analyze the data using the resources available.

Algorithms we have already seen:

Unix:

  • grep
  • sort
  • uniq
  • (similar in awk)

R:

  • various base functions (min/max/mean)
  • Reordering categories in ggplot figures

Discussion

Listen to the interview with Cathy O'Neil on NPR. For discussion this week, reflect on the discussion of algorithm bias in data science. Post your inital reaction to #discussion and then look for any other report of bias in computer models/algorithms in any field and share with the thread.

Other Resources RE Algorithms