Wednesday, May 20, 2020

Purusharthas: The human desires

Sanatana Dharma and numbers have a great relation. Below are miniscule few of them,

0. Sunya state of meditator
1. Brahman
2. Shiva and Shakthi
3. Trimurti
4. Purushartas (The topic of discussion here)
5. Pancha prana. Pancha kosha
6. Arishadvargas
7. Saptha rishis
8. Astalakshmi
9. Navagrahas
10. Dashavataras
11. 11 Chakras ( As taught by my guru Master Choa kok sui)
12. 12 Chakra ( Seat of Incarnated Soul/Jivatma, as As taught by my guru Master Choa kok sui)

I always get marvelled by Sanatana Dharma, Its details on topic of the purpose of our existence is astounding. Today we will learn about purusharthas. One of the term least understood. Earlier reference to this word can be found 

1. Suryopanishad 

aum atha sūryātharvāṅgirasam vyā̎khyāsyā̱maḥ | brahmā ṟṣih | gāya̍trī chha̱ndaḥ | ādi̍tyo de̱vatā | haṁsa̍ḥ so̱’ham agni nārāyana yu̍ktam bī̱jam | hrille̍khā śa̱ktiḥ | viyadādi sarga saṁyu̍ktaṁ kī̱lakam | catur-vidha puruṣārtha siddhyarthe jape vi̍niyo̱gaḥ ||

2. Ganapty Atharvashrisha Upanishad

सायमधीयानो दिवसकृतं पापं नाशयति । प्रातरधीयानो रात्रिकृतं पापं नाशयति । सायं प्रातः प्रयुञ्जानो पापोऽपापो भवति । सर्वत्राधीयानोऽपविघ्नो भवति । धर्मार्थकाममोक्षं च विन्दति ॥१३॥

Purushartha is compound word formed by Purusha + Artha. Purusha in sanatana dharms stands for the soul. Artha has many meanings,

1. Goal
2. That which is acquired
3. Prosperity

Traditionally Purushartha means human goals. Its very difficult to understand purushartha as goals. For discussion we will go with much easier explanation which is "Desires". Purushartha stands for 4 kinds of desires which drive human evolution, without which the world is stagnant.

1. Dharma: The desire to be right. Dharma is the one which makes Scientists,Mathematicians,Physicists,Chemists to experiment and verify their understanding. Dharma is the one which makes people standup for their beliefs. Dharma is the one which make kid argue 1 + 1 = 2 and not 1 + 1 = 10, But 10th Standard student will argue that both are true in its own sense, one is base 2, one in base 10. Dharma is the ultimate desire to be right. For humans, we have limitations of the understanding of universe, But we try to be right within our own little understanding. As we expand our knowledge and understanding, our Actions also change. This is because of desire to be right, Which we call as Dharma.

Satya yuga has many incidents where divinity trumps the bad. All of these stories are centered around Ego. Take for example of Hayagriva avatar or Narasimha avatar, The villains in both the stories were destroyed because of their Ego. They thought they are the one who is right. They thought themselves as ultimate knower of the truth.

All these stories hints us one common thing. Humans in Satya yuga had capabilities of only Dharma, Or could desire to be right only. They were incapable of any other desires like Artha, Kaama or Moksha. All their actions were because of desire to be right, Whether its to acquire wealth, Procreation, or any other actions. All were cause of desire to be right. They thought its right thing to do to acquire wealth, its right thing to procreate.

Humans are evolved enough to fulfill dharma, Desire to be right.

2. Artha: Desire to possess. Artha is the one which makes humans put effort to acquire. Be it Wealth. Be it name or fame. Be it beautiful house, car, kingdom, desire for any form of possession is because of Artha. 

Humans in Treta yuga had capabilities of both kinds of desires, Dharma and Artha. All of tretha yuga incidence are mostly centered  around acquiring. But both Dharma and Artha are responsible for happenings in Treta yuga. Bali chakravarthi wanted to acquire all lokas and liberated by Vaamana avatar, Vali wanted Sugrivas wife, Sita wanted golden deer, Raavana wanted Sita. Kaikeyi wanted kingdom to her son. All were cause of desire to acquire. They were primarly motivated by Artha. 

Humans are evolved enough to fulfill both dharma and artha

3. Kaama: Desire to experience. Kaama is the one which makes humans want to experience. Humans jump from flight to experience the thrill, Go for scuba diving, Have Sex, Get angry, Show empathy, Eat delicious food, Drink what they enjoy, All because of Kaama, Desire to experience.

Humans in Dwapara yuga additionaly had capabilities of kaama, i.e desire to experience. The mahabharata was result of kaama, Duryodhanas hate towards his brothers. He enjoyed hating. This is possible only because humans now could experience and desire for it. However all three, Dharma, Artha and Kaama are responsible for happenings in Dwaapara yuga. Kaama being most prominent.

Humans are evolved enough to fulfill Dharma, Artha and Kaama by now

4. Moksha: Desire to unite with the one. Moksha is the one which makes humans want to unite with the Brahman. We worship, We meditate, We want to be spiritual, We want to be religious, We want to die in the name of god, We want to kill in the name of god, We want to convert and destroy society in the name of god. All these are fuelled due to desire to unite with God. However humans are now balancing all four purusharthas. All four kinds of desires. 

Humans are evolved enough to fulfill Dharma, Artha, Kaama and Moksha by now.

I hope you enjoyed reading this and have fair understanding of purusharthas, You can now analyse your actions and see what motivates them, Dharma, artha, kaama or moksha

Wednesday, April 29, 2020

Karma: A Bhagvatgita view

There are very good answers to this question here. However i will try to present my thoughts little differently. Bhagavat Gita is most practical book related to spirituality. There is no philosophical views expressed in Gita, Every sloka explains the science behind the working of the universe. Krishna never propagates any philosophy, he merely reveals the inner working, Its upto the reader to figure out how to come out of the cycle of birth and death by figuring out a own way.
Now coming to the topic in discussion, many slokas talks about karma yoga, most famous would be the below from chapter 2 verse 47
Karmanyevaadhikaaraste maa phaleshu kadaachana;
Maa karmaphalahetur bhoor maa te sango’stwakarmani.
Literal sense is very philosophical, and bhagvat gita is anything but philosophy. Its a science. So to understand and appreciate this sloka, we need to have little knowledge about karma and its working.
Every “Action” produces 2 types of “Phala”
  1. Drsta Phala: Which can be perceived, Like Salary you get for your work, appreciations when you help someone etc.
  2. Adrsta Phala: This gets into your debit credit account, also called Karma generally

Moreover Drsta phala is result of your current action and also previous adrsta phala as shown below






Mathematically
Drsta Phala = Current Action + Adrsta Phala (Karma)
Technically speaking, You have control of only Current Action, do not have any control on past action(Karma), So you have no control(Rights to decide) on the result, The best you can do is give your best effort on current action and leave the unknown to the god. Thats the reason this sloka talks about Adhikara(Authority) and not about dharma(Duty). I feel this is most misunderstood concept of karma yoga and specially this sloka. Karma yoga is karmic science, Krishna explains how karma works, When it binds, When it doesn’t, etc. He never tells this is the right way to be, Its just science what he explains, readers can apply it as they wish.

Friday, January 23, 2015

Data Systems

Generally all Data Systems have below components:

1. Data Collection:
Enables feeding data into the system. Copy log files, sync with external database etc

2. Data Storage
Stores data. Can be disk based, or Database too.

3. Processing
Processes the large volume of data. Data can be stored on disk or database.

4. Querying
Fetch the data from Data Storage with appropriate filters.

5. Reporting
Display/Visualize/Generate reports Information derived from the Data.

Data Systems components

What differentiates BigData systems with Traditional Data Systems is Scalability. Traditional systems satisfied the requirement of the past era where a single installation of database could meet the requirement of the whole organization. In the age of internet, Such systems do not cater to process webscale of data.

Difference b/w Traditional data systems and BigData systems

BigData systems:

There are many BigData systems available, below is the list of few well known systems.

1. Hadoop: Developed and opensourced by Yahoo!
2. Cosmos: Microsoft BigData system
3. Oracle Big Data Appliance: Hardware and Software combo from Oracle.


Among these, Hadoop is well known opensource BigData ecosystem.


Thursday, June 19, 2014

Introduction to BigData

The "Big" in BigData literally signifies size of the data at hand.

Examples:
1. Data generated due to Billions of likes by Facebook users every day
2. Data generated due to Millions of tweets

This data will result in huge amount of back end data sizing up to terabytes, Hence the name BigData. Along with Size, The rate at which the data is generated also is high. Also the variety of data that is generated, May be unstructured log files, or structured ones. So 3 V's or properties which describe the BigData are, Volume, Velocity and Variety. Although BigData pundits define it with 3 V's, The first 'V' i.e Volume itself is enough for it to be called as BigData, Velocity and Variety are result of the source of the data and should not be a prerequisite for considering any BigData solutions.

Lets look at processing BigData:

Processing BigData requires "Divide and Conquer" approach.

For example, Suppose we have 1 K records to search for some specific word(grep), and to check 1 K line it takes around 1 second, how long would it take to grep 1 billion lines ?

If we assume we will have a dedicated system, it will take 1,000,000 seconds to process 1,000,000,000 (1 Billion) records, i.e approximately around 11 days.

So what? We can wait for 11 days, Whats the issue? Problem is in those 11 days, We would have generated billions of more records for grepping, this is a never ending process as more data is generated continuously.

Whats the solution?

1. Build a super fast super computer, so grepping is faster than the data generation
2. Setup multiple computer to process 1 Billion lines and parallelize the processing so grepping is faster than the data generation
3. If our requirement is to only get the count of lines having the specified word, we can have statistical way. Grep only 100000 lines for the specific word, and then extrapolate for 1 Billion lines.

Currently option 2 is lot cheaper than 1 and certain compared to option 3. Also option 3 is applicable only when we need counts or averages and not suitable in other text processing.

To implement option 2, Below steps provide a Golden Template which is Divide and Conquer method for handling such processing.

1. Setup multiple system in network to process the BigData
2. Divide the BigJob to smaller Job Parts
3. Distribute the Jobs to individual systems
4. Process individual Job Parts
5. Collate the individual results
6. Sumup/rollup the results

In Short BigData processing is application of Parallel processing when data at hand is huge,unstructured and continuosly increasing, and hence cannot be processed using traditional single instance tools due to size and time limitations.

When above Divide and Conquer template is used for grepping Billion lines, it would be as below.

1. Setup 100 systems in network
2. Split the 1 Billion records into 100 files with each having  10,000,000(10 Million) Records
3. So, now we have 100 systems, and 100 files, copy 1 file to each system.
4. Start grep on the files copied in step 3 on All 100 systems, store the result in temporary file.
5. Copy the temporary files generated in step 4 to one central server
6. On central server, Merge all temporary files. And we have completed grep of 1 Billion lines.

Ignoring the work/time overhead involved in splitting, copying , merging, we can say we completed the grepping of 1 Billion lines in under 3 hours! which would have taken 11 days on single system.

Apart from these we also need to make sure of few things listed below.

1. Since Data is huge in size, Our file system should support it and it should be accessible from all the systems in the network
2. Since our systems are not specialised and low cost, they are prone to failure, we should handle failure of individual systems and also make sure of no data loss.

The above template can be used for processing data in many scenarios and not only limited to grep, Just need to follow the template of splitting the job, distributing, processing, and collating. To simplify and automate these steps, we have frameworks like Hadoop which automates most of the common steps like splitting, distributing, and collating of the results. Users of the framework need to work on only processing of the data.

More on Hadoop:

1. It has distributed file system (called HDFS) which provides zero data loss environment for storing and retrieving TeraBytes of data
2. It has DataBases which use HDFS to store their data, hence provide a way to store structural data running to Billions / Trillions of rows
3. It has MapReduce frame work, Which can Divide Jobs, Distribute it, And Collate the result for final rollup/sumup. The MapReduce framework also handles individual system failure by keeping track of which job part is assigned to which system and reassigning it to different system on failures
4. It has SQL like query engine named Hive to retrieve data from HDFS or Databases like Hbase. Hive internally schedules MapReduce Job to perform the task.

Hadoop MapReduce is a batch/bulk data processing framework, You need to have complete data at hand to begin processing. This is not suited for many reallife scenario where we need realtime results. For example, Hadoop MapReduce can be great for finding out fraud in Banking systems by crunching billions of transactions done on previous day, But is not suited if the requirement is to stop a fraud in realtime, like stopping / blocking spammers abusing the system in realtime.

Alternatively to Hadoop MapReduce, Frameworks like Twitter Storm allows processing of data in RealTime.

General Applications of BigData:

Most of the Applications of BigData is to derive insights, i.e Analytics of some form. General perception is BigData means Analytics and vice versa, However we can apply the above pattern for other usecases which are not analytics. One such non-analytical BigData deployment was done to main the huge mail system at my current company. Millions of mails needs to be archived/deleted/moved to different storage every day, Data at hand is huge(amounting to 10's of TB every day), This amount of data cannot be acted upon using traditional way, This has to be distributed for achieving operational targets, We applied above discussed pattern and achieved it using custom framework instead of using Hadoop MapReduce.

BigData can also be used in system security, A Mail security system was deployed to keep a tab on compromised accounts and also to keep spammers/abusers in check, Again using custom framework. However, this security system uses some kind of analytics involving user's usage patterns/behaviour and hence would be categorised as "Analytics of some form".