Support Vector Machines and dimensionality

When I was introduced to support vector machines I initially thought: this is great, the method takes care of irrelevant dimensions. My intuition was that since the algorithm tilts hyperplanes to cut the space, adding irrelevant dimensions does not matter at all, since the hyperplane would just lie parallel to the irrelevant dimensions. Practically speaking,… Read More Support Vector Machines and dimensionality

exiftool batch mode

exiftool has a batch mode. If you pass the argument -stay_open True, exiftool accepts multiple commands. This is invaluable if you call exiftool from another program because you avoid the overhead of loading/unloading the program everytime. exiftool can also return data formatted as JSON, which python knows how to handle, allowing us to pass formatted… Read More exiftool batch mode

Running a task in a separate thread in a Tkinter app.

Use Queues to communicate between main thread and sub-thread Use wm_protocol/protocol to handle quit event Use Event to pass a message to sub-thread import Tkinter as tki, threading, Queue, timedef thread(q, stop_event): “””q is a Queue object, stop_event is an Event. stop_event from http://stackoverflow.com/questions/6524459/stopping-a-thread-python “”” while(not stop_event.is_set()): if q.empty(): q.put(time.strftime(‘%H:%M:%S’))class App(object): def __init__(self): self.root =… Read More Running a task in a separate thread in a Tkinter app.

Calling a function periodically in Tkinter (Polling)

Use the after method. From a discussion here. import Tkinter as tki, timeclass App(object): def __init__(self): self.root = tki.Tk() self.win = tki.Text(self.root, undo=True, width=20, height=5) self.win.pack(side=’top’, expand=True, fill=’both’) self.poll() def poll(self): print time.strftime(‘%H:%M:%S’) self.win.insert(tki.END, time.strftime(‘%H:%M:%S’) + ‘\n’) self.root.after(1000, self.poll)app = App()app.root.mainloop() From a further discussion here, use the after_cancel method to cancel the polling. after… Read More Calling a function periodically in Tkinter (Polling)

“Impact”

Well, someone has finally come out and said what we are all thinking. A professor, Marc Kirschner, has an editorial in the tabloid ‘Science’ criticizing the NIH’s emphasis on pre-judging “impact” and translational “significance” of proposed studies. The editorial is frank, with some of my favorite quotes being: Thus, under the guise of an objective… Read More “Impact”

ipython notebook

I’m, of course, a Python groupie. Many of you perhaps use Matlab or Mathematica as an interactive environment to explore math (or algebra). Python has had the regular python shell and then Ipython, which allows such easy interactive exploration. However, when using the python shell, I always feel the need to open up a separate… Read More ipython notebook