Wednesday, December 7, 2011
Cryptographically signed streaming video recognition
I just had this idea about doing away with passwords. I was talking to a Toshiba Fellow Alumni who was describing how retinal scans etc. don't work well for remote security, so he was suggesting an n of m of personal possessions with RFID tags. However I was just thinking of combining face recognition of a live video stream, while having each frame of the video signed cryptographically with the current date using a private key belonging to the consumer ... would that give some degree of remote security ...?
Friday, December 2, 2011
Measuring Emotional Involvement in Games
Just reading the interview with Doug Church of Ultima UnderWorld, System Shock, Thief fame in Richard Rouse's Game Design book and grooving on what they were saying about the high emotional intensity of more scripted games (CoD, MoH), versus the greater memorability, but higher risk of more open system games (GTA) and again it takes me back to playing Red Dead Redemption and feeling that there was some great stories and subplots in there, but that sometimes too many of them were thrown at me at once.
I was just thinking again about the mission I got to go save some missing boy, and how when I wandered off in the direction I thought I was supposed to go how I bumped into some prospector mission thing and then a stop-a-lynching mission which got me killed, with both the latter sub-plots seeming unrelated, and I started thinking how maybe I had gone off in the wrong direction and so I was implicitly telling the system I wasn't interested in the lost boy sub-plot (although I think I had accepted the mission), and wouldn't it be great if there was a better proxy for games to tell how emotionally involved a player was in different sub-plots. Of course we're still a ways off from measuring emotions with electrodes, but I wonder if some proxy or correlate could be extracted from game data - although of course that is at least partly what balancing a game is all about.
Of course the reality of real life is that all sorts of "sub-plots" keep popping up and getting in the way, but reality can often conflict with having a good narrative. In the first instance a simple heuristic for keeping track of the number of sub-plots being thrown at a player might be good, however surely RockStar will come up with this and more and throw it into their latest and greatest, and I am unlikely to be hired as narrative consultant any time soon, and I don't have the resources to make those sorts of games, but I wonder if text based narrative games could be made to take advantage of this idea, which brings me back to Zach Tomaszewski and Marlinspike, which I think I really must implement a game in ...
I was just thinking again about the mission I got to go save some missing boy, and how when I wandered off in the direction I thought I was supposed to go how I bumped into some prospector mission thing and then a stop-a-lynching mission which got me killed, with both the latter sub-plots seeming unrelated, and I started thinking how maybe I had gone off in the wrong direction and so I was implicitly telling the system I wasn't interested in the lost boy sub-plot (although I think I had accepted the mission), and wouldn't it be great if there was a better proxy for games to tell how emotionally involved a player was in different sub-plots. Of course we're still a ways off from measuring emotions with electrodes, but I wonder if some proxy or correlate could be extracted from game data - although of course that is at least partly what balancing a game is all about.
Of course the reality of real life is that all sorts of "sub-plots" keep popping up and getting in the way, but reality can often conflict with having a good narrative. In the first instance a simple heuristic for keeping track of the number of sub-plots being thrown at a player might be good, however surely RockStar will come up with this and more and throw it into their latest and greatest, and I am unlikely to be hired as narrative consultant any time soon, and I don't have the resources to make those sorts of games, but I wonder if text based narrative games could be made to take advantage of this idea, which brings me back to Zach Tomaszewski and Marlinspike, which I think I really must implement a game in ...
Tuesday, November 29, 2011
Confusing Mathematics Definitions
What is it with mathematical defintions? Are they deliberately trying to be obtuse? Consider Rosen's definition of a primitive root:
Example: Since all the integers from 1 to 10 appear in Z11 when r=2, 2 is a primitive root of 11. Powers of 2 modulo 11: 2^1 = 2, 2^2 = 4, 2^3 = 8, 2^4 = 5, 2^5 = 10, 2^6 = 9, 2^7 = 7, 2^8 = 3, 2^10 = 1.
A "primitive root" modulo a prime p is an integer r in Zp such that every nonzero element of Zp is a power of r.Wikipedia was no clearer
a primitive root modulo n is any number g with the property that any number coprime to n is congruent to a power of g modulo n. In other words, g is a generator of the multiplicative group of integers modulo n. That is, for every integer a coprime to n, there is an integer k such that gk ≡ a (mod n). Such k is called the index or discrete logarithm of a to the base g modulo n.When after I had unpacked these definitions and looked at several examples my idea of a clear definition would be:
Given a prime p, a “primitive root modulo p” is an integer r such that all of the integers from 1 to p-1 appear in the set Zp. The set Zp consists of powers of r modulo p.Of course, none of these definitions really make much sense without an example:
Example: Since all the integers from 1 to 10 appear in Z11 when r=2, 2 is a primitive root of 11. Powers of 2 modulo 11: 2^1 = 2, 2^2 = 4, 2^3 = 8, 2^4 = 5, 2^5 = 10, 2^6 = 9, 2^7 = 7, 2^8 = 3, 2^10 = 1.
Friday, November 25, 2011
Taxonomy of Game Mechanisms
I've been intrigued by a parallel I've noticed between games created by my students and some concepts from the Stanford AI class, e.g. partial observability
In general in some basic 2d games partial observability of the environment makes the game a lot more fun and I was just playing a sidescroller by one student that imported a somewhat similar mechanism to the old missile command arcade game, and I was wondering if one could create a game mechanism taxonomy like they have for AI agents/environments and use it to predict which sorts of game mechanism combination would be fun and which would not ...
http://www.ferzkopp.net/joomla/science-mainmenu-15/9-ferzkopps-philosophy-work/77-a-heuristic-taxonomy-of-computer-games
http://www.iexbeta.com/wiki/index.php/Video_Game_Taxonomy
but I'm thinking of something finer grained that might link up to the abilities and types of agents playing the games ...
It also makes me think about why watching certain types of sports are compelling. Watching people dodge each other seems to set off interest centers in our brain related to our evolutionary development; being able to dodge away from a sabre-tooth tiger being highly advantageous; which also makes me think of genetic algorithm simulations that show the evolution of rabbits dodging foxes or similar from a talk at the University of Sussex back in the day ...
In general in some basic 2d games partial observability of the environment makes the game a lot more fun and I was just playing a sidescroller by one student that imported a somewhat similar mechanism to the old missile command arcade game, and I was wondering if one could create a game mechanism taxonomy like they have for AI agents/environments and use it to predict which sorts of game mechanism combination would be fun and which would not ...
http://www.ferzkopp.net/joomla/science-mainmenu-15/9-ferzkopps-philosophy-work/77-a-heuristic-taxonomy-of-computer-games
http://www.iexbeta.com/wiki/index.php/Video_Game_Taxonomy
but I'm thinking of something finer grained that might link up to the abilities and types of agents playing the games ...
It also makes me think about why watching certain types of sports are compelling. Watching people dodge each other seems to set off interest centers in our brain related to our evolutionary development; being able to dodge away from a sabre-tooth tiger being highly advantageous; which also makes me think of genetic algorithm simulations that show the evolution of rabbits dodging foxes or similar from a talk at the University of Sussex back in the day ...
Wednesday, November 23, 2011
Stanford AI Class Midterm
Here's my notes on the Stanford AI midterm
Q.1
a) There exists (at least) one environment in which every agent is rational
I take this to mean one environment in which all agents regardless of behavior will optimally achieve their goals, which i think must be false since if you have two agents and we set it up to the first doesn't move and the second does. I guess if we set up so that every action incurs no cost, and every agent is rewarded maximally independent of its behavior
so I am making both the first two true, although I have a strong feeling the instructors wand the first one to be answered false, but I haven't come up with the necessary counter example
regarding the 15 puzzle
a lookup reflex agent will need to have moves for 16! positions that the puzzle can be in, i.e. > 2 trillion, an agent that searches will look at the starting state and consider all the possible moves branching out from there. A depth first search agent will only store a single route to the solution, and then discard that not taking up much space.
There is an upper bound of 4 moves in each state, so the max branching factor of the tree is 4, so depending on the number of steps in the solution there will be #steps^4 nodes in the tree? maximum path to the solution? maximum of 15 moves to get to solution? I think not.., more like 15 moves*16moves, but even then it's much less than 2 trillion.
So I'm probably not reasoning soundly here, but still the answer feels right, i.e. that the lookup table will be larger in terms of memory, but the agent that searches will not do any better ...
Q.2
A*
always expand the the node with the minimum value of the function f = g+h
g(path) = path cost
h(path) = h(state) = estimated distance to the goal
layer 2 is labelled a1-5 from left to right and layer 3 is labelled b1-6 also from left to right
f(top-node) = 0+15 Expanded 1st
f(a1) = 10+11 = 21
f(a2) = 10+8 = 18 Expanded 4th
f(a3) = 10+7 = 17 Expanded 3rd
f(a4) = 10+6 = 16 Expanded 2nd
f(a5) = 10+10 = 20 Expanded 5th
f(b4) = 20+5 = 25
f(b5) = 20+20 = 40
f(b2) = 20+3 = 23
f(b3) = 20+9 = 29
f(b6) = 20 + 0 = 20 Expanded 6th
My checking seems to match my initial guess
Admissible --> h(s) < true cost, i.e. h never overestimates the distance to the goal
and I think this heuristic is not admissible since f(b5) heuristic is 20 when it is only 10 away from the goal, although one might also question whether other b nodes can actually reach the goal node, but they are all underestimating under any assumptions I can think off.
Q.3
P(H) = 0.3
P(F) = 0.7
Q.4
unfair coin
P(HH) = 0.04 + P(H) * P(H) --> P(H) = 0.2
--> P(T) = 0.8
--> P(TT) = 0.64
Q.5
P1(H) = 0.5
P2(H) = 1
pick a coin at random and see a head, what is P(P2|H)
So i think this should be Bayes rule
P(P2|H) = P(H|P2)P(P2)/P(H) where P(H) = P(H|P2)P(P2) + P(H|P1)P(P1)
= 1*0.5/[1*0.5+ 0.5*0.5]
= 0.5/[0.5+0.25]
= 50/75 = 2/3
sense of multiple worlds here very strong. There is the world where we chose the fair coin and a world where we chose the loaded coin. There are two possible coin flip results in the fair world, and only 1 in the loaded world. The evidence suggests we may be in either of two of these three possible states --> but the loaded world must be equally likely to the fair world, so we are twice as likely to be in the loaded world than the fair world ...
now if we see two heads in a row, what is P(P2|HH)
P(P2|HH) = P(HH|P2)P(P2)/P(HH) where P(HH) = P(HH|P2)P(P2) + P(HH|P1)P(P1)
= 1*0.5/[1*0.5+ 0.25*0.5]
= 0.5/[0.5+0.125]
= 500/625 = 8/10
now there is still only one possible loaded world situation, but in the fair world we have four possible coin outputs we might have seen. If we are in the fair world we are in precisely 1 of those four. The chances of being in the loaded world is now four times more likely than being in the fair world
Not sure if I was supposed to be drawing a bayes net here, or if that would help and/or adjust the answer ...
Q.6
very confused now - need to rematch all on C.I.
3.34 D-separation series is the key here
"Any two variables are independent if they are not linked by just unknown variables"
re-looked at all quizzes and homeworks, and changed my initial answer slightly to indicate that A was not conditional independent of C given G, because G tells us about E and E links A and B ERROR HERE SINCE QUESTION IS ABOUT A & C
I am still on the fence about whether A should be conditionally independent of B given F, but in 3.36 F was independent of A given knowledge of H which told us about a child var that linked A and F, but that didn't tell us about the parent of the child var that linked A and F
Q.7
So Hmwk 2.3. explanation is my friend here:
P(B|C) = P(B|C,A)P(A|C) + P(B|C,!A)P(!A|C)
P(B|C) = P(B|A)P(C|A)P(A)/P(C) + P(B|!A)P(C|!A)P(!A)/P(C)
P(B|C) = 0.2*0.8*0.5/0.6 + 0.2*0.4*0.5/0.6 = 0.2
P(C) = P(C|A)P(A) + P(C|!A)P(!A)
P(C) = 0.8*0.5 + 0.4*0.5 = 0.6
P(C|B) = P(C|B,A)P(A|B) + P(C|B,!A)P(!A|B)
P(C|B) = P(C|A)P(B|A)P(A)/P(B) + P(C|!A)P(B|!A)P(!A)/P(B)
P(C|B) = 0.8*0.2*0.5/0.2 + 0.4*0.2*0.5/0.2
P(B) = P(B|A)P(A) + P(B|!A)P(!A)
P(B) = 0.2*0.5 + 0.2*0.5 = 0.2
again, unsure of calculation error but looks like knowledge of each other does not help
Q.8
so my intuition for P(OLD) was actually the MaxLikelihood answer
I redid my spreadsheet for this, eventually getting to what I hope is the right answer. The fractions work out reasonable which suggests to me it might be right as that is what I saw thrun doing in Hmwk 3.2a and b. Feels like I should be able to do this with just pencil and paper, but I don't trust myself to make minor mistakes which is why I put it in the spreadsheet - although I still worry I will have spreadsheet errors ...
ERROR HERE SINCE I DID 4/7 INSTEAD OF 5/7
Q.9
rewatched the K-Nearest Neighbor 5.33 videos, but my initial guess of 7 still seems correct - the suggestion about ties just seems to be confusing since they were never mention in the lecture and superficially all the points seem at different distances from the query point
Q.10
now first time through I just drew a graph and guessed the numbers ... how about linear regression in octave?
octave-3.4.0:2> A = [1,2;3,5.2;4,6.8;5,8.4;9,14.8]
octave-3.4.0:5> X = A(:,1)
octave-3.4.0:6> Y = A(:,2)
octave-3.4.0:10> sum((Y-X).^2)
ans = 58.880
gives me sum of square of differences, but not sure what to do next ...
Going back to 5.36 in the lectures I see thrun deriving
w_0 = 1/M * sum(y) - w_1/M * sum(x)
and
w_1 = M * sum(x*y) - sum(x)*sum(y) * [M * sum(x.^2) - (sum(x))^2]^-1
and I didn't trust myself to derive these correctly
so I can vectorize these:
M = size(X)(1)
w_0 = 1/M * sum(Y) - w_1/M * sum(X)
w_1 = (M * X'*Y - sum(X)*sum(Y)) * [M * sum(X.^2) - (sum(X))^2]^-1
gives
w_1 = 1.6 guessed 0.642
w_0 = 0.40000 guessed 1
so plotting those I get an exact match suggesting I could have intuited this without the math if I had drawn it precisely ... :-) my first guess based on hand plot was well off ... :-)
plot(X,Y)
hold on
XT = [0;1;2;3;4;5;6;7;8;9]
YT = w_0 + w_1 * XT
plot(XT,YT,'r')
still pondering over relation between NNs, linear regression and statistical significance
Q.11
initial intuition appears wrong after watching 6.5 on k means clustering which suggests the initial division of the space is done by drawing a line of equidistance between C1 and C2 indicating that only one point will get associated with C1
Q.12
so this should be straightforward
Valid --> always true
Satisfiable --> true or false
Unsatisfiable --> always false
My initial guess on (A&&!A)->(B->C) appears wrong as I, as usual, incorrectly remembered the logical form of implication
Truth table appears to confirm my intuition that (A->B)&&(B->C)&&(C->A) is satisfiable - my intuition based on finding cases where it would be false and where it would be true
My intuition about the equivalence of A->B&&B->C and A->C seems disproved by truth table - if A is true and B is false and C is true then A->B is false and A->C is true COUNTEREXAMPLE
Q.13
seemed possible to answer this from common sense rather than applying any particular knowledge from the course
my second pass on it including review of the clarifications doesn't throw up anything of concern ...
Q.14
could spin wheels here and the answer from value iteration might well be my best guess, which is subtract five going back into each of the states
actually explanation in 9.18 quiz gives solution for deterministic case giving me higher confidence here.
Q.15
mental mistake - thought that laplacian smoothing would involve +4 on the denominator since there are four possible transitions, but it is only +2 as we are simply considering possible transitions from a single state in a two state model?
Also I had them grouped wrong initially - need to group by state we are coming from
AAAAB
F(A|A) = 3
F(B|A) = 1
F(A|B) = 0
F(B|B) = 0
P(A_0) = (1+1)/(1+2)
P(A|A) = (3+1)/(4+2)
P(A|B) = (0+1)/(0+2)
Q.1
a) There exists (at least) one environment in which every agent is rational
I take this to mean one environment in which all agents regardless of behavior will optimally achieve their goals, which i think must be false since if you have two agents and we set it up to the first doesn't move and the second does. I guess if we set up so that every action incurs no cost, and every agent is rewarded maximally independent of its behavior
so I am making both the first two true, although I have a strong feeling the instructors wand the first one to be answered false, but I haven't come up with the necessary counter example
regarding the 15 puzzle
a lookup reflex agent will need to have moves for 16! positions that the puzzle can be in, i.e. > 2 trillion, an agent that searches will look at the starting state and consider all the possible moves branching out from there. A depth first search agent will only store a single route to the solution, and then discard that not taking up much space.
There is an upper bound of 4 moves in each state, so the max branching factor of the tree is 4, so depending on the number of steps in the solution there will be #steps^4 nodes in the tree? maximum path to the solution? maximum of 15 moves to get to solution? I think not.., more like 15 moves*16moves, but even then it's much less than 2 trillion.
So I'm probably not reasoning soundly here, but still the answer feels right, i.e. that the lookup table will be larger in terms of memory, but the agent that searches will not do any better ...
Q.2
A*
always expand the the node with the minimum value of the function f = g+h
g(path) = path cost
h(path) = h(state) = estimated distance to the goal
layer 2 is labelled a1-5 from left to right and layer 3 is labelled b1-6 also from left to right
f(top-node) = 0+15 Expanded 1st
f(a1) = 10+11 = 21
f(a2) = 10+8 = 18 Expanded 4th
f(a3) = 10+7 = 17 Expanded 3rd
f(a4) = 10+6 = 16 Expanded 2nd
f(a5) = 10+10 = 20 Expanded 5th
f(b4) = 20+5 = 25
f(b5) = 20+20 = 40
f(b2) = 20+3 = 23
f(b3) = 20+9 = 29
f(b6) = 20 + 0 = 20 Expanded 6th
My checking seems to match my initial guess
Admissible --> h(s) < true cost, i.e. h never overestimates the distance to the goal
and I think this heuristic is not admissible since f(b5) heuristic is 20 when it is only 10 away from the goal, although one might also question whether other b nodes can actually reach the goal node, but they are all underestimating under any assumptions I can think off.
Q.3
P(H) = 0.3
P(F) = 0.7
Q.4
unfair coin
P(HH) = 0.04 + P(H) * P(H) --> P(H) = 0.2
--> P(T) = 0.8
--> P(TT) = 0.64
Q.5
P1(H) = 0.5
P2(H) = 1
pick a coin at random and see a head, what is P(P2|H)
So i think this should be Bayes rule
P(P2|H) = P(H|P2)P(P2)/P(H) where P(H) = P(H|P2)P(P2) + P(H|P1)P(P1)
= 1*0.5/[1*0.5+ 0.5*0.5]
= 0.5/[0.5+0.25]
= 50/75 = 2/3
sense of multiple worlds here very strong. There is the world where we chose the fair coin and a world where we chose the loaded coin. There are two possible coin flip results in the fair world, and only 1 in the loaded world. The evidence suggests we may be in either of two of these three possible states --> but the loaded world must be equally likely to the fair world, so we are twice as likely to be in the loaded world than the fair world ...
now if we see two heads in a row, what is P(P2|HH)
P(P2|HH) = P(HH|P2)P(P2)/P(HH) where P(HH) = P(HH|P2)P(P2) + P(HH|P1)P(P1)
= 1*0.5/[1*0.5+ 0.25*0.5]
= 0.5/[0.5+0.125]
= 500/625 = 8/10
now there is still only one possible loaded world situation, but in the fair world we have four possible coin outputs we might have seen. If we are in the fair world we are in precisely 1 of those four. The chances of being in the loaded world is now four times more likely than being in the fair world
Not sure if I was supposed to be drawing a bayes net here, or if that would help and/or adjust the answer ...
Q.6
very confused now - need to rematch all on C.I.
3.34 D-separation series is the key here
"Any two variables are independent if they are not linked by just unknown variables"
re-looked at all quizzes and homeworks, and changed my initial answer slightly to indicate that A was not conditional independent of C given G, because G tells us about E and E links A and B ERROR HERE SINCE QUESTION IS ABOUT A & C
I am still on the fence about whether A should be conditionally independent of B given F, but in 3.36 F was independent of A given knowledge of H which told us about a child var that linked A and F, but that didn't tell us about the parent of the child var that linked A and F
Q.7
So Hmwk 2.3. explanation is my friend here:
P(B|C) = P(B|C,A)P(A|C) + P(B|C,!A)P(!A|C)
P(B|C) = P(B|A)P(C|A)P(A)/P(C) + P(B|!A)P(C|!A)P(!A)/P(C)
P(B|C) = 0.2*0.8*0.5/0.6 + 0.2*0.4*0.5/0.6 = 0.2
P(C) = P(C|A)P(A) + P(C|!A)P(!A)
P(C) = 0.8*0.5 + 0.4*0.5 = 0.6
P(C|B) = P(C|B,A)P(A|B) + P(C|B,!A)P(!A|B)
P(C|B) = P(C|A)P(B|A)P(A)/P(B) + P(C|!A)P(B|!A)P(!A)/P(B)
P(C|B) = 0.8*0.2*0.5/0.2 + 0.4*0.2*0.5/0.2
P(B) = P(B|A)P(A) + P(B|!A)P(!A)
P(B) = 0.2*0.5 + 0.2*0.5 = 0.2
again, unsure of calculation error but looks like knowledge of each other does not help
Q.8
so my intuition for P(OLD) was actually the MaxLikelihood answer
I redid my spreadsheet for this, eventually getting to what I hope is the right answer. The fractions work out reasonable which suggests to me it might be right as that is what I saw thrun doing in Hmwk 3.2a and b. Feels like I should be able to do this with just pencil and paper, but I don't trust myself to make minor mistakes which is why I put it in the spreadsheet - although I still worry I will have spreadsheet errors ...
ERROR HERE SINCE I DID 4/7 INSTEAD OF 5/7
Q.9
rewatched the K-Nearest Neighbor 5.33 videos, but my initial guess of 7 still seems correct - the suggestion about ties just seems to be confusing since they were never mention in the lecture and superficially all the points seem at different distances from the query point
Q.10
now first time through I just drew a graph and guessed the numbers ... how about linear regression in octave?
octave-3.4.0:2> A = [1,2;3,5.2;4,6.8;5,8.4;9,14.8]
octave-3.4.0:5> X = A(:,1)
octave-3.4.0:6> Y = A(:,2)
octave-3.4.0:10> sum((Y-X).^2)
ans = 58.880
gives me sum of square of differences, but not sure what to do next ...
Going back to 5.36 in the lectures I see thrun deriving
w_0 = 1/M * sum(y) - w_1/M * sum(x)
and
w_1 = M * sum(x*y) - sum(x)*sum(y) * [M * sum(x.^2) - (sum(x))^2]^-1
and I didn't trust myself to derive these correctly
so I can vectorize these:
M = size(X)(1)
w_0 = 1/M * sum(Y) - w_1/M * sum(X)
w_1 = (M * X'*Y - sum(X)*sum(Y)) * [M * sum(X.^2) - (sum(X))^2]^-1
gives
w_1 = 1.6 guessed 0.642
w_0 = 0.40000 guessed 1
so plotting those I get an exact match suggesting I could have intuited this without the math if I had drawn it precisely ... :-) my first guess based on hand plot was well off ... :-)
plot(X,Y)
hold on
XT = [0;1;2;3;4;5;6;7;8;9]
YT = w_0 + w_1 * XT
plot(XT,YT,'r')
still pondering over relation between NNs, linear regression and statistical significance
Q.11
initial intuition appears wrong after watching 6.5 on k means clustering which suggests the initial division of the space is done by drawing a line of equidistance between C1 and C2 indicating that only one point will get associated with C1
Q.12
so this should be straightforward
Valid --> always true
Satisfiable --> true or false
Unsatisfiable --> always false
My initial guess on (A&&!A)->(B->C) appears wrong as I, as usual, incorrectly remembered the logical form of implication
Truth table appears to confirm my intuition that (A->B)&&(B->C)&&(C->A) is satisfiable - my intuition based on finding cases where it would be false and where it would be true
My intuition about the equivalence of A->B&&B->C and A->C seems disproved by truth table - if A is true and B is false and C is true then A->B is false and A->C is true COUNTEREXAMPLE
Q.13
seemed possible to answer this from common sense rather than applying any particular knowledge from the course
my second pass on it including review of the clarifications doesn't throw up anything of concern ...
Q.14
could spin wheels here and the answer from value iteration might well be my best guess, which is subtract five going back into each of the states
actually explanation in 9.18 quiz gives solution for deterministic case giving me higher confidence here.
Q.15
mental mistake - thought that laplacian smoothing would involve +4 on the denominator since there are four possible transitions, but it is only +2 as we are simply considering possible transitions from a single state in a two state model?
Also I had them grouped wrong initially - need to group by state we are coming from
AAAAB
F(A|A) = 3
F(B|A) = 1
F(A|B) = 0
F(B|B) = 0
P(A_0) = (1+1)/(1+2)
P(A|A) = (3+1)/(4+2)
P(A|B) = (0+1)/(0+2)
Friday, November 18, 2011
intuitive motion specifier
I keep having an idea in slightly different forms about how it would be cool to be able to move elements in some GUI and then have the code for doing that appear automatically. I was first thinking about this in the context of having my young son learning to program. I tried Alice and Scratch and a few other kid friendly software kits, but surprisingly none of them had the ability for the user to move an element around, i.e. intuitively specify what it's behaviour should be, and then have that stored as a behaviour that could be repeated, reversed etc.
The same idea came to me again in the context of game design, e.g. in a game editor like GameMaker or Unity3D is would be great to be able to "show" the system what kind of motion you wanted, and have the corresponding behaviour appear in the editor in a form that could be manipulated. Of course it wouldn't work simply for all behaviours. Getting one object to follow another would be trickier.
The thing at the moment is that I can't see how to add such functionality to any of the existing systems that I have looked at without geting very deeply involved in them. I could build a demonstration interface in JavaScript, but by itself it wouldn't be able to do very much. I have the feeling that eventually this functionality will appear somewhere and some people will go "oh cool" and I will be kicking myself for having not done anything with the idea, or it is already present in some software somewhere that I just haven't found yet ...
The same idea came to me again in the context of game design, e.g. in a game editor like GameMaker or Unity3D is would be great to be able to "show" the system what kind of motion you wanted, and have the corresponding behaviour appear in the editor in a form that could be manipulated. Of course it wouldn't work simply for all behaviours. Getting one object to follow another would be trickier.
The thing at the moment is that I can't see how to add such functionality to any of the existing systems that I have looked at without geting very deeply involved in them. I could build a demonstration interface in JavaScript, but by itself it wouldn't be able to do very much. I have the feeling that eventually this functionality will appear somewhere and some people will go "oh cool" and I will be kicking myself for having not done anything with the idea, or it is already present in some software somewhere that I just haven't found yet ...
Friday, August 26, 2011
HPU Internet Programming Student Project Showcase
I've put together a showcase of some student projects from last years internet programming course. Check it out:
https://sites.google.com/site/hpustudentprojectshowcase/csci3632-internetprogramming
I'm teaching the same course again this fall:
http://www.techhui.com/events/csci-3632-internet-programming
and the course is open to non-HPU students in case anyone is interested :-)
Friday, May 27, 2011
Test blog from iPhone app blogspace
Wonder if this supports georss? Apparently not, but it seems I can add a location using the draft blogger web interface. I am guessing that means I probably can't access that from the blogger API?
http://code.google.com/apis/blogger/docs/2.0/developers_guide_protocol.html#CreatingPublicEntries
No mention of it above. Guess it might work - should definitely try the android blogger app first, but my motorola droid will not play nice with any of the BT wireless hubs I have tried. It would connect but then kill my BTHomeHub, and now it just repeatedly connects very briefly, disconnects and the re-connects on my BTBusinessHub. But it works just fine on the public WiFi I have tried at coffee shops in the UK. Motorola Droid and BT Wifi just don't seem to mix well. Maybe I will have to buy a new droid phone in the UK ...
Of course, what I really, really, really want, is a mobile app that allows me to voice record a blog post, post it to blogger with a georss tag, and then have that auto-published into MyMaps so that everyone can view a Sam's blog layer on their Google Android Map apps ...
http://code.google.com/apis/blogger/docs/2.0/developers_guide_protocol.html#CreatingPublicEntries
No mention of it above. Guess it might work - should definitely try the android blogger app first, but my motorola droid will not play nice with any of the BT wireless hubs I have tried. It would connect but then kill my BTHomeHub, and now it just repeatedly connects very briefly, disconnects and the re-connects on my BTBusinessHub. But it works just fine on the public WiFi I have tried at coffee shops in the UK. Motorola Droid and BT Wifi just don't seem to mix well. Maybe I will have to buy a new droid phone in the UK ...
Of course, what I really, really, really want, is a mobile app that allows me to voice record a blog post, post it to blogger with a georss tag, and then have that auto-published into MyMaps so that everyone can view a Sam's blog layer on their Google Android Map apps ...
Google MyMaps does more!
So along with some friends I have been tinkering with mobile GeoRSS ideas for a while. George Lee published iGeoRSS to the iPhone app store after some discussions we had. I have been talking about doing an Android version for a while, and the other day I saw someone beat me to it:
https://market.android.com/details?id=com.kcInc.newsSurfer&feature=search_result
Although in principle there would still be room for others. However I just updated Google Maps on my Android phone, partly because I had read in a Distimo report that:
Not that that is a reason to give up completely, but I just noticed two (relatively?) new features in Google MyMaps. One is the ability to import GeoRSS feeds into your Google MyMaps, and the other is the ability to open up editing of MyMaps to anyone. So in principle all the things that I was hoping to achieve with a mobile GeoRSS app are in place, as you view all your Google MyMaps as layers in the Google Maps app on android.
So for example I just created a Google MyMap called "Sam's Restaurant Recommendations", which I can see on my android Google Map app. I might actually keep this one just for me to edit :-) but I have made a local news MyMap and opened it for anyone to edit, as well as making it public. Now of course, that's going to scale poorly and probably hit Google MyMap size limits if everyone in the world were to throw in all their local news, and I still haven't found many news sources spitting out geotagged feeds.
I did find this geotagged press release feed, and I tried importing it into my local news MyMap, and it grabbed at least the first item:
http://www.earthpublisher.com/georss.php
and when I viewed it on my android phone, I could see the whole feed. Now in principle anyone could keep adding to this, and everyone could see it on their phones, and we would have a shared geo-overlay system, which is probably Google's intention ...
What I'd really want is an API access to the MyMaps data so that old news could be moved off to an archive etc., and I'm not sure if that's available yet. Also, it's not clear to me how public mymaps can actually be discovered, and whether I would specifically have to invite people to a map for them to access it on their android phone ...
https://market.android.com/details?id=com.kcInc.newsSurfer&feature=search_result
Although in principle there would still be room for others. However I just updated Google Maps on my Android phone, partly because I had read in a Distimo report that:
Google Maps is the only application with more than 50 million downloads in the Google Android Market, making it the all-time most popular application in this storeOne of the disincentives for creating a map app for either iPhone or Android, is that pretty much everyone is using the Google maps app anyway, and there also have been restrictions about 3rd party developers adding things like direction support to their map apps, which is like the most mega-useful thing; and so it feels like pushing out a map app will mean always lagging behind Google's own app.
Not that that is a reason to give up completely, but I just noticed two (relatively?) new features in Google MyMaps. One is the ability to import GeoRSS feeds into your Google MyMaps, and the other is the ability to open up editing of MyMaps to anyone. So in principle all the things that I was hoping to achieve with a mobile GeoRSS app are in place, as you view all your Google MyMaps as layers in the Google Maps app on android.
So for example I just created a Google MyMap called "Sam's Restaurant Recommendations", which I can see on my android Google Map app. I might actually keep this one just for me to edit :-) but I have made a local news MyMap and opened it for anyone to edit, as well as making it public. Now of course, that's going to scale poorly and probably hit Google MyMap size limits if everyone in the world were to throw in all their local news, and I still haven't found many news sources spitting out geotagged feeds.
I did find this geotagged press release feed, and I tried importing it into my local news MyMap, and it grabbed at least the first item:
http://www.earthpublisher.com/georss.php
and when I viewed it on my android phone, I could see the whole feed. Now in principle anyone could keep adding to this, and everyone could see it on their phones, and we would have a shared geo-overlay system, which is probably Google's intention ...
What I'd really want is an API access to the MyMaps data so that old news could be moved off to an archive etc., and I'm not sure if that's available yet. Also, it's not clear to me how public mymaps can actually be discovered, and whether I would specifically have to invite people to a map for them to access it on their android phone ...
Monday, May 23, 2011
Sexbot Turing Test
My friend Robert Brewer sent me a link to this Sexbot Turing test:
http://www.collisiondetection.net/mt/archives/2011/05/lets_get_this_p.php
which reminded me of a chapter from "Parsing the Turing Test" by Mark Humphrys called "How My Program Passed the Turing Test" in which he describes a chatbot called Jenny18 that apparently brought a user to orgasm; arguably an alternate form or Turing Test.
http://www.compapp.dcu.ie/~humphrys/eliza.html
http://www.compapp.dcu.ie/~humphrys/Eliza/eliza.anon.html
It certainly seems like the Porn/Sex industry will be quick to adopt any advances in chatbot technology. Makes me start thinking that any breakthrough in natural language could lead to an explosion in sophisticated bots taking advantage of a larger and larger proportion of the population. Once the AIs are smarter than we are there will be no more "send money to Nigeria" scams, but more sophisticated bots that will engage you in conversation and pin down your needs and desires before fleecing you :-)
http://www.collisiondetection.net/mt/archives/2011/05/lets_get_this_p.php
which reminded me of a chapter from "Parsing the Turing Test" by Mark Humphrys called "How My Program Passed the Turing Test" in which he describes a chatbot called Jenny18 that apparently brought a user to orgasm; arguably an alternate form or Turing Test.
http://www.compapp.dcu.ie/~humphrys/eliza.html
http://www.compapp.dcu.ie/~humphrys/Eliza/eliza.anon.html
It certainly seems like the Porn/Sex industry will be quick to adopt any advances in chatbot technology. Makes me start thinking that any breakthrough in natural language could lead to an explosion in sophisticated bots taking advantage of a larger and larger proportion of the population. Once the AIs are smarter than we are there will be no more "send money to Nigeria" scams, but more sophisticated bots that will engage you in conversation and pin down your needs and desires before fleecing you :-)
Friday, May 20, 2011
MySQL Logging
Getting MySQL logging turned on in OSX turned out to be rather time-consuming.
Some key sticking points were working out that the mysql config was in /etc/my.cnf and that my attempts to restart the MySQL server were actually being ignored. It was not until I killed all the mysql processes and then "started" them again that the logging started working.
I found various helpful posts:
http://serverfault.com/questions/71071/how-to-enable-mysql-logging
Entries in the MySQL documentation:
http://dev.mysql.com/doc/refman/5.0/en/query-log.html
However part of the problem was that although in principle logging can be turned on and off from within the running MySQL instance, there is a bug in 5.0 that prevents this, and although it has been fixed in 5.1, I was unclear about how to upgrade. My previous attempt at getting ports to start working again after my transition to Snow Leopard had ending up installing a completely new instance of MySQL in a new location and with no access to my old data.
Some key sticking points were working out that the mysql config was in /etc/my.cnf and that my attempts to restart the MySQL server were actually being ignored. It was not until I killed all the mysql processes and then "started" them again that the logging started working.
I found various helpful posts:
http://serverfault.com/questions/71071/how-to-enable-mysql-logging
Entries in the MySQL documentation:
http://dev.mysql.com/doc/refman/5.0/en/query-log.html
However part of the problem was that although in principle logging can be turned on and off from within the running MySQL instance, there is a bug in 5.0 that prevents this, and although it has been fixed in 5.1, I was unclear about how to upgrade. My previous attempt at getting ports to start working again after my transition to Snow Leopard had ending up installing a completely new instance of MySQL in a new location and with no access to my old data.
Thursday, January 20, 2011
Scooba gives birth to a ... Roomba!
So given that I was reasonably impressed with our Scooba floor washing robot, I used the simple breeding technique of placing an order for a Roomba at irobot.com and lo and behold several days later a stork arrived with another bundle of joy. Well, I say stork, okay, okay, so it was a guy in a van, but the Roomba is pretty much a bundle of joy.
While I was assembling the new toy storage unit from Ikea my 3 helpers had a great time disassembling the polystyreen packaging that came with it, to the cries of "Snow! Snow!" and so although the Ikea unit was ready, the boys bedroom needed a thorough hoovering before the unit could be installed. To my wife's annoyance I had purchased the Roomba, but not a vacuum cleaner. However the Roomba proved pretty adept at picking up the polystyrene, as well as keeping the children entertained during the process.
This Roomba comes with its own charging station; although I have yet to test its supposed ability to get to the charing station by itself. It was very helpful and it felt like much less effort to use than the Scooba. No need to fill it with water and cleaning solution; no cryptic warnings about overnight charging. Just charge and go. It also seemed to cope with rough terrain better than the Scooba, and was pretty effective at telling me (via recorded audio) when it got indigestion from scooping up the odd child's toy. Emptying it was pretty easy, although I made a few more messes before I completely understood the process, which I reccommend performing inside a plastic bag. Fortunately the Roomba was there to clean up those messes, and I think it avoided falling down the stairs, although I didn't actually see that bit ...
Anyhow, lots more testing (and ultimately pimping) to do here, but now I am fully equipped to do a couple of weeks Roomba hacking as part of the my online AI course that starts next week.
While I was assembling the new toy storage unit from Ikea my 3 helpers had a great time disassembling the polystyreen packaging that came with it, to the cries of "Snow! Snow!" and so although the Ikea unit was ready, the boys bedroom needed a thorough hoovering before the unit could be installed. To my wife's annoyance I had purchased the Roomba, but not a vacuum cleaner. However the Roomba proved pretty adept at picking up the polystyrene, as well as keeping the children entertained during the process.
This Roomba comes with its own charging station; although I have yet to test its supposed ability to get to the charing station by itself. It was very helpful and it felt like much less effort to use than the Scooba. No need to fill it with water and cleaning solution; no cryptic warnings about overnight charging. Just charge and go. It also seemed to cope with rough terrain better than the Scooba, and was pretty effective at telling me (via recorded audio) when it got indigestion from scooping up the odd child's toy. Emptying it was pretty easy, although I made a few more messes before I completely understood the process, which I reccommend performing inside a plastic bag. Fortunately the Roomba was there to clean up those messes, and I think it avoided falling down the stairs, although I didn't actually see that bit ...
Anyhow, lots more testing (and ultimately pimping) to do here, but now I am fully equipped to do a couple of weeks Roomba hacking as part of the my online AI course that starts next week.
Wednesday, January 19, 2011
Comparing iOS, Android, Windows Mobile 7
So as part of the preparation for the online mobile programming and mobile design courses I am about to teach I re-created a simple iPhone calculator app in Android and WindowsMobile7.
The interface design was definitely the easiest for the iPhone, with Apple's "Inteface Builder" making it very easy to get a good layout of keys without too much fuss, and the only one to support direct editing of the labels on the keys themselves. Having linked up the first calculator key so that copied and pasted ones had the same code linkage meant that associating key presses with actions was simpler for iPhone, but the Objective C code did seem to end up a little more convoluted than either Java or C#.
The windows mobile interface construction, strongly remeniscent of Visual Basic, was second best. Not quite as good as for the iPhone, but definitely better than Android. Unsurprsingly the C# and Java code was nearly identical.
The up side for Android was that the refactoring tools (part of the Eclipse IDE) are definitely the best. There is some support for refactoring in VisualStudio, but I believe it is more fully featured in Eclipse, and practically non-existant in Xcode for the iPhone.
Thursday, January 13, 2011
Can a Machine win at Jeopardy?
So it turns out that on Valentines day this year that Watson, a computer system designed by IBM will be taking part as a contestant in a special televised edition of Jeopardy during which Watson will compete against two Jeopardy champions.
IBM has some very excited videos and website. I think the video I've embedded below is a great teaser video. It took me a while to find their slightly calmer FAQ that reveals more about the background of Watson than is in most of videos, including the open source framework that is Watson's principal infrastructure for assembling, scaling-out and deploying its analytic components. This special Jeopardy challenge event takes place just three weeks into the Artificial Intelligence course I'm teaching this semester and you can bet I'll spend a week on it and some of the open source components behind it!
IBM has some very excited videos and website. I think the video I've embedded below is a great teaser video. It took me a while to find their slightly calmer FAQ that reveals more about the background of Watson than is in most of videos, including the open source framework that is Watson's principal infrastructure for assembling, scaling-out and deploying its analytic components. This special Jeopardy challenge event takes place just three weeks into the Artificial Intelligence course I'm teaching this semester and you can bet I'll spend a week on it and some of the open source components behind it!
Tuesday, January 11, 2011
Pimp my robot!
So I was having ideas about how I could improve my Scooba and whether I could hack it up, and I stumbled across this very very cool book/website. Now I am not a big fan of the new Battlestar Gallactica but a Cylon Roomba is just awesome!
In Hacking Roomba, Tod Kurt apparently shows us how to drive a Roomba, make it sing, turn it into a painter, put it on your Wifi network, add webcams and install Linux, amongst other things. I am totally adding this to the textbook list for the AI course I am teaching online this semester. Would love to see some students doing AI Roomba projects!
In Hacking Roomba, Tod Kurt apparently shows us how to drive a Roomba, make it sing, turn it into a painter, put it on your Wifi network, add webcams and install Linux, amongst other things. I am totally adding this to the textbook list for the AI course I am teaching online this semester. Would love to see some students doing AI Roomba projects!
Hacked up Roomba Obeys your commands via XBox Kinect
I love this video of the KinectBot that my friend Wilson Tang sent me on Facebook. An MIT robotics student has hacked up a Roomba and added an Xbox Kinect sensor so that the Roomba can obey gestural commands from humans and put together a 3D model of the environment. If I can get more details we'll certainly include them in my online AI course this semester.
Living with a Robot
So we've used floor washing Scooba robot a few nights in a row now. In fact we've used up all the free cleaner that came with the robot and are now planning to switch to the alternative "60ml of vinegar". Some issues have come up in that it often gets stuck on an uneven portion of our kitchen floor. When this happens it makes a childish "uh-oh" sound, and you have to go free it. Not such a big deal although when it does that three times in a row it's a bit of a pain.
Part of the issue for me is that I run it at the end of day, so I want to go off and watch some comedy on telly and fold the laundry and try to relax, and it's irritating to have to go help the robot, and even more irritating if I don't hear it getting stuck and then come to find it hasn't finished cleaning and I have to reset it and can't go to bed at the time I want because I have to wait for it to finish so that I can drain the tanks and leave all the different parts out to try. I imagine this is a particular issue for the Scooba that the Roomba vacuum cleaning robot owners don't encounter; will have to get a Roomba and report back!
Also I am having trouble working out a good charging cycle for the battery. The first overnight charge gave fine performance for the first clean, but the second clean the following day failed half way through due to lack of battery power. The manual says don't leave it charging over night except the first time, which is fair enough, but then when should I charge it and for how long? The most convenient for me would be to leave it charging when the tanks are drying, which based on how long I sleep is about 7 hours. Too long? I tried an hour charge previously and that wasn't enough. My options appear to be either to remember to start a charge before supper each day, or just give it an overnight 7 hour charge each day. Having the Scooba run out of power is just as irritating as it getting stuck un-noticed; means I have to stay up, or throw away half a tank of cleaning solution.
I have resolved the getting stuck on raised tiling problem by leaving a heavy box (of beer) on the place where the Scooba often runs aground. Interesting that before coming up with that solution that I might have argued that the Robot should learn a map of the kitchen and work out to avoid the sticking point, but now I could almost argue that would be wasted effort on the part of the engineers. To the extent that I have a good model of what the robot is doing (spinning, wall following and room crossing), I can adjust its behaviour effectively by small changes to the environment. The Scooba/Roomba really is an a very interesting intersection point between the two of the courses I am teaching this semester. Mobile Design at least partially inspired by Don Norman's "Design of Everyday Things" for which understanding users conceptual models is very important, and Artificial Intelligence, which covers the ongoing fight between high level mental models and low-level behaviour based robots and AI systems.
Part of the issue for me is that I run it at the end of day, so I want to go off and watch some comedy on telly and fold the laundry and try to relax, and it's irritating to have to go help the robot, and even more irritating if I don't hear it getting stuck and then come to find it hasn't finished cleaning and I have to reset it and can't go to bed at the time I want because I have to wait for it to finish so that I can drain the tanks and leave all the different parts out to try. I imagine this is a particular issue for the Scooba that the Roomba vacuum cleaning robot owners don't encounter; will have to get a Roomba and report back!
Also I am having trouble working out a good charging cycle for the battery. The first overnight charge gave fine performance for the first clean, but the second clean the following day failed half way through due to lack of battery power. The manual says don't leave it charging over night except the first time, which is fair enough, but then when should I charge it and for how long? The most convenient for me would be to leave it charging when the tanks are drying, which based on how long I sleep is about 7 hours. Too long? I tried an hour charge previously and that wasn't enough. My options appear to be either to remember to start a charge before supper each day, or just give it an overnight 7 hour charge each day. Having the Scooba run out of power is just as irritating as it getting stuck un-noticed; means I have to stay up, or throw away half a tank of cleaning solution.
I have resolved the getting stuck on raised tiling problem by leaving a heavy box (of beer) on the place where the Scooba often runs aground. Interesting that before coming up with that solution that I might have argued that the Robot should learn a map of the kitchen and work out to avoid the sticking point, but now I could almost argue that would be wasted effort on the part of the engineers. To the extent that I have a good model of what the robot is doing (spinning, wall following and room crossing), I can adjust its behaviour effectively by small changes to the environment. The Scooba/Roomba really is an a very interesting intersection point between the two of the courses I am teaching this semester. Mobile Design at least partially inspired by Don Norman's "Design of Everyday Things" for which understanding users conceptual models is very important, and Artificial Intelligence, which covers the ongoing fight between high level mental models and low-level behaviour based robots and AI systems.
Friday, January 7, 2011
Scooba robot cleans my kitchen floor, fairly well ...
So I went out and bought the iRobot Scooba, floor washing robot. Well I say went out and bought, I got it online, so no going out needed. I had been thinking about this for a while since I seemed to spend at least five minutes a night on my hands and knees clearing up food debris by my five year old and two year old twins. The Scooba cost me 400GBP, which is a chunk, but if it works well it will pay for itself in terms of my time in about a month and a half; based on my consulting fee of approx 100GBP an hour.
It did a reasonable job last night, although it did miss a few hard to reach spots such as just next to where the washing machine sticks out from the other shelving, but overall I'm pretty pleased. There was some good ground in food debris, most of which came up. It will be interesting to see how clean it can get things if we use it daily.
We didn't save much time last night as we spent a good half an hour watching the Scooba move around the kitchen. We saw all the behaviours described in the instructions including spiraling, wall following and room crossing. This is a great example of behaviour-based robotics which we'll be covering in the Artificial Intelligence course I'm teaching online at Hawaii Pacific University this Spring.
It did a reasonable job last night, although it did miss a few hard to reach spots such as just next to where the washing machine sticks out from the other shelving, but overall I'm pretty pleased. There was some good ground in food debris, most of which came up. It will be interesting to see how clean it can get things if we use it daily.
We didn't save much time last night as we spent a good half an hour watching the Scooba move around the kitchen. We saw all the behaviours described in the instructions including spiraling, wall following and room crossing. This is a great example of behaviour-based robotics which we'll be covering in the Artificial Intelligence course I'm teaching online at Hawaii Pacific University this Spring.
Subscribe to:
Posts (Atom)