Wednesday, November 20, 2013

Why One PhD Student in Psychology Learned Python

I posted a few testimonials about why arts and social science needs code last week.  I have a new one from a PhD student in psychology here at Carleton, and since it's such a good one I made a new post for it.

Chunyun Ma, PhD Candidate in Psychology, Carleton University


Why do I want to learn python?

There is the thrill of learning something new. There is also the practical part. I will focus on the latter today.

I study math cognition. What is that? You may ask. Simply put, I spend most of time studying how people process numbers and quantities. Several months ago, I become interested at how people do arithmetic. Not to bore you with the details, I needed to design an experiment in which participants would be doing mental addition and multiplication—all one-digit problems such as “2+3” or “3*5”. These problems would show up on a computer screen at a pre-determined interval for participants to solve. Everything seemed straightforward and easy except for one: I had more than 300 arithmetic problems to be included in the experiment. With the software I had at that time, each problem needs to be set up manually by point-and-click for it to show up properly on the screen.

Hours of point-and-click eventually led me to think: “there must be a smarter way of doing this”. Sure enough, Python entered my horizon at that time and proved to be much more efficient. With python, like with many other programming languages, I can write the code for presenting one arithmetic problem and recycle it for the rest of the problems. What’s better, I can stipulate in the code what output should be generated and in what format.

The advantage of Python over other programming languages is that it is relatively easy to learn. For psychology folks, knowing python also has an added bonus—being part of a vibrant community consisting of python users from all over the world who are knowledgeable of both python and experimental design. For example, Pygame and PsychoPy are two excellent tools for designing experiments, both of which are products through collective effort from the community.

Monday, November 18, 2013

GoldieBlox, Rube Goldberg, & Beastie Boys "Princess Machine"

This video is so beyond awesome that it deserves its own blog post.  I may or may not have shed a few tears watching it.  Keep on kicking butt, GoldieBlox. We need you.

(Edit: I've replaced the original video with an update after it was removed due to controversy surrounding the use of the Beastie Boys' song.)




Read more about this video and project here.

Wednesday, November 13, 2013

One Way to Study for Exams

For both my classes, I put together a study guide that included some general tips on studying as well as what topics to focus on.  Since the general advice works for many classes, I figured I'd share it here.  It's based on what I used to do as an undergrad.

York College Library Study
York College Library Study / CUNY Academic Commons

A good strategy is to create your own study notes, preferably on paper (manually writing will help you remember what you are thinking about better).  Here’s one possible way to make these notes:
  • Go through the course learning objectives, slides, and assignments, and make a list of key concepts that you should understand.
  • On a separate piece of paper for each concept, write the concept at the top of the page.
  • For each concept, write a general description of what the concept it about.  Try explaining it as if you were teaching someone who has never seen it before.
  • Look for ways the concept has been used in class.  How does it apply to the topic’s contextual question? What other contexts did we apply it to (in code, assignment questions, Poll Everywhere, etc)?
A few general studying tips:
  • Find ways to stay relaxed.  High stress will make your studying time far less effective. (Don’t leave it to the last minute!)
  • Try to stop working on your notes before your normal bedtime the night before the exam (if not sooner).  Get a good night’s rest - this really does matter!
  • If you have time, you can spend some time memorizing some of your notes.
  • On the day of the exam, review your notes.  By now you don’t want to be still trying to understand the concepts or memorizing key points if possible.

Be sure to state any assumptions you make when answering the questions.

Be strategic rather than starting at the beginning and working your way through.  Read all the questions first, then start answering the questions you are most confident about.

Friday, November 8, 2013

Why Arts and Social Science Needs Code: Testimonials

Part 2 of my "Why are we learning this?" guide for arts and social science students is a set of testimonials from people in the field that learned to code.  I'd like to share those testimonials here.

Angelica Lim, PhD Candidate

http://winnie.kuis.kyoto-u.ac.jp/~angelica

I do research on emotions across music, voice and movement. I believe that my background in programming has let me make unique psychological experiments that most people can't do.

Here's a video and article on something similar to my work: http://wheatlab.virb.com/dynamics Programs have also let me automatically detect things like reaction time, instead of spending hours poring through videos to do manual annotation.

Kathleen Woestehoff, Desktop Support Engineer for Gilt.com


I work in IT presently but that was after a purposeful (and challenging) career switch.

I studied psychology as an undergrad and got my MS in Education with advanced certification as a School Psychologist.

I learned some code through online courses I took. I've found it super applicable to be relevant and respected in my current career. I've heard from many people that basic HTML is nice to be able to adjust things on social media sites (though I've never taken advantage of what I know in this way).

I've seen it be highly sought after as a skill set in many companies for their marketing department, sales, graphic design, and more.

Emily Daniels, Software Developer and Research Analyst, Applied Research and Innovation at Algonquin College

http://www.emilydaniels.com/

Dear Fine Artist Learning to Code,

Being able to code to express yourself is one of the most powerful tools available to artists today. Artists should look at programming languages as they do any other medium- watercolor, acrylic, clay- they are all tools to allow you to develop and communicate your vision with your audience.

Artists who work with traditional mediums often have problems keeping up with the speed of society’s technological advances. What worked for Rembrandt and Picasso does not work for many of today’s artists. The scarcity surrounding the creation of a unique work of art contributes so much to the value of that work, but the minute your work is shared on the internet it loses value. The catch for artists is overcoming obscurity in a world inundated with information fighting for your audience’s attention. There is little you can do to help this, unless you are independently wealthy, like working several part time jobs to fuel your art, or you change the medium you work with and the way you communicate with your audience.

Though I still love to draw, after graduating from art school I took a hard look at the mediums I used to create art. Oils and acrylics are toxic to people, bad for the environment, and a fire hazard. The act of learning by painting on 2D surfaces and throwing them out or giving them to friends seemed selfish to me and a waste of resources. Personally I think we have a responsibility to reduce or eliminate our burden on the environment as much as possible, but this way of thinking does not fit very well with making traditional fine art. It took me a while to realize how much better it would be for me to transition my art making to my computer, but when I did it was a revelation. The learning process of writing code and scrapping it or sharing what you’ve written online is cheap and wastes less time and resources in comparison.

Most software projects depend on collaboration and also individual creation, which I find is a nice mix and less isolating than the traditional artist working alone in a studio approach to creation. Solving a problem with a team of people can be immensely gratifying and can give you a sense of belonging that is hard to recreate as an individual artist.

Learning to code and using it in a project allows you to become a modern artist in many different ways. You can tailor your work to a format that a wide audience can understand and interact with easily, which increases your reach and scope. Artists want to reach people on a fundamental level and engage with them in meaningful ways, eliciting responses that go beyond the surface reaction to uncover a deeper understanding and appreciation of our world. Touching people in a meaningful way is not owned by any particular medium but by the way the artist chooses to use that medium to communicate their message.

As an artist you probably already have a thick skin developed by years of crits where others continually tear down your work and expect you to pick up the pieces. This will prepare you for similar responses to your programs and is also immensely useful in software development. It seems from my experience that most computer studies programs don’t spend nearly enough time preparing people to respond well to negative or constructive feedback of their work. It would benefit a lot of developers to be able to take criticism in stride like an artist can, so if you can, you are ahead of the game.

You will need to hone your analytic and logical thought processes in order to program effectively, but if you have a solid background in working with abstract concepts in fine arts, it is not too hard to make the jump to visualizing how components interact and being able to mold them to get them to interact in the way you wish. A well built program is a beautiful thing, simple and complex at the same time. Any application you make or contribute to will still feel like you’ve made offspring from your mind that you are giving to the world. Stick with it- the work you’ll be able to create after learning to code is a million times more rewarding than what you can currently create.

All the Best,
Emily

Stephan Gruber, Associate Professor, Department of Geography & Environmental Studies, Carleton University

http://carleton.ca/geography/people/gruberstephan/

When I was about 25 and just about to finish my MSc, I had a key moment that I still remember: the day I was victorious over integrals. I knew what integral were from my high school math. But when I came across one in a paper, I would usually be left with an uneasy feeling. I knew what it meant, but had no idea, what to do with it. That day, I discovered, that I could discretize the integral in Excel and then just find an approximate solution. This then allowed me to explore the relationships I read about with practical examples that I calculated and plotted. It increased my understanding of the matter I was concerned with manyfold as now, I could interact with my problem and bring it from the abstract realm to, for instance, a plot or a number. Today, data processing and numerical experimentation, sometimes on high-performance computers, are a large part of my research. The power of this approach is what I believe enables me to chose great places to do research: mountain ranges across the world, the North, and Antarctica.

Learning how to organize and process large amounts of data and to write computer code has been the biggest single advance in my education. While it sounds counter-intuitive, I am convinced, that this is especially true for people who think they are not good at Math and who shy away from equations. Being able to write a small program to plot things is ultimately a tool to use the power of your brain better: viewing and manipulating a plot provides a broader experience than text and equations. If you work with data and models, you understand the subject you work with much better. And this will help you to better confront existing knowledge with the observations you make next time – or to plan more efficient observations.

And, there is another benefit. Writing computer code forces you to organize your thoughts. This is an analogy to how we see the writing of scientific text as an integral part of knowledge generation. Only when we formulate and structure what we have in our heads as text, do we see where it contains flaws or needs more work. Only then can you show it to someone and ask for feedback. Both ultimately let you grow in your understanding. The same is true for writing computer code. It helps us to be clear and to put the finger on areas that need work.

Learn how to program! It will be one of the most valuable skills you acquire in your studies. Don't be demotivated by having to spend many hours with the help function and Google to solve trivial things. All this helps you to acquire problem-solving skills and to be able to build the tools you need instead of being limited by what is available.

Stephanie Jackson, E-Communications Strategist, University of Ottawa


Word and Excel, just like the hardware of a computer itself, are tools to do a job. You wouldn't use a laptop to hammer in a nail, and you wouldn't use a screwdriver to analyze complex statistical data sets. Just about every complex task you work on requires the right tools for the right results. In the current technology-focused world, understanding the basics of major coding languages, as well as how they interact with one another, is critical for achieving the best results with the resources you have available. If I don't have a grasp on how various coding languages 'talk' to one another, even without having a proficiency in coding the language itself, I cannot effectively create a system which is both efficient and sustainable.

Of course, my experience is primarily web and web application based, so more php and ruby, less python, but the principle still stands ;o)

Kristen Jeanette Holden, Stay-at-home-mom, pausing from PhD studies at University of Chicago


I've got an MA in humanities from a top 3 school and focus on Japanese war/postwar film and literature. It's a small field with maybe a dozen experts outside Japan, and lost films and texts are still being found in secret vaults all over the world (the Japanese used film reels as fuel during the war, so colonial Korean and Manchurian political films were all thought to be destroyed). The crappy websites of eccentrics can lead to published papers and even full books because so little information is available. Just knowing html and Javascript is incredibly helpful. View Source got me through many big papers.

Who knew that my 15 year old self's desire to put up a page on hometown.aol.com with comic sans paragraphs over animated backgrounds and blaring midi music would help me in grad school?

Rachel B. Bell, Website Designer at Verbatim Design in Providence, RI


I majored in Studio Art at Smith College. My focus was on Photography and Reduction Linoleum Cuts. I took one class that included about a week of working with basic html. Little did I expect at the time that two years later, I would be a website designer and search engine optimizer.

Bonus: Chris Bosh, NBA Superstar


Being a kid of the 1990s and living in a house run by tech-savvy parents, I began to notice that the world around me was spinning on an axis powered by varying patterns of 1s and 0s. We’d be fools to ignore the power of mastering the designing and coding of those patterns. If brute physical strength ran one era, and automation the next, this is the only way we can keep up. Most jobs of the future will be awarded to the ones who know how to code.

We use code every time we’re on the phone, on the web, out shopping — it’s become how our world is run. So I take comfort in having a basic understanding of how something as big as this works.

Read the whole article: http://www.wired.com/opinion/2013/10/chris-bosh-why-everyone-should-learn-to-code/

Monday, November 4, 2013

The "Why Are We Learning This?" Guide for Arts and Social Sciences

In my Intro to Computers for Arts and Social Sciences class, I have been introducing the students to a bit of programming and algorithmic thinking in addition to the traditional topics (data representation and MS Office).  I try to connect back to why learning to code is useful, even in arts fields, but I am not always successful.  So, in hopes of doing a better job making my case, I decided to put together a document that summarizes the answer to the question "Why are we learning this?"



This post summarizes some of what I've got so far.  I've also been collecting testimonials to share with the students.  These are stories from arts and social science students, graduates, and professors explaining why code is useful to them.  I will share those another day.

If you've got any ideas to add to this, please do share!

Why Learn About Data Representation

It’s inevitable: no matter what field you’re in, you’ll have to work with data in some form or another.  Having a good mental model of how information is stored on a computer can help you not only manipulate that data, but think about the best ways of collecting, storing, and analyzing it.

For example, if you need to collect images for a project, you might have previously just used colour images by default.  But now that you know how much less space grayscale images can take, you might decide that they are the better choice when colour is not needed.

Why Learn Computational Thinking

Computational thinking is about problem solving. We use computers to solve problems in every field these days. It’s not enough to be able to follow a tutorial on “how to do X” - you need a deeper understanding of how computation works in order to tackle previously unseen problems and know that you are solving them correctly and efficiently.

Here are some specific reasons to practice this type of thinking:
  • You need to know how to take a problem you need to solve and transform it into something a computer can actually work with. We think too high-level for a computer to “get” what we want to do without breaking things down into really specific chunks.
  • The world is becoming increasingly complex, and you need to be able to deal with that complexity.
  • Similarly, you need to be able to handle ambiguity and open-endedness in the way a problem is defined and even in how you are expected to solve it.

Why Learn About Algorithms

Algorithmic thinking is part of computational thinking.  You might run into a situation where you have to program your own algorithms as solutions to problems.  Even if you never touch a line of code again, learning algorithmic thinking is useful.  Here’s why:
  • You build a mental model for how computers work.  This helps you choose the right tool for the job when you have to solve your own problems, and do a better job of troubleshooting when things go wrong.
  • The ability to write out an idea correctly and unambiguously transfers to the ability to write effective instructions or arguments in essays and other documents.
  • To think algorithmically is to be able to specifically translate a problem into something the computer can solve, whether you use Python, Excel, SBSS, or some other tool to actually solve the problem.

Why Learn How to Code

This is a big one, obviously. Being able to solve problems with code means you can tackle problems that Excel and other programs can’t help you with (for example, text-based problems).  It also means that you have full control over the solution, giving you the ability to customize it to suit your needs exactly.

Here are some general reasons to learn how to code:
  • Writing some code is the best way to understand concepts that can be applied elsewhere, like if statements and while loops.  It is also the most precise form of algorithmic thinking.
  • If you know how to code, you have the power to be endlessly creative.  From interactive fiction to web apps to computational art, there’s a lot you can do with code that is difficult or impossible without it!
  • Writing simple programs can help you automate the really boring parts of using a computer.
  • If you have an idea, you don’t have to wait for someone else to create it. You can do it yourself!
  • If you can put a knowledge of programming together with whatever it is you are studying, you become extremely valuable to that industry.  High paying jobs that few people can do well become open to you.

Here are some real example problems that can best be solved with code:
    • Rescaling climate change data to analyze it in new ranges
    • Text analysis by making a concordance of a text
    • Digitizing horizon shading (when does the sun rise/set behind mountains, local rocks, trees, ...)
    • Removing noise from measurements of snow height made by an ultrasonic sounder
    • Facilitating collection and analysis of data from an experiment that determines whether seeing the sign of a simple mathematical equation before the numbers gives someone an edge in solving that problem quickly

    These are some answers I got on Twitter when I asked “Why do you think an arts/social science student should learn to code? Reply with your reason, be it fun or practical, general or specific.”
    • “Same reason a CS student should learn from the arts: a different perspective is aways [sic] 'a good thing'.”
    • “Social science - 1 word, data. Arts - creativity.”
    • “So they know enough about the difficulty of software dev that, if elected, they don't do a http://healthcare.gov”
    • “because Robert A. Heinlein: http://www.elise.com/quotes/heinlein_-_specialization_is_for_insects
    • “the world is increasingly complex, and built, more every day, in code. being unable to understand basic science or software will soon be nearly as self-limiting as lacking numeracy or literacy is for many people now.”