Thursday, June 30, 2016

Politically Correct, Green Computer Algorithms? Bullcrap!

In the last few days I've read several articles that all seem to say the same thing: computer algorithms we use today are biased towards wealthy white men, because they are made by companies in wealthy countries and predominantly by white male developers. Therefore they are inherently racist, misogynistic and wasteful. Nice journalistic metaphors were used such as: "Sea of dudes", "discriminatory code", "green algorithms", etc. I call bullshit!

Computer algorithms need to be, most of all, money makers. If Facebook or Google tweak an algorithm one way or another, the result is immediately apparent in the bottom line because of their huge user count. It may be possible that somehow, by cosmic coincidence, wealthy white males would also be the ones making most purchases, moving the most money, and thus the algorithm may appear biased. But it's not. The algorithm performs as it was supposed to. If a face recognition algorithm classifies black people as gorillas, Asian people as blinking, etc, it's not because the algorithm is racist, but because the data it was provided pointed to that result. If looking for a movie title you get torrent links rather than the official web page of the movie it's because that is what people want more. It's not a glitch, it's the way a machine understands reality. An algorithm is no more racist than the Nazi ovens or the Hiroshima bomb.

What I am trying to say is that code, especially now when it is becoming more and more embedded with machine learning (which is a much better term than the terrible misleading "artificial intelligence"), represents an intersection point between specifications, people biases and data biases, to which you add horrible bugs. Algorithms, just like the way pieces of your brain work, are but elements in a puzzle.

"Well, of course, and to make the entire puzzle more socially responsible, we need to make all pieces socially responsible!" That's stupid. It's like working on the paint of the car to make it go faster. Sure, you can use some over engineered paint to reduce drag, but the engine and the wheels are still going to be more important. Male developers don't decide to tweak an algorithm to make it disregard women any more than a human resources female employee doesn't decide to hire developers based on how much they value women. Owners, managers, money ultimately are what lead to decisions.

Stop trying to appear politically correct when you don't know what you are talking about. If a complex computer algorithm that uses math as its underlying mechanism shows a bias, it's not because statistics are racist, but because the data it was fed was biased. The algorithm in question doesn't reveal the small mindedness of the white developer or of the male mathematician, but a characteristic of the world it sees. Even with people feeding them the wrong data, algorithms are more objective than humans - that is a fact - because often you start developing them before you know what you are looking for; a person always works the other way around. Why not use code to show us where we are wrong, or biased, or angry at how the world is, or plain stupid? We have such a wonderful tool to make judgements from formal principles that we can actually tweak and, instead of scrutinizing the principles, you go nitpicking against the developers and the algorithms. I find it especially humorous to see random data introduced into a generic algorithm producing results that are considered biased because you don't like what you see.

Bottom line: want to change the world and make it better? Here is an algorithm for you: take the world and make it better.

And BTW, I find that constantly accusing developers of being white and male is a form of sexist racism. What do you want me to do? Turn black? If you would truly be unbiased you wouldn't care what is the social structure of your IT department. It's only now when computers matter so much that you are bothered of how much the geeks are getting paid.

Wednesday, June 29, 2016

Bookmark Explorer v2.7 - new features

extension options page Just when I thought I don't have anything else to add, I found new stuff for my Chrome browser extension.

Bookmark Explorer now features:
  • configurable interval for keeping a page open before bookmarking it for Read Later (so that all redirects and icons are loaded correctly)
  • configurable interval after which deleted bookmarks are no longer remembered
  • remembering deleted bookmarks no matter what deletes them
  • more Read Later folders: configure their number and names
  • redesigned options page
  • more notifications on what is going on

The extension most resembles OneTab, in the sense that it is also designed to save you from opening a zillion tabs at the same time, but differs a lot by its ease of use, configurability and the absolute lack of any connection to outside servers: everything is stored in Chrome bookmarks and local storage.

Enjoy!

Sunday, June 26, 2016

Comparing dates in Javascript

The Date object in Javascript is not a primitive, it is a full fledged object, with a constructor and various instances, with methods that mutate their values. That means that the meaning of equality between two dates is ambiguous: what does it mean that date1 equals date2? That they are the same object or that they point to the same instance in time? In Javascript, it means they are the same object. Let me give you some code:
var date1=new Date();
var date2=new Date(date1.getTime()); // now date2 points to the same moment in time as date1
console.log(date1==date2) // outputs "false"
date1=date2;
console.log(date1==date2) // outputs "true", date1 and date2 are pointing to the same object

So, how can we compare two dates? First thought it to turn them into numeric values (how many milliseconds from the beginning of 1970) and compare them. Which works, but looks ugly. Instead of using date1.getTime() == date2.getTime() one might use the fact that the valueOf function of the Date object also returns the same numeric value as getTime and turn the comparison into a substraction instead. To compare the two dates, just check if date2 - date1 == 0.

Friday, June 24, 2016

Facebook page for this blog and chess updates

Clipart of a hand holding a tablet with a facebook page on it I have created a Facebook page for the blog, so if you are tired by my Facebook ramblings and only need the updates for this blog, you can subscribe to it. You may find it here.

Also, I've discovered a bad bug with the chess viewer: it didn't allow manual promotions. If you tried to promote a pawn it would call a component that was not on the page (an ugly component) and then it wouldn't promote anyway because of a bug in the viewer. Hopefully I've solved them both. It mainly affected puzzles like the one I posted today.

Cool chess puzzle from Frédéric Lazard that will wrack your brain!

White to move. Can you draw? Can you win? What would you do? Try - I know it's fucking hard, but do it anyway - to think it through.
[FEN "5kB1/3p1P2/7K/2Pp1P1P/p6p/4P3/7P/8 w - - 0 1"]
1. Kg6 a3 2. h6 a2 3. h7 a1=Q 4. h8=Q Qxh8 (4. .. Qg1+ 5. Kh5 Qxe3 (5. ..
Qg7 6. Qxg7+ Kxg7 7. Kxh4 d4 8. f6+ Kf8 9. c6) 6. Qf6 Qf3+ 7. Kh6 Qf4+ 8.
Kh7) 5. f6 h3 6. Kg5 d4 7. c6 dxc6 8. exd4 c5 (8. .. Qxg8+ 9. fxg8=Q+ Kxg8
10. Kg6 Kf8 11. f7 Ke7 12. Kg7) (8. .. Qh7 9. Bxh7 Kxf7 10. Bg8+ Kxg8 11.
Kg6 Kf8) 9. d5 c4 10. d6 c3 11. d7 c2 12. d8=Q# 1-0


Here is the video for it, from very good channel ChessNetwork:


Enjoy!

Thursday, June 23, 2016

Clippy is baaack! ... on my blog

Clippy: it looks like you are bashing furiously on your keyboard. Do you want me to enable Caps Lock? Clippy is back, thanks to this nice project. So what else could I have done than add it to my blog? Just go to Menu and choose your "Assistant".

If the assistant is set, the messages from the blog come from the assistant. It also follows the mouse as it moves around and does various gestures depending on what one does or reads. Have fun!

Tuesday, June 21, 2016

Oh wow, what a beautiful chess combination.

I will give you this as a puzzle, so please try to figure out that White's move is going to be. This and a lot of cool other puzzles are presented by IM Andrew Martin in the following video.

[Event "Ch URS"]
[Site "Moscow"]
[Date "1956.??.??"]
[Result "1-0"]
[White "Tigran Vartanovich Petrosian"]
[Black "Vladimir Simagin"]
[ECO "A53"]
[PlyCount "95"]

1. Nf3 Nf6 2. c4 c6 3. Nc3 d6 4. d4 g6 5. e4 Bg7 6. Be2 O-O
7. O-O Bg4 8. Be3 Nbd7 9. Nd2 Bxe2 10. Qxe2 e5 11. d5 c5
12. Rab1 Ne8 13. f3 f5 14. b4 cxb4 15. Rxb4 b6 16. a4 Bf6
17. Kh1 Bg5 18. Bg1 Nc7 19. Rbb1 Na6 20. Nb3 Ndc5 21. Nxc5
bxc5 22. exf5 gxf5 23. g4 fxg4 24. Ne4 Bf4 25. Rb7 Nc7
26. fxg4 Ne8 27. g5 Qc8 28. Re7 Qh3 29. Rf3 Qg4 30. Qd3 Bxh2
31. Rxf8+ Kxf8 32. Rxe8+ Rxe8 33. Bxh2 Re7 34. Nxd6 Qxg5
35. Qf1+ Kg8 36. Ne4 Qh4 37. Qe2 Rg7 38. d6 Qh6 39. Qd1 Qh4
40. Qe2 Qh6 41. Qf1 Rf7 42. Qg2+ Kf8 43. Ng5 Qxd6 44. Qa8+ Kg7
45. Bxe5+ Qxe5 46. Qh8+ Kxh8 47. Nxf7+ Kg7 48. Nxe5 1-0


Did you find it? I have to admit I did not. The game is Tigran Vartanovich Petrosian vs Vladimir Simagin, played in 1956.