Friday, November 10, 2017

Convolutional Neural Networks - CNNs

Convolution: The primary purpose of Convolution in case of a CNNs is to extract features from the input image. Convolution preserves the spatial relationship between pixels by learning image features

In the computation above we slide the orange matrix over the original image (green) by 1 pixel (also called ‘stride’) and for every position, we compute element wise multiplication (between the two matrices) and add the multiplication outputs to get the final value which forms a single element of the output matrix (pink). Note that the 3×3 matrix “sees” only a part of the input image in each stride.

Saturday, November 04, 2017

Machine Learning - Model Evaluation Metrics

Confusion Matrix:

ROC (Receiver Operating Characteristics) and Area Under Curve (AUC)

ROC graphs are two-dimensional graphs in which tp rate (true positive rate or recall in above diagram) is plotted on the Y axis and fp rate is plotted on the X axis. An ROC graph depicts relative tradeoffs between benefits (true positives) and costs (false positives). More details: An introduction to ROC analysis by Tom Fawcett

For example, when you consider the results of a particular test in two populations, one population with a disease, the other population without the disease, you will rarely observe a perfect separation between the two groups. Indeed, the distribution of the test results will overlap, as shown in the following figure.

For every possible cut-off point or criterion value you select to discriminate between the two populations, there will be some cases with the disease correctly classified as positive (TP = True Positive fraction), but some cases with the disease will be classified negative (FN = False Negative fraction). On the other hand, some cases without the disease will be correctly classified as negative (TN = True Negative fraction), but some cases without the disease will be classified as positive (FP = False Positive fraction).

  • Sensitivity: probability that a test result will be positive when the disease is present (true positive rate, expressed as a percentage). 
  • Specificity: probability that a test result will be negative when the disease is not present (true negative rate, expressed as a percentage). 
  • Positive likelihood ratio: ratio between the probability of a positive test result given the presence of the disease and the probability of a positive test result given the absence of the disease, i.e. = True positive rate / False positive rate = Sensitivity / (1-Specificity)
  • Negative likelihood ratio: ratio between the probability of a negative test result given the presence of the disease and the probability of a negative test result given the absence of the disease, i.e. = False negative rate / True negative rate = (1-Sensitivity) / Specificity
  • Positive predictive value: probability that the disease is present when the test is positive (expressed as a percentage).
  • Negative predictive value: probability that the disease is not present when the test is negative (expressed as a percentage). 

In a Receiver Operating Characteristic (ROC) curve the true positive rate (Sensitivity) is plotted in function of the false positive rate (100-Specificity) for different cut-off points. Each point on the ROC curve represents a sensitivity/specificity pair corresponding to a particular decision threshold. A test with perfect discrimination (no overlap in the two distributions) has a ROC curve that passes through the upper left corner (100% sensitivity, 100% specificity). Therefore the closer the ROC curve is to the upper left corner, the higher the overall accuracy of the test - see next diagram.

The most important metric are the following:

Thursday, November 02, 2017

Deploy a Python app on Google Cloud

git clone $TUTORIALDIR
cd $TUTORIALDIR/appengine/standard/hello_world $PWD
gcloud app deploy app.yaml --project [YOUR_PROJECT_ID]
The app runs on: https://[YOUR_PROJECT_ID]

Flask App on Google App Engine:

cd $TUTORIALDIR/appengine/standard/flask/tutorial
gcloud app deploy app.yaml --project [YOUR_PROJECT_ID]
Run the Flask app on: https://[YOUR_PROJECT_ID]

Using the Container Engine:

This example makes use of a web app framework - a web application framework can simplify development by taking care of the details of the interface, letting you focus development effort on your applications features. App Engine includes a simple web application framework called webapp2 - a lightweight framework that allows you quickly build simple web applications for the Python 2.7 runtime.
webapp2 is compatible with the WSGI standard for Python web applications. You don't have to use webapp2 to write Python applications for App Engine. Other web application frameworks, such as Django, work with App Engine, and App Engine supports any Python code that uses the CGI standard. The webapp2 project, by Rodrigo Moraes, started as a fork of the App Engine webapp framework, which was used by the Python 2.5 runtime. webapp2 includes a number of features that make developing web applications easier, such as improved support for URI routing, session management and localization. The Python 2.7 runtime uses webapp2, and the project is maintained externally to App Engine. It is supported, but not maintained, by Google.
For more information about webapp2, see the official documentation.

RUNNING Django + setup a MySQL database instance on AppEngine:

Wednesday, November 01, 2017

Google Cloud - Natural Language API

Apart from the Quickstart here:

I used this code:

I had to do a few additional steps including:

Setting up Google Application Default Credentials - including setting the environment variable GOOGLE_APPLICATION_CREDENTIALS

Well described here:

Then I had to disable unwanted warnings based on the details here:

Monday, October 23, 2017

Google BigQuery & Apache Hive

Google BIGQUERY is a fast, economical and fully-managed enterprise data warehouse for large-scale data analytics. Details of querying your custom table in BigQuery:

The Apache Hive™ data warehouse software facilitates reading, writing, and managing large datasets residing in distributed storage and queried using SQL syntax. Built on top of Apache Hadoop™, Hive provides the following features:
  • Tools to enable easy access to data via SQL, thus enabling data warehousing tasks such as extract/transform/load (ETL), reporting, and data analysis.
  • A mechanism to impose structure on a variety of data formats
  • Access to files stored either directly in Apache HDFS™ or in other data storage systems such as Apache HBase™
  • Query execution via Apache Tez™, Apache Spark™, or MapReduce
  • Procedural language with HPL-SQL
  • Sub-second query retrieval via Hive LLAP, Apache YARN and Apache Slider.

More details on getting started:

Sunday, October 22, 2017

Spark SQL & 3rd Party Spark Machine Learning libraries

Spark machine learning inventory

Spark SQL and Dataframes: Python and Spark


Getting the Data and Creating the RDD

import urllib
f = urllib.urlretrieve ("", "kddcup.data_10_percent.gz")
data_file = "./kddcup.data_10_percent.gz"
raw_data = sc.textFile(data_file).cache()

Step 2: Create a Dataframe

A Spark DataFrame is a distributed collection of data organized into named columns. It is conceptually equivalent to a table in a relational database or a data frame in R or Pandas. They can be constructed from a wide array of sources such as an existing RDD in our case.

The entry point into all SQL functionality in Spark is the SQLContext class. To create a basic instance, all we need is a SparkContext reference.

from pyspark.sql import SQLContext
sqlContext = SQLContext(sc)

Inferring the Schema: With a SQLContext, we are ready to create a DataFrame from our existing RDD. But first we need to tell Spark SQL the schema in our data.

Step 3:

Once we have our RDD of Row we can infer and register the schema.
interactions_df = sqlContext.createDataFrame(row_data)
Now we can run SQL queries over our data frame that has been registered as a table.

# Select tcp network interactions with more than 1 second duration and no transfer from destination
tcp_interactions = sqlContext.sql(""" SELECT duration, dst_bytes FROM interactions WHERE protocol_type = 'tcp' AND duration > 1000 AND dst_bytes = 0 """)
The results of SQL queries are RDDs and support all the normal RDD operations.
# Output duration together with dst_bytes
tcp_interactions_out = p: "Duration: {}, Dest. bytes: {}".format(p.duration, p.dst_bytes))
for ti_out in tcp_interactions_out.collect():
  print ti_out

One thing to remember: You can’t map a dataframe, but you can convert the dataframe to an RDD and map that by doing Prior to Spark 2.0, would alias to With Spark 2.0, you must explicitly call .rdd first.

Saturday, October 21, 2017

HDFS (Hadoop), Scikit-Learn & Apache Spark MLlib

On Linux: Ubuntu 14.04.5 LTS, Release: 14.04, trusty.

Apache Hadoop is an open source software framework that enables large data sets to be broken up into blocks, distributed to multiple servers for storage and processing. Hadoop’s strength comes from a server network – known as a Hadoop cluster – that can process data much more quickly than a single machine. The non-profit Apache Software Foundation supports the free open source Hadoop project, but commercial versions have become very common.

The Hadoop Distributed File System (HDFS) is the place in a Hadoop cluster that you store data. Built for data-intensive applications, the HDFS is designed to run on clusters of inexpensive commodity servers. HDFS is optimized for high performance, read intensive operations and resilient to failures in the cluster. It does not prevent failures but is unlikely to lose data, since by default HDFS makes multiple copies of each of its data blocks.

Hadoop does batch processing i.e processing of blocks of data already stored over a period of time. Initially Hadoop's MapReduce technique was the best framework for processing data in batches. Spark is an open-source cluster computing framework for real-time processing. Spark's additional functionality is that it can process data in real time and since it was built on top of Hadoop MapReduce and it extends the MapReduce model to efficiently use more types of computations it is also about 100 times faster than Hadoop MapReduce in batch processing large data sets.

Spark can create distributed datasets from any file stored in the Hadoop distributed filesystem (HDFS) or other storage systems supported by the Hadoop APIs (including your local filesystem, Amazon S3, Cassandra, Hive, HBase, etc.). Spark does not require Hadoop; it simply has support for storage systems implementing the Hadoop APIs. Spark supports text files, SequenceFiles etc and any other Hadoop InputFormat.

More differences and Spark details are here:

Install Hadoop in Stand-Alone Mode on Ubuntu 16.04

Once installed run it as:

Scikit-Learn ML Examples:

Tuesday, January 19, 2016

Simple C++ Makefile on Linux

Seems a pain to get started with makefiles for C++ code on Ubuntu.

First create and name the file 'Makefile' in the same folder as your .h and .cpp files

Second copy in the following contents and change the .cpp filenames:

CFLAGS=-c -Wall
SOURCES=Test.cpp Foo.cpp Bar.cpp

Tab $(CC) $(LDFLAGS) $(OBJECTS) -o $@

Tab $(CC) $(CFLAGS) $< -o $@

* Standard format is: g++ test1.cpp -o test1

Tuesday, October 27, 2015

IKEA Response - Glass Tumbler Explodes.

I got the following response from IKEA after the incident: 

However my response would be I underwent this agony after IKEA selling me this untested/defective good (explosive?) and this untoward accident which happened at our premises and might have caused so much more damage. There was hardly any thermal shock - after almost 5-10 mins after pouring water from the tap (cold) the glass exploded with a loud sound and scattered around.

I bought the product thinking it is robust and not so fragile that merely trying to drink water it will explode into pieces. Also IKEA needs to ensure this product is checked/evaluated for safety standards or else any customer could get hurt - knowingly selling this product would amount to willful negligence

As a friend of mine states consider an accident happens with my car due to a fault in the system and I am exposed to danger. Can the car company just educate me and their job is done?  

CE mark, ISI mark etc ensure the quality standard. IKEA is trying to tell it can not be checked better, by that logic in very cold country and very hot country where inside air and outside air there is big temperature gap windows must break, making NO windows (car wind screens) good enough to withstand temp gradient, that is purely unacceptable.

Hello Shamit!

Thank you for your e-mail.

We understand you are worried and concerned over safety risks when using our glass.
Though we need to explain how they are manufactured and what type of glass are being sold on the market.

Here follows a short explanation of the difference between ordinary, non-tempered and tempered glass.

The ordinary, non-tempered glass have thermal shock resistance, sudden temperature change, up to 80° Celsius.
Difference between room temperature of 20° Celsius and boiling water, 100° Celsius.
If broken, it can break in big, sharp pieces that can cause cut and burn injuries. See photo below.

(Breaking pattern of ordinary glass, not tempered)

BUT - tempered glass has higher thermal shock resistance, above 120° Celsius and if broken, it breaks in small square pieces that are not sharp and
do not pose any risk of cut burn or burn injury.

Test result 180° C.JPG
(Breaking pattern of tempered glass)

However, all glass is fragile, including tempered and if exposed to mechanical damage, knocks, scratched or impact, glass can break spontaneously days or weeks after being exposed.
That is why all glass is to be handled with caution and avoid damage at all time. This is not a unique attribute only for IKEA products, but the same no matter which manufacturer.

IKEA have choose to use tempered glass in POKAL to minimize the risk of getting injured if and when POKAL breaks.

We hope this brings some answers to your questions, and you now understand more how glass products works.

If you or your wife sustained injuries and were in need of medical attention, please let us know. You then need to contact your insurance company and have the injuries documented.

You are also welcome to send in the remainings of the glass for investigation to our technicians.
If so, please respond with your full contact details and we are able to help you further.

Kindest regards,
IKEA customer service

IKEA Glass Tumbler Explodes.

An IKEA glass tumbler (we bought in Gothenburg, Sweden) exploded on our dining table tonight.

We had a few guests at the table and they were having dinner when the glass exploded and shattered into small pieces and minute fragments. It is sheer luck that nobody was hurt.

Cold tap water was poured into the IKEA glass tumbler (which was lying unused inside the cupboard) and was offered to the guests. This happened within 5 minutes after pouring the cold tap water. With a loud thud sound (as if it had been shot), the glass exploded and shattered. People could have been badly hurt because of what happened and such products must not be produced (or procured from sub-standard sources) and sold without proper quality testing.

This was so totally ridiculous, that buying glass products from IKEA will be a risky proposition hereon. I am apprehensive that guests could have been severely hurt and it makes me shudder (what if shards or particles of glass had entered the eyes etc).

The glass is of the same make as in the image below (Product: POKAL Glass) and was bought at IKEA Gothenburg (IKEA Bäckebol):

Images below - After the glass exploded and the pieces shattered and scattered everywhere on our dinner table:

Images above - After the glass exploded and the pieces shattered everywhere on our dinner table.

Update - IKEA has taken cognizance:

Saturday, September 12, 2015

Quantum Contrapt - Part 01

First short story in the 'CSlueth files' series. 
Note: This is purely a work of fiction!

1. The dead body 

Wednesday, Chalmers tekniska hogskola, 6:30 PM 

He had just walked out of the classroom in the V building. For the past forty five minutes he had been coding an exciting dynamic systems simulation after having completed a late and rather boring simulation exercises session class. He had to take the road in front of the Chalmers Bibliotek library as he wanted to meet a friend staying nearby. As he walked past the Information Sciences department building there was a gust of cold winter wind that struck his face and he raised the collars of this jacket, sinking in his chin into its warm, furry interiors. It was December and it would get dark really early. It was dark now and hardly anyone else around.  

He hummed a tune as he ran up the flight of stairs, the library was at an elevated level from the V building. He found himself humming some recent tune he had heard on the YouTube channel, a catchy tune for an aerated drink or something. As he cleared the last step and reached the flat expanse beside the Kemi huset he heard someone moaning almost inaudibly and then the moaning stopped. Tony felt a chill go down his spine as he spotted a motionless dark mass about a feet or two away on the ground. As he walked gingerly ahead he saw that it was the body of a person, seemingly middle-aged and slightly heavily built, now slumped on the ground. His right hand was clutching a piece of rock and was now jutting outward almost perpendicular to his midriff. As Oswald shone the light from his mobile on the body and beside where his right arm ended he spotted something written on the soft earth. The man had written something on the ground using the stone in his death throes.  

Oswald didn't know what to do as panic swept all over him he dash past and came to the spot where the nearby church is visible and with flailing arms and in English mixed with broken Swedish he told a few of the passerby's what he had see. He wasn't sure if the man was dead. By now few people had gathered around and people were passing opinions on what could be done. Someone from among the bystanders called up the polisen. As Oswald heard a siren in the vicinity he spotted that the dead man had probably bled from his head. There was thick dark fluid - coagulated blood - behind his head. It was clear he had died here and then Oswald spotted something scribbled on the ground. It was the famous bra ket notation used extensively in equations of Quantum Mechanics. He went closer and knelt down to see what it was when he realized that he had seen the same bra - ket notation elsewhere in the campus. Beside the notation were scribbled the words TV indistinctly. He had attempted to write something more but it was completely ineligible. 

Wednesday, Polisen Station Lobby, Ernst Fontells plats, 8:00 PM 

Chief inspector Jonas Einarsson was clean shaven and touched his forehead as he rested his elbow on the table, he sat in the chair opposite 'Tony' Oswald Maguire.  

"So you think this thing that the man scribbled was a clue", said Jonas half smiling.  
Oswald nodded. "Yes", he said, " It seems to me he is indicating something, perhaps a location in the campus or an object". 
"What is this some sort of treasure hunt, you students are so messed up playing these games these days" said Einarsson waiving off the suggestion. 
That's when his phone rang and he spoke for a while. He came back and sat on his chair again. 
"Do you know what it is?", said Einarsson, " A blunt weapon was used to kill the man, he was hit from behind, apparently his skull had cracked" he concluded. "Thanks for your cooperation, you can now take your leave", with this Einarsson rose, offering his hand for a handshake.  

Oswald was walking back home unnerved from the evening's happenings. He called up a friend of his and narrated what had happened and asked his friend to come over. 

Thursday, Fysiken building, Chalmers Hogskolan, 12: 08 AM 

"This better be a clue", said Carl, Oswald's close friend as the two of them ran up the stairs. They had to get to the fourth floor of the building, to an open cafe. After Carl had come over to Oswald's place they had discussed about the case and had come to the conclusion that there was definitely a clue based on what the dead man had scribbled. There is an open cafe named the Branifiket which is the same bra-ket notation with the sign of the variable phi used to depict the Quantum wave function. This was on the fourth floor of the physics building which they were now racing towards. As they opened the door using the push button the long white corridor ahead lit up. They walked past and then entered an adjacent corridor that led to the open cafe. There were a series of large, framed photographs of Christopher Dalen the blind Swedish scientist and his inventions on the walls. As they neared the cafe - there is a wall in between the seating and the deli, someone bolted from behind the wall across the nearby door and ran across the opposite door to the glass bridge and disappeared.  

Oswald and Carl stood there flabbergasted and trembling, they didn't attempt to chase. They entered the cafe area and found behind the wall the counter now obviously shuttered at this unearthly hour. There were two dustbins and a TV on the wall opposite the deli. They felt behind the TV and peered at the space in between the TV and the wall where it was mounted. Finally Oswald came across a paper chit taped on top of the backside of the television. It was a piece of some notebook and it had a handwritten line stating: 

"If I Cullapse" 

2. The Quantum Cipher 

Saturday, Hogsbogatan, 10:30 AM 

Melissa Stetson switched on the television and found the news channel blaring out that someone had been found murdered at the Chalmers University campus three days back. It was apparently a PhD student at Chalmers. His body had been identified and the weapon used was a blunt weapon with which he had been hit on the head. The polisen were further investigating the case. The suspect had not yet been identified and the person who had found the body was a Chalmers student Oswald Maguire. Melissa was a close friend of Oswald and immediately called him up. He gave her some details and asked her to come over to the study room near the branifiket cafe in the afternoon, he and Carl would be there. 

When she reached the studyroom she found Carl and Oswald huddled inside a study cubic. The place always made her cautious as the upholstery and sofas were all red. They were peering at the map of the University and there were a few sticky notes at different points on the map. It could have been any project she thought but this had to do with the murder on campus.  

"We have found three clues till now" said Carl, after which they explained the details to Melissa. After that first clue led them to the cafe the second clue they had figured was a cipher clue Cu - stood for Copper which had led to the copper dome on the campus. There they had obtained a key and another piece of paper on top the entrance door which said: 

'Last of the last Arch Enemy S of blue daffodils' 

Melissa thought hard and felt this was again a location but for what? Then she suggested it might mean the southern archipelago of Gothenburg. This seemed possible. They would get there in the evening. 

Saturday, Vrango islands, Southern archipelago Gothenburg, 4:30 PM 

The ferry docked and the passengers all came out one by one. The two men came out last, one had a gash on his forehead from a recent injury and the other was over six feet tall, well built but not too hefty. They walked into the nearest cafe by the waterfront and ordered an espresso each. They chatted in Swedish and kept an eye on the outgoing ferry. 

5:15 PM 

The ferry Silvertarnan reached Vrango everyday at 5:15 PM. As the three of them got off from the ferry, the two men seated at the cafe turned to take a look. The description matched. One of the three was a stocky lad, with a muscular, tanned visage, the other was fair and lanky and the third was a girl and had a nose piercing passing through the center of the nostrils. It was time to see what the kids were up to.  

"I have a feeling we need to walk to the end of the island as the clue says last of the last", said Oswald. 

They walked to the point where the island ended and now they had to find the house with blue daffodils. 
"Do daffodils come in blue?", asked Carl to the two others. 
"Maybe its not actually flowers", said Melissa. 
They walked around for some time at the edge of the island, where the craggy shoreline began were a series of houses mostly deserted. On one of the gates was a wooden sculpture of two blue daffodils and Melissa spotted it. They were about to open the door when Oswald waived "Stop let us wait". 
"I think some people are following us; lets walk towards the harbour on yth other side and lose the tail" 

Saturday, Quasec Inc. - Facility D, Stockholm, 6:00 PM 

The labs looked straight out of some spacecraft. The walls were different shades of orange and white. The Q logo in black was etched on the doors and on the ceilings. 

"We need the entanglement deconstructor device soon once the control tests are done, that will help us keep the collapsed wave intact and then we could do some tests in real", the man wearing the grey suit and a red cufflinks said.  

"Yes D'Silva wanted to keep that to himself, we got a few papers from his room at Chalmers but the details were not sufficient. Prof Dushyant too has no clue what D'Silva had figured out but we know for sure that he had reached a breakthrough", Tim Robbins the security expert for Quasec mentioned as he ran his fingers through his blond hair. 

"No more clues on the device design? We need to get there before anybody else does", concluded the man in the grey suit with an air of finality. "Find out what Gunnar has to say", he said turning to face the third person in the room. 

"They are in an island near Gothenburg right now, both Gunnar and another associate of his, we might be close to the device" said the wiry bespectacled man with greying hair in a raspy but polite voice. This is when his phone rang, he spoke for a while in Finnish and then hung up. 
"The kids have found the device, Gunnarson had called - but we have a problem" he said. 
"What problem?", asked the man in grey suit. 
"Mr Huang, the kids had managed to escape with the device and Gunnar was only able to get the operating manual and the associated papers". 
"Find them and retrieve the device, now!", thundered Huang Kai Shek, his face turning a shade darker. 
"Yes Sir" said the wiry man and walked out of the room dialing a number on his phone. 

A few hours back 

The three of them hurried past the harbour and among the boats trying to loose the two people who were following them both in dark jackets and possibly carrying weapons. Why were they following them thy wondered. When the three of them came back to the house with the blue daffodils they had lost their followers or so they thought. When they opened the door with the key an entered they saw a clean room with just a chair a table and a bed. On the bed was asleep a young monk not more than fifteen years of age in a Nepali robe. The monk woke up due to the sound of the opening door. He stared at them calmly: 

"Do you stay here?", asked Carl. 
The monk nodded, and pointed to the table. There were a stack of papers in a folder which Melissa opened to check, it had some blueprints and a series of papers and mathematical equations worked out.  
"What are these?", Melissa asked the monk. That's when the door came crashing down and there stood at the doorway two men in dark jackets revolvers in hand. Both wore Guy Fawkes masks.
"Hand it all over to us", shouted the short one. 
"Is there a device or some instrument too? Find that now!", yelled the other person. 
Melissa handed over the folder and a book to Carl who in turn handed over the papers to the short man. 
"We don’t have anything else", said Melissa. 
"Is there anything else?", the tall man asked the young monk, who vigorously shook his head implying a no. 
"If you get anything else let us know! And not a word to the polisen!!", said the short stocky scar-face handing over a piece of paper in Melissa's hand. 
"Or else …", he threatened with a gesture pointing his revolver in each of their directions.  
The two men stormed out leaving Carl, Oswald, Melissa and the monk trembling.  

3. Quantum wave constrictor 

Monday, Chalmers University, 12:30 PM 

"Imagine an hour glass, now think of the waist where it gets constricted. At that point the sand is forced to slow down and it flows down in a fine trickle. The same way reality can be seen as a wave where all possible realities or multiverses exist until the Quantum wave function of this moment collapses to create this moment.", said Professor Eckhart von Einhart. Professor Dushyant nodded in agreement. 

"I understand that hypothesis but is there a way to constrict or control this flow is the question. When he was killed he was working on a condensate constriction implementation I believe as he had told me" 

"Yes there is a possibility if there is enough density created at a point a mini Quantum wave constrictor can skrink the space-time fabric and the multiverses can be reduced to a single universe in the vicinity of the constriction. The constriction can be extended for short bursts or longer periods in space-time as time itself gets warped at that point. This something Satyendranath Bose had conjecture d in his last letter to Einstein" said Prof Eckhart with a smirk. 

"Wait, wait, wait. Are you telling me that this is like determinism for short bursts of time? I mean in other words controlling a snapshot of the foreseeable future? That's not possible in my humble opinion. The Schrodinger paradox would kick in making it impossible" 

"That doubt is valid. However a recent equation that your PhD student and another Chinese researcher had solved made this at least theoretically feasible if such a condensate can be created." 

"Won't that take a massive research facility to create? What was it that got him killed. The police interrogated me; all I could tell them was that he was working on Quantum constriction" 

"An implementation is possible by means of a condensate coagulation but requires a high power source perhaps by means of a controlled nuclear fusion reactor of some sort" 

"Don't forget the consciousness condensate too, a mind focused, I believe he was in touch with the Himalayan meditation foundation under Prof Brooks as they work on consciousness studies through meditation techniques" chipped in Prof Dushyant over his lunch. 

"Yes a source of consciousness is a necessary input to this process - a highly focussed and uncluttered source perhaps can be invaluable, what better than a monk trained in meditative practices!" said Prof Eckhart as he bit into his baguette with gusto. 

"Was he involved with a firm or any of the research groups working on such stuff? Might have been some inter firm rivalry or something confidential changing hands that got him killed. It is very unfortunate to have lost such a brilliant young mind at his prime", pondered Prof Dushyant to himself. 

"Yes very unfortunate", agreed Eckhart, he continued with "I have just heard of a handful of commercial firms working in this field, most others like DWave are into Quantum computing. In all I think two US firms, one in France and one in Israel although they may have subsidiaries in the Nordics" 

Quasec Facility D Stockholm, 13:05 PM 

"So do we have coordinates yet for the component Z device? Without that the tests are null and void, we don't have working prototype of the comp Z based on the papers" 

"Should we also ask them to get the source too?", asked the scarfaced man. 

"Like I said without the constrictor device it won't work and abducting a source will only be a greater liability" 

"Do you think it was something related to this that got Dmitri bumped off?", asked the lady assistant. 

"We don't know for sure, let us focus on the task on hand", said Dr Schindler firmly. 

They moved into the Contrapt room as it was nicknamed. The room was white and at the center was a large tubular machine with several parts akin to stages of a rocket. There was a square-shaped glass box connected to the wall with some thick wires from the tubular contraption running to the end of the room where they seemed to connect to a large brown inlet possibly into another room. 

4. The Treatise on Entanglement Networks

A few days later

'The world would be great if a mechanism were possible to choose among the different multiverses and decide which one you want to come true, but then could you switch back into one of other universes and change the course of the future again? Say a person has died and everyone knows he has died is it possible for that person to become alive based on a portal or a wormhole back into one of the universes in the multiverse where he is alive. Are there doors and portals from one universe into another within the entire multiverse? Universe networks? Are all the universes of the multiverse connected? That brings us to another premise the entanglement network.'

'An entanglement network was a mechanism of entangling the state that one person was in with everyone else. Imagine I get to know that a particular X is dead and then I call others and show them the dead body and then the news spreads via television, phones etc and other communication mechanisms, so now the entanglement is complete all the minds are synchronized to know that X is dead (given that she really is dead)', read aloud Tony from on a diary entry in D'Silva's diary.

D'Silva had made the monk wear a helmet to create the quantum constriction effect, as the little monk told them. He had asked the monk to imagine a dead man hit on the head with a chisel and then his falling down and dying. He had told it was to be done exactly at a given time in the evening when a machine at Stockholm would receive his imaginary signal. Wasn't that exactly what Oswald had seen, but what about the message? Was it a way back into the multiverse network. Could you enter and kick-start another point of space-time in another universe of the multiverse, was it possible to bring someone back from the dead and make everyone change their minds?

'Was that then a form of disentanglement of the minds and a cross connection between universes - wouldn't that lead to too many combinations?', his diary continued.


Thursday, August 06, 2015

Deepest Dreams

An Ode to Google ‪#‎DeepDream‬ - Perhaps generated by the same process - I see a scene in a park and start imagining other patterns ...

Saturday, March 28, 2015

Accepting Contradictions

Accepting Contradictions

You want me 
To be like you.
And I want you 
To be like me.
Acceptance is hard, you see!

You won't change your mind,
And I agree with you too!
A space where it is impossible 
To change your mind - is a dead space. 
Bury it.

And yes 
It's OK to contradict yourself 
On a regular basis
Else you’re not even thinking ...

Wednesday, March 25, 2015


Was thinking about an analogy recently while getting back home from the tram station. 

Let us assume you are waiting at a bus stand for a particular bus. Quantum physics is akin to saying: Any given bus can be bus route number 5, 10 or 15 (or any other number) with any of the probabilities ranging from 0 to 1 at any time. It transforms into an exact bus number that arrives next when its probability of being that route number becomes 1. Or vice versa. 

But if you are on a particular bus the probability being the same route number is always 1. Or unless you have seen the bus yourself its route number is less than one but we cant be certain it might also be zero. 

Seems like a joke right? I know at the quantum (or very small scale) it maybe true, but can the analogy be used elsewhere in designing systems?

Sunday, February 22, 2015

Topic modeling - Machine Learning

Probabilistic Topic modeling provides methods for organizing, understanding, searching, and summarizing large electronic archives.

Latent Dirichlet Allocation (LDA): The simple intuition behind LDA is that documents exhibit multiple topics.

In reality, we only observe the documents, the other structure are hidden variables
Our goal is to infer the hidden variables i.e. compute their distribution conditioned on the documents: p(topics, proportions, assignments|documents).

Gibbs sampling for LDA - Here we sample the topic of a word in one of the documents, given the topics of all other words, the topic distributions and the data. A sample from a recent coursework at Chalmers below:

Another instance shown below - for 10 topics:

Wednesday, January 28, 2015

Introduction to Population Genetics - Basics

Population genetics is concerned with the study of the genetic composition of populations. This composition may be changed by segregation, selection, mutation, recombination, mating structure, migration, and other genetic, ecological, and evolutionary factors. Therefore, in population genetics these mechanisms and their interactions and evolutionary consequences are investigated.

A gene may have different forms, called alleles.

The allelic composition is called the genotype, and the set of observable properties derived from the genotype is called the phenotype.

Thus, supposing that there are two alleles A1 and A2, there are three possible genotypes, A1A1, A1A2, and A2A2. In the first and third case, the organism's genotype is homozygous (for A1 or A2, respectively), in the second case it is heterozygous.

Genetic material is deoxyribonucleic acid (DNA). It consists of four bases: adenine (A), guanine (G), thymine (T), and cytosine (C). Each base is linked to a sugar and a phosphate group, yielding a nucleotide.

The nucleotides are arranged along two chains to form a double-stranded helix in which the pairings A-T and G-C between the strands are formed. Therefore, all the genetic information is contained in each of the two strands.

Three bases code for one amino acid, which are the building blocks of polypeptide chains and proteins.

A gene typically represents a contiguous region of DNA coding for one polypeptide chain. Its position along the DNA is called the locus, and a particular sequence there is called an allele.

Saturday, January 24, 2015

Jai Hind, Jai Hindi!

Dear Mr Bagchi,

We have received your entry for the World Hindi Day, which has been selected for an appropriate award.

Please confirm your attendance on the flag hoisting ceremony on 26th January, 2015 at 0915 hrs at India House 13-A, Villagatan, Stockholm to receive the prize.


Embassy Logo
J. P. Meena / जे.पी. मीणा
Minister & DCM / मंत्री  मिशऩ के उप प्रमुख
Embassy of India / भारत का राजदूतावास
Stockholm / स्टॉकहोमईमेल
दूरभाष:+46-8-107008/4117090,फैक्स: 248505