Sunday, March 24, 2013

Goldbach's Conjecture, Turing Machines, and Artificial Intelligence

When I was a graduate student I'd work on proving Goldbach's Conjecture when I needed a break from my real research. I'd focus on what this Wikipedia article (http://en.wikipedia.org/wiki/Goldbach's_conjecture) calls the strong form : every even natural number (aka even positive integer) greater than 5 can be expressed as the sum of two prime numbers. So, for example, 6 = 3 + 3, 8 = 5 + 3, 10 = 5 + 5 (and 7 + 3), 12 = 7 + 5, .... Again, this is a conjecture that is believed to be true by virtually everone and its truth has been demonstrated with computers up to huge even numbers, but no one has proved its truth for all even numbers, and there are an infinity of them.

The really attractive thing about number theory is that so many of the problems are so easy to understand by so many -- you may not be able to solve the problem, but you sure understand what's being asked! An approach I hit upon to prove Goldbach's conjecture (or I suppose disprove it, or perhaps that you could'nt prove it one way or the other!) was essentially this, write a computer program that ran forever (if you were to run it), generating the even natural numbers one after the other, and write another computer program that ran forever (again, only if you were to actually run it), that generated all the sums of two primes "in sequence", and then show that the two programs were equivalent. Unfortunately, that last step is REALLY, REALLY hard, if doable at all, but fortunately my PhD research took off about this time and I did that instead, much to the relief of my wife, parents, and in-laws!

But now, just as I want my artificial intelligence students to find projects of interest, this is the project that I want to return to. Its been about 3 years since I've done my own substantive computer programming, and its probably been 15 years since I've done substantive programming in the LISP language. So this will be fun! I can trivially write a program that generates all even natural numbers greater than 5: (defun GenEven () (do ((i 3 (+ 1 i))) (t (princ (* 2 i))))). A program that generates the sum of all pairs of primes is a good deal more complicated, because in general each addend needs to be verified as prime (http://en.wikipedia.org/wiki/Prime_number). In fact, one way to write this second program is simply to write a program that generates all prime numbers, and then "append" it to a copy of itself, and as each copy produces a prime the sum is output. However we write the second, what we imagine is something remarkable -- that the latter very complicated program is equivalent to the former very simple program.

It would be tempting to spend a good deal of time making each of these programs as concise or as efficient as possible, but you see, I am never going to run either program. If I am biased in any direction it is that each program be as "unstructured" and as "primitive" as possible, because once these programs are defined, a third program, an AI program, is going to search for a sequence of rewrites that will transform one program into the other, while provably maintaining the original functionality of each. The third (AI) program is the one that will actually be run, and I'll be writing this program in Lisp. But the two programs, one for generating the even numbers and one for generating the sums of prime pairs, I'm imagining will be written in the most primitive of languages -- the language for programming (or defining) a Turing Machine -- a simple form of computer, but not a computer that you would ever power up -- a Turing Machine is strictly a theoretical device (http://en.wikipedia.org/wiki/Turing_machine).

The reason for the bias of starting with as unstructured and primitive as programs as possible is that though there are optimizations in the test for primality, for example, which I could reflect in my initial programs, these optimizations reflect patterns that almost certainly have been exploited in explorations of Goldbach’s conjecture by better minds than mine. It may be that any proof, if one is possible, has to rely on reasoning that is just off (human-conceived) map.

I'd actually started this process as a grad, exploring the ways to bridge these two programs, via an AI program that searched through billions of possible rewrites. I'm essentially an experimentalist and I start with code and looking for data -- that's my bread and butter. I think that what I am really doing is shaping my retirement 20 years from now (or less, for Pete's sake). When friends visit and ask Pat where I am, she'll point to the shed and tell them that I'm working on "that proof". More likely, I’ll be tinkering with the AI program itself, making sure that there are no bugs in it — can you imagine my despair, if near the end of my life and after searching billions of rewrites, my program comes back with “Proof Found!”, and I didn’t correctly save the path my AI program took to get there!?

The older I get the more I remind myself of my father.


(originally posted Thursday, August 20, 2009 on Wordpress)

Thursday, January 3, 2013

Pedagogical benefits of bottlenecks


Back in the day of my initial computer programming classes we used punch cards (http://en.wikipedia.org/wiki/Punched_card). One card held one line of computer code, so that a 100-line program, which is a small program, required a deck of 100 cards.

To prepare and run my program required I get in a line for the next available key punch machine -- I typed my program out on a keyboard and coded holes were punched into cards. I might have to wait 30 minutes for a free machine on the night before an assignment was due, then taking another 15-30 minutes to punch my cards. When I was done, I went to another line, with a 5-10 min wait, and ran my deck through the mainframe-computer's card reader -- it flipped through the card deck like a card shark flips through playing cards, reading the holes in the cards as they sped by. After this, my program waited in the computer's internal queue until its turn came, about 20 minutes, and the computer "ran" (aka executed) my program, printing out the results *IF* my program "worked" (but, sigh :-( even then the results or OUTPUT was often wrong, a result of semantic or "runtime" errors), or the "line" printer (a massive thing that printed on large rolls of paper) would print out my program, flagging syntax errors that had prevented my program from running at all. If this all seems like a drag, it wasn't really -- the night before an assignment was due was a party -- computer science was probably the most social major on campus. More recently than back-in-the-day, personal laptops have come to dominate and students often work in their dorm rooms (sigh), but I hope that computer science education is as social as it once was, albeit in different forms.

The simple physical operations that I had to perform to correct and run my program and get the results back was about (45min+5min+20min =) 70 minutes on a busy night!! Before I got back in that line for the key punch machine, I rolled out my printout and studied it for at least 30-60 minutes, maybe longer, maybe much longer -- if I found the bugs that appeared to be the problem, I didn't stop there, but studied the entire program looking for more, because there surely were more bugs and its usually the case that the "real bug" is NOT in the vicinity of its manifestation. No professor or textbook berated me to take a global view of the code, to go beyond the immediate symptoms and look for causes -- it was the time bottleneck, the 70 minute response time, that encouraged, even demanded extensive thought on my part. In writing even a several-hundred line program, I actually ran the program only a handful of times.

Since back-in-the-day, programming development environments have gotten much better and computer response times have decreased drastically. A student can make a change to a program, hit "run", and have the results of the run back before they've finished blinking, at least for the programs of complexity that novice-to-intermediate students will run (in contrast, while in grad school and not that long ago as a faculty member, I wrote and ran programs that might take a week).

But lesser response times (i.e., faster) and friendlier programming environments are not all good news -- not for novice programmers trying to become expert anyways, though they might think otherwise. Unfortunately, it seems that the decrease in response time is accompanied by a decrease in thought time. The removal of a time bottleneck encourages a local change, hit run to see what happens, change, run, change, run, change, run ... anyways, this is my experience as an instructor. A student might (try to) run the program a hundred times using this knee-jerk debugging strategy, and because the strategy focuses on local changes, not benefiting from reorganizations that stem from a global view, the code is far less elegant and more brittle.

Among the experienced programmer, fast response is a godsend, but its a bane to the novice programmer in training, whether the student knows it or not.

I want to know whether this correlation between computer response time and programmer think time is really true, particularly among novices. And I'm very concerned with what analog correlations exist with other technologies and the influence of such correlations with respect to human sustainability.

When I have the time, so wonderful to think about (having time), I'll be contemplating bottlenecks, how they promote the long view, the global view, particularly as they relate to computing and sustainability. I like the idea of bottlenecks that actively teach and reason with you, even as they slow you down -- another note.

BTW -- one of the greats in CS, Edsger Dijkstra, went so far as to suggest that the new CS programmer shouldn't be able to access a computer for a year, so I recall. You ought to be able to write correct code for even complicated tasks without getting feedback from a computer at all -- amazing, but I believe it.

(originally posted on Wordpress blog: May 20, 2009)

Wednesday, January 2, 2013

Update on MOOCs in support of blended courses

In October 2012 I gave several talks on my experiences with using MOOCs (or simply using material from MOOCs) in my regular Vanderbilt courses (e.g., http://vimeo.com/53361649, with my presentation starting at about 26:40, speaking from slides at https://my.vanderbilt.edu/douglasfisher/files/2012/02/ITHAKA-Presentation-10-16-12.pdf); a text summary of my experience up to that time can be found on the Chronicle of Higher Education's ProfHacker blog at http://chronicle.com/blogs/profhacker/warming-up-to-moocs/44022.

As part of each of these presentations (ITHAKA S+R, UNCC, CUMU-12), I illustrated the breadth of computer science course offerings online with 4 slides (https://my.vanderbilt.edu/douglasfisher/files/2012/02/CSMajorOnline.pdf ), showing that one could come close to fulfilling the course requirements of a typical CS major online and free. I was also presenting this material from the perspective of an instructor, so my focus was on how instructors could add to online content, allowing others still to customize, drawing from expanding online content.

Since these presentations and the ProfHacker post, my graduate "Individual Studies" course (CS 390) in Fall 2012 on Machine Learning has finished; this course was a "wrapper" around Andrew Ng's  COURSERA (Stanford) course. The requirements of the CS 390 included the requirements (quizzes, homeworks) of the COURSERA course. There were 10 graduate students who completed the CS 390 course. You can look at the details of the course organization, roughly a cross between a more structured upper division undergrad class (the COURSERA component) and a graduate seminar course (the face-to-face component), at https://my.vanderbilt.edu/cs390fall2012/, should you wish. Rather than feeling more like a TA (it has been suggested by some that faculty roles might morph into glorified TAs under a blended model), I felt LESS like a TA, and more like an "old-school" prof (I suppose as portrayed in 1940s and 50s movies :-), interacting closely with students in class. But there are models of blended learning besides the one that I used, and probably better fits to different preferences.

The CS 390 OVERALL RATINGs (as coded on Vanderbilt's forms, each on a 1...5 range, 5 being "best") for the instructor/course (4.16/4.16) were comparable to the "regular" Spring 2012 Machine Learning (CS 362) offering (4.33/4.22) and my other Fall 2012 courses of CS 360 (4.50/4.25) and CS 260 (4.25/4.00 ). Derek Bruff and others at Vanderbilt/s Center for Teaching did a mid semester evaluation, we have identified ways to improve, and we are working on further evaluation. On the whole it seems that the wrapper was a well appreciated course.

Despite this CS 390's more structured (COURSERA) component, the CS 390 required no more than 1/4 the time as my upper-division AI course (CS 260), probably considerably less than that, because the COURSERA platform was doing work of lectures and grading. A very specific consequence of my CS 390 experience is that I may advocate offering CS 362 (Machine Learning) yearly (instead of every other year), if it can be done as a wrapper (all or some of the time). Coincidentally, there is at least one other ML MOOC coming online soon, enabling more customization across the two MOOCs, to say nothing of the material that I will put up (e.g., on YouTube), as I have done for CS 260; in fact, I have a couple of "best sellers", which resulted from students of yet another AI MOOC looking for clarification on a couple of algorithms (i.e., generalized arc consistency and iterative deepening): https://www.youtube.com/channel/UCWOFdpEfNuQP3O_JUiwhT8A.

More generally, most commentaries point out that reduced faculty workload per course (nonetheless, regarded by students and faculty as strong courses!!!) would enable more high-quality electives for a fixed staff level, and it would allow a finer granularity in assessing faculty workload; finer granularity in characterizing course workload could translate into finer granularity in course buyouts, enabling even a heavily committed research faculty member to lead a (blended) course, etc. I haven't seen the increased flexibility of faculty buyouts mentioned in previous commentaries, but I suspect that some of the most grant-committed faculty would like to get in front of a class of undergrads if it just didn't take so much time, and of course, I'm sure undergrads would love this too.

A GRADUATE-LEVEL INDIVIDUAL STUDIES course, such as my CS 390, seemed like the most conservative next step into formal blended learning courses, but the online CS offerings through COURSERA particularly (but EdX and Udacity too, and to include "opensource" initiatives), are large, giving lots of opportunities for blended courses --  again, recalling the "CS major online" (https://my.vanderbilt.edu/douglasfisher/files/2012/02/CSMajorOnline.pdf ). And because CS enrollments are busting at the seams, CS is perhaps an ideal program to be designing and vetting blended learning courses.

My initial thoughts are that "standard format" ("the way" we have always done it) might remain ideal for core classes (we don't want our faculty's skills to atrophy!!!), as well as for electives that correspond to the primary expertise of instructors, but offering electives that blended courses, for which there is limited existing faculty expertise, but for which there would be student (and faculty) interest. My limited experience is that students would like and appreciate this stretch; and I, for one, would love to learn with a group of students in an area that I was not expert in; faculty member as "lead learner" is only one blended model, albeit much different than the CS390 model I have experience with.

Tuesday, November 6, 2012

zen of computing


WAY back in the day, when I was a college senior, I was a peer co-advisor for the computer science (CS) major at the University of California, Irvine (UCI). My partner’s name was also Doug – he was a great guy, a wise-guy gamer type, who complemented my lower-key inner-nerd well. Before subjecting our peers to our advice, UCI put us (and co-advisors of all majors) through mass orientation and training. There was one exercise where each pair of same-major co-advisors was put sitting down, back to back – one person in each pair was handed a strange geometric object, with many faces, different composite shapes on each face, and the other partner was given a sketch pad and pencil. The pair’s task was to transfer understanding of the object from one partner to the other, through verbal question and answers, so that the partner with the pad could later answer (post-training) pre-specified questions, but these questions were unknown a priori to either co-advisor.
The CS team was the only team to complete the task successfully – all correct answers – I don’t think that others were even close!! Yes, I felt good about that and still do :-) , but beyond pumping up my ego (and it did), it started me thinking about what was special about my chosen field of computer science – what kind of thinking and communication, even values, did CS promote that were somewhat unique?
As CEers, we (Doug and Doug) were trained to communicate with the world’s stupidest entity capable of response – we were trained to program computers, and that training gave us a sense of when assumptions were problematic, to spell things out, to reflect on what we said, to recognize where there was ambiguity and seek to disambiguate, and like lessons on communication. The peer-advisor training task described above was made for us, and as we were told afterward, this was a task to illustrate how easy miscommunication was. I had read ‘Zen and the Art of Motorcycle Maintenance’ a few years before as a freshman at UC Santa Cruz, and I naturally thought that there was a zen of Computer Programming (lower case ‘z’, if there is such a thing).
CS was and is a rich source of metaphor – I took its strange and beautiful theoretical abstractions, like the Pumping Lemma, as bare-bone illustrations of life lessons (e.g., that you could screw up repeatedly and still “complete a sentence” — perhaps more later). But the concrete activity of computer programming was rich in metaphor as well. One lesson I internalized from programming is that my thinking is almost always incomplete and/or wrong, if only in the small. When I program a computer I’ll only start writing code when I think that I have a sufficient understanding of the problem and the solution, but even so I’ll produce a sequence of programs that are incorrect in some way, until ideally, I reach the last one in the sequence, which I hope is (entirely) ‘correct’ (maybe I’ll post later on implications of agile design methodology). Any experienced programmer knows though that this ideal of perfect code is never achieved for complex programs. Despite the complexity of the computer programs I’ve written or participated as part of a team in writing, their complexity is trivial compared to the complexity of the world’s real challenges, where there is no doubt that my knowledge is always incomplete – my knee jerk reaction to a fix, in the real world or when programming, is pitifully myopic. I’ll save for another day my thoughts on this shortsightedness, and how it has worsened, even in the limited context of programming, and even in the face (because?) of more powerful technology. In any case, though intellectual humility may grow from programming (we can hope), so does tenacity to see a solution through. Humility and tenacity make for a powerful partnership, one that I think computer scientists can have something of a unique perspective on.
A cousin to my-thinking-is-always-imperfect, again learned from programming, is to strive to see something for what it is, not (prematurely) what I would have it be. I can’t tell you how many times I have looked at computer code I’ve written and missed, over and over again, a bug, because I was projecting what I thought the code “should” be doing rather than what the code actually instructed that the computer do. I’ve had students look at their code for hours trying to debug a program, show the code to someone else, who then spots problems almost immediately – a fresh set of eyes is so important sometimes, and in principle they need not be someone else’s eyes, but often I’m just in a rut and can’t find my way out alone.
Clearly I have the goal of taking the code to an ideal state, but it can’t happen until I see the code for what it actually is. This lesson and generalization from code to other built entities is something I knew as an undergraduate, but it was many years and with much help from others, who sometimes bore sledgehammers :-) , that I internalized this as a lesson about self – seeing who and what I really was as a prerequisite to productive change. Some of these helpers became dear friends.
I’m not sure whether this account seems manufactured – its not – I saw and see grand life lessons, stripped bare but recognizable, in computer programming and computer science generally – recognizing these lessons excited me back in the day, and still does. I hope that CS excites its new practitioners in like ways.

Friday, August 24, 2012

AIs, robots, and humans

In the opening lecture of intro AI (CS 260), I discussed some contrasts between what AIs and robots were capable of, having come a long way, but have a long way to go -- I used these videos to illustrate some points:

   Bigdog (http://www.youtube.com/watch?v=cNZPRsrwumQ); 
   Asimo (http://www.youtube.com/watch?v=Q3C5sc8b3xM); 
   Dr. J (http://www.youtube.com/watch?v=f7njB1T-Xjk); 
   Willie Mays (http://www.youtube.com/watch?v=7dK6zPbkFnE ); 

I'm not sure Asimo could get back up if it fell!!! 

There are differences in mental abilities too (e.g., categorization and pattern matching:  http://www.youtube.com/watch?v=eq-AHmD8xz0 ), but the cognitive prothesis view suggests that AI can be used to augment myopic and otherwise limited human reasoning (e.g., Dan Ariely http://www.youtube.com/watch?v=9X68dm92HVI ) to yield a powerful human/AI hybrid intelligence.