Wednesday, January 27, 2016

Bit of insight into payment habits - a Bitcoin blockchain investigation

As a project work, I looked at the dynamics of transactions in the Bitcoin cryptocurrency system. Delay times between consecutive payments were analysed to investigate their distribution - a distribution that could predict the next time an individual intends to spend money. This study is inspired by (Barabási 2005), a paper showing that human dynamics follow a fat-tailed power-law distribution in terms of certain tasks, like e-mail communication. It is yet to be examined if payment habits exhibit the same behavior or not. [Note: a fat-, or heavy-tailed distribution in this case is characterized by long waiting times, and burst like activities - e.g. we usually send e-mails in batches, time to time, and not in every hour a mail.]

Transactions, or payments, of 59490 accounts were fetched from the Bitcoin blockchain by calling the API of blockchain.info. Accounts were then filtered by the amount of payments initiated – minimum number of 60 transactions was required – in order to leave out bitcoin addresses used once (“Protect Your Privacy - Bitcoin” 2016) or just a few times. Account information of 6729 Bitcoin addresses made to the analysis phase in the end.

Inter-payment delay times of two accounts. Tall spikes suggests a heavy-tailed distribution - long waiting times (delay time in seconds).

Thursday, October 29, 2015

Brainstorming about brainstorming techniques

I'm about to attend a hackathon in Helsinki where I study right now. The team has already brought together, but finding an idea to hack the hell out of is not that simple. That's why I started thinking how to make brainstorming easier, how can I help my brain in the process. Here I share two approaches that I came up with - I'm not saying I was the first to figure these out, though; I have no clue.

Montage brainstorming

For the hackathon, the team had to choose, which gadget(s) to use - if more, than which combination - to build a creative, promising product. There was 20 of them so this decision alone was far from trivial. We agreed to try out a neuro headband, but still, there are a again a million ways to hack further brain signals with the other devices. There, it came to my mind, what if I constitute a montage, images of all devices cut and pasted side by side in a single image to view. It's so much easier to make associations between devices - or more abstractly, between choices of a parameter of an idea - than keeping your mind updating over and over again of the choices available. You just look at the montage and let your brain connect the dots for you. This technique, of course, is only convenient when you have all the possible choices available and their number doesn't exceed, let's say, 30. For most parameters of a hackathon / startup idea, montage brainstorming is not applicable. Don't worry, the other brainstorming method I'm going to show is just for those difficult cases.

The actual montage of devices that I assembled. Lots of tools to hack!

Wednesday, April 29, 2015

Analogy recovery from the Wikipedia corpus - a natural language processing task

Natural language processing is a field of science aiming at teaching machines the hectic human language, whether it is spoken or written. On the lowest level of abstraction computers talk to each other in sequence of bits, which in chunks forms instructions. The instruction set is limited, as well as well-defined - not any like human language. We can express rather complex concepts by a single word, while a computer would struggle spending a great amount of its words (1 word usually consists of a few bytes) to tell the same stuff. Also, families of human languages are results of thousands years of evolution, thus often neglect logic as much as are built upon traditions. All in all, getting machines understand our most innate communication form is not an easy sport. In fact, it's difficult as hell. So complex that so far we could only rely on heuristics; not even close to a full blown neural net, which would imitate our language processing brain parts, functions.

Saturday, April 4, 2015

Existence of an ideal time capsule

Let's say, you want to hide, or make inaccessible some data (e.g. video of yourself, a secret) till a given time - or in other words, send a message to the future. The problem is how would you prevent yourself, or in that matter, anybody else, to read that peace of data before the given time? How do you make absolutely sure that there's no way to open the time capsule prematurely?

You'd say let's put that secret inside a platinum chest, inside a platinum chest, inside a platinum chest ... with a self-destruction function, so if someone peeked into those boxes before intended, then the data would be wiped out of existence. Oh and do not forget to bury that matryoshka platinum chest deep down the crust of earth where platinum is at the limits of melting.

A modern time capsule feeding on solar energy.

Monday, January 19, 2015

Acquiring fear intensity from EEG

My bachelor's thesis project is about the measurement of fear using EEG signals, similarly to my previous lab work. In this case though I made the participants to play a horror game instead just inducing fear by the means of audio stimuli. Also, I attempted to obtain the intensity of the emotion not just whether it is present or not - in addition to EEG signals, self-assessment, heart rate (HR) and skin conductance (GSR) data were gathered to verify the intensity. If you are interested in the whole thing in detail you can read it here (or at the end of this post). Team of the Synetiq neuromarketing research company supervised my thesis. They helped me a lot in putting together the measurement layout, the preprocessing of HR, EEG, and GSR signals and in the analysis of results.

Course of measurement

The experiment consisted of six main parts: 1) first, baseline self-assessment, 2) open-, and closed-eye baseline measurements, 3) baseline gameplay, 4) second self-assessment, 5) fear inducing gameplay, and 6) the last self-assessment. In total, the experiment took about 30 to 40 minutes with the time spent on the placement of the measurement tools excluded.

Parts of the 30-minute measurement as of time – width of the boxes are proportional to the length of the corresponding events.

Thursday, November 27, 2014

Tóth's food serving game

Recently I've dived into game theory by attending a course. I've always been haunted by a dilemma while serving food to my guests at my apartment and now I'd like to introduce this problem in the formal terms of game theory - just for fun :D

Let's have a grill party G(N, f), where N is the set of hungry participants (|N| is the number of them), and f is the amount of food available that is divided among p1, p2, ... p|N| plates. Let h ∈ N be the host of the party, g1, g2, ..., g|N|-1 ∈ N the guests. h serves the food for all the participants including h, as well as divides the f amount among the plates while, being a kind host, lets the guests to choose which plate they want to take. In the end h takes the last one left. Actions of the players' are as follows (a1, a2, ..., an ∈ Ax denotes the set of actions player x is able to take):

Thursday, August 14, 2014

Parameter fitting tool for MOOSE

During my last week in India, I contributed to the MOOSE project by providing an interface to a parameter fitting tool. Now parameters of MOOSE models can be searched by doing some tiny Python scripting.

When you have experimental data on a phenomenon, and you intend to create a computational model of it, usually you need to apply parameter fitting/searching techniques. These methods help you determine those parameters of your model that you have no reference on. Parameter fitting using MOOSE models are accomplished through utilizing Optimizer [1], a parameter fitting tool developed for neural simulations, which I came across by pure chance.

Results 'layer' from the Optimizer tutorial. Optimizer has a simple GUI to guide the user to a successive parameter fitting.

[1] P. Friedrich, M. Vella, A. I. Gulyás, T. F. Freund, and S. Káli, A flexible, interactive software tool for fitting the parameters of neuronal models, Front. Neuroinform, vol. 8, p. 63, 2014.

Friday, August 8, 2014

Profiling Python C extensions

During my collaboration with Upinder S. Bhalla's lab, I made possible to profile MOOSE C++ code through Python scripting, which means one can profile the native functions of MOOSE without writing any C++ code.

For profiling I used gperftools: I wrapped three of its functions, particularly ProfilerStart, ProfilerStop and ProfilerFlush in python functions using Cython. The recompilation of MOOSE is also needed with the -lprofiler flag. After that, one can just call the wrapper functions for ProfilerStart and ProfilerStop before and after the python code that calls the C extensions one is interested in to profile. Then pprof can be used to investigate the results of profiling.

Howto

To profile Python C extensions, first Cython, gperftools and libc6-prof packages need to be installed. If you'd like a visual representation of the results of your profiling, better install kcachegrind as well.

The simplest way to get the wrapper done is to write a cython script wrapping the gperftools functions and a python script that compiles the wrapped functions and link them to the gperftools library.

Let's call the Cython script gperftools_wrapped.pyx:

1:  cdef extern from "gperftools/profiler.h":  
2:      int ProfilerStart(char* fname)  
3:      void ProfilerStop()  
4:      void ProfilerFlush()  
5:    
6:  def ProfStart(fname):  
7:      return ProfilerStart(fname)  
8:    
9:  def ProfStop():  
10:      ProfilerStop()  
11:    
12:  def ProfFlush():  
13:      ProfilerFlush()  
14:    

Here we define a python function for each function of gperftools that we wrap. More functions can be wrapped for more custom profiling (see ProfilerStartWithOptions()).

Model of the basal amygdala - computational Pavlovian fear conditioning

After the first week of the CAMP course we had to decide which project we intended to do next week. I was always interested in how fear and anxiety evolve in the brain so at the end I decided taking a joint project with my course fellow Cristiano Köhler about modeling the basal amygdala - a part of amygdala which is involved in the formation of fear and extinction memories. The main task was to reproduce a model of the basal amygdala and investigate its behavior. Our helpful supervisor was Arvind Kumar, one of the authors of the paper [1] that describes the model in the first place.

Objectives

At first, we reproduced the model of Vlachos et al., 2011 of the basolateral amygdala. The task of the model is to be able to remember a conditional stimulus (CS, e.g. flute tone) paired to an unconditional stimulus (US, e.g. electric shock) - so basically after applying Pavlovian fear conditioning on the model, it takes the same conditional stimulus (without the shock) as a cue of fear. However, further presentations of CS alone results in a decline of this conditioned response - that process is called fear extinction. Another phenomenon is called fear renewal, which shows the context-dependency of fear conditioning and extinction: after the fear conditioning and extinction period in context A (CTXA) and context B (CTXB) respectively, a repeated CS presentation in context A immediately brings back the fear memories despite the effect of the extinction period.

Model

The model intends to reproduce the functions of the basal amygdala. It's a large-scale spiking neuron network implemented in Python, utilizing the Brian library. The model consists of 4000 leaky integrate-and-fire neurons - 3600 so called excitatory and 400 inhibitory neurons. Three kind of inputs are given to the system as Poisson spike trains: (1) CS-US pairs, (2) context information to a subset of neurons and (3) background noise to all the neurons. Plasticity is established in the connections between the inputs (CS-US, context information) and the excitatory neurons. Further plasticity is introduced in the synapses from inhibitory to excitatory neurons to investigate the effects it may bring about.

Distribution of inputs in the spiking neural network model. CS-US are provided to all neurons while CTX input is fed only to a subpopulations of excitatory neurons - from [1].

Thursday, July 24, 2014

Computational Approaches to Memory and Plasticity - a great insight into neuroscience

I had the opportunity mostly thanks to Dr. Upinder S.Bhalla and Subhasis Ray to attend a 2-week-long course on neuroscience, more particularly on how memory is formed and what are the methods to computationally model this process. I'm staying in India at NCBS, where the conference took place, for more 3 weeks; at the moment I'm working in Upi's lab to optimize MOOSE by implementing some GPGPU code.

Photo taken at campus of NCBS - such greenery.