The Bra Dilemma

The bra, formally brassiere... Today, I just want to dig the subject of this popular underwear a bit. As far as I know, women have been using breast supporting garments since 1500 BC. The modern bra is the evolved form of restless corsets and became an industrial product around the year of 1930. You can examine the basic parts of an abstract bra in the image below:
According to my experiences, a small tie shaped silk band located between the cups is an essential part of a modern bra as well :) I don't know why it is omitted in the above image...

Anyway, my observations about the women's demands from a bra are
  1. Women want a bra to support their breasts and they want to achieve a sexy and healthy bosom posture.
  2. Women want a bra to protect their breasts and nipples from aggressive glances.
  3. Women don't want a bra to be realized as an underwear. They want bras to be hidden.

Three observations in contradiction. Number one stresses that women want their breasts to attract attention, they want them to seem well and be realized by others. Number two highlights the women's feeling of hiding their breasts from the outside world. So in here, we can consider the bra as the armour of the breasts. And number three says that women want to appear in a natural way, they do not want to reveal the fact that they are supporting and protecting their breasts by using an artificial thing.

What is this? Too complex to understand... Too complex to live with...

I tnink that this unnatural complexity is the fault of the men dominated social life. Naturally, women never want to hide their breasts under some uncomfortable garments which presses over and make them sweat and scratch their delicate skin all day. But they want to be in the ideal feminine shape defined by the men's desire. As James Brown said, "it is a man's man's man's world"... Moreover, they want to feel secure against the men's gaze and disturbance that annoys women very often in daily life. So the market produced a product that supplies those complex and meaningless demands: The bra. And its contradictions. The following advertisement is a good example of the absurdity that forces the bras exist:

Some social movements exist under the brand of topfreedom and I hope they broaden fast. Topfree Equal Rights Association (TERA) and Bara Bröst (Bare Breast in Swedish) are good and most popular ones in action.

I know that I sound too feminist as a man. However, I believe that humanity needs to simpilfy the over complex, traditional and dogmatic issues of life to step forward in civilization. We don't need to undergo those dark and vague spots which choke open minded human beings. I consider those spots as tumors of the social system.

The life is unique and we have to glorify the life itself and ourselves. Let's open our eyes and see the naked truth. Are we that brave?

Engineering versus Aesthetics?

A couple of weeks ago, I was a participant of a discussion, which was about "aesthetics in software". I must confess that -as a programmer- motivating myself as if I am producing an art work while I am programming computers is a good way of self satisfaction. It makes you feel elite, you might consider yourself as Michelangelo Buonarroti sculpting the David :)
At this exact point, my friends, I am inviting you to bad-sad reality. The reality says that Michelangelo examined hundreds of cadavers for mastering on the anatomy which is essential for coming up with the real aesthetic values like David, Moses or Pietà. You've got to know the veins, muscles, bones and connective tissues well for being able to create realistic aesthetic art-works. It is necessary to know those fundemantals even if you are willingly to create surreal works of art, because you need to decompose the parts first and then, compose them in your own way again which you cannot do if you know nothing about the rules of connections between the original parts. We have to accept the truth that all those bloody anatomic parts and the idea of cutting the dead bodies in detail do not sound well and it might be hard to relate them with fine arts in the first stage. But this feeling of us does not change the reality...

When it comes to software, we cannot refuse that it is likely to find factors of easthetics in software products. Where are those factors coming from? My immediate answer to this question is Mathematics. Software itself is an implementation of a mathematical approach and we know that mathematical approaches may sometimes be very aesthetic. Besides, a software product might still be beautiful even its mathematical origin is very plain. At this time, the source of the beauty in software is well engineered design. Actually, I believe and have been experiencing that when you engineer the software well, you usually end up with a beautiful product. I recommend the book named Beautiful Code for having the chance to examine some examples of really beautiful software. My rule of thumb about the software development life cycle is "engineer well first to obtain the beauty". It is the easier way of achieving the beauty in software because the other way dictates that you have to develop a very innovative and smart mathematics like Alan Turing, Pythagoras, Carl Friedrich Gauss and Blaise Pascal did in the past and it sounds impossible for ordinary software developers like most of us. Moreover, aesthetics is a branch of academic philosophy and is not an easy to understand and objective issue. If you are not a philosopher or an artist, you cannot deal with it easily. Plus, coding a computer program is more likely to legislation process than painting, making music or sculpting. We never call laws and acts aesthetic, but they might be compact, universal, efficient, logical, well designed etc. By chance (!) we use the same adjectives for software as well.

My advice to software engineers is: "You are software engineers, not software artist". It is written "Bachelors/Masters of science/engineering" on our diploms not "Bachelors of arts". As the real engineers, simply do your duty in the way you have been thaught at the college. The rest is just a sweet dream.

Things to keep in mind shortly about designing software:
  1. Coupling: The level of interdependence among modules. You have to make the module interfaces clear and simple. Low degree of coupling is better.
  2. Cohesion: The internal strenght of a module. The module whose internal parts are strongly related to each other and to the purpose of the module is strongly cohesive. High level of cohesion is better.
  3. Size and Complexity: There are many software metrics like cyclomatic complexity, Halstead volume, maintenance index, time and space complexity (big-O notation), line of code, function point analysis etc. You have got to know how to use, manage and optimize those metrics.
  4. Fan out: Number of subordinates immediately called by a module.
  5. Fan in: Number of modules that invoke (call) a module.
  6. Scope of effect (SoE) and Scope of control (SoC): SoE is the collection of modules that contain code dependent to a decision. If a decision called D located in module M affects the execution of 3 modules: M1, M2, M3 then SoE(M) = {M1, M2, M3}. SoC of a module is the collection of subordinates of the module and the module itself. Te rule is: For module M, SoE(M) must be a subset of SoC(M).
After those design issues, there are, of course, many more issues to consider about the quality of the software such as: Usability, Reliability, Portability, Maintainability, Functionality and Efficiency.
Actually we, the professionals of the industry, are not working for finding the beauty but the ways of reducing the total cost of owning a software. That's why we are called engineers. Besides, we can satisfy our artistic appetite by learning the correlation between "the good design" and "the beauty".

Rules of Ruling

I am reading the book "King of the Mountain: The Nature of Political Leadership" by Arnold M. Ludwig who tries to define the characteristics of political leaders by analyzing the biographies of 377 rulers of the last century, in detail.

When this book was published in 2004, it was on the newspapers in Turkey, because Mustafa Kemal Atatürk was defined as the most qualified political leader amongst the others by Ludwig. Yes, it was a populist tendency to bring this book on the papers at that time just because of the book points Atatürk as number one. Besides, the book itself is a really good one. The most impressive side of the Ludwig's approach to political leadership is that he compares the leadership properties of human beings and apes in the book, and to be honest, we humans are very likely to our relatives in the jungles when it comes to governing the society. As far as I know, this book is the first scientific attempt to categorize the leaders of different countries according to some set of very objective attributes of leadership. Beyond this, the method of the human societies and the ape colonies comparison in leading makes the book unique, already.

What I am trying to do here is not writing a review to this book. In fact, I will write down the major findings of Arnold M. Ludwig about world leaders and leave the rest of the book to your interest. Here are the brief items in Ludwig's words: (Pages 2-4 in the book)

  • All nations have rulers.
  • Essentially all the rulers of all the nations in the world during the last century have been men.
  • In many societies throughout the world, male rulers have a decided breeding advantage over other men, not only in their access to women but in the size of the harems and the number of mistresses they keep.
  • No identifiable form of intelligence, talent, genius or even experience seems necessary for ruling a country.
  • Leaders need not be sane, rational, or even mentally competent to rule a country.
  • Although intellectual or academic credentials seem irrelevant for ruling, one of the time-honored ways individuals establish their qualifications for leadership is by showing physical prowess and courage in battle.
  • Many leaders who come to power forcibly do not seem to learn from the mistakes of the past rulers.
  • In many instances, would-be rulers risk their lives to gain ultimate power and, once they have it, risk their lives to keep it.
  • Throughout the history, rulers who attain legendary status often tend to be those who have conquered other nations, won major wars, expanded their country's boundaries, founded new nations, forcibly transformed their societies, and imposed their own beliefs on their subjects.

No women among the rulers! I cannot believe the submission that women have. If I were a woman, I am sure that I would be very angry and unhappy. Anyway, this might be another topic in the blog :)

The Virus

Do you think that we, human beings, are the most dominant species on the Earth?
I really don't think so. I believe that microscopic life forms, especially the viral ones are the most powerful species around the world.
National Center for Health Statistics announced the top 10 causes of death in United States by 2006 as:
According to the some articles in the book, Next Fifty Years, by John Brockman, different sorts of long running viral infections cause most of the cancer types, and some diseases of those we know no proven cause yet, like Alzheimer, MS etc.
Therefore, I hate those God damn micro life forms. They're killing us cruelly since the beginning of time and we cannot fight against them in a sufficient way. Remember tuberculosis, black death, AIDS, SARS, ebola, Crimean-Congo haemorrhagic fever (CCHF), fatal influenza forms appearing annually in the recent years. What are we doing about them? We have beaten the historic forms of some viruses but we are very vulnerable to the evolved viral forms.
Come on doctors, work harder! Save us!
Nowadays, beautiful Charlize Theron is striving to beat the viral infection in her stomach. As far as I know, she spent 4-5 days in the intensive care unit of Cedars-Sinai Hospital, Los Angeles.
I am trying the understand the game of evolution... [Possibly, homo sapiens can be considered as the viruses of the universe, if we look at the scene from an objective macro perspective. But I don't want to sheer this way now...] What is the aim of this kind of a natural selection? One ugly ribonucleic acid chain (RNA) covered by a protein shell is trying to conquer one of the most beautiful organisms of the world: Charlize Theron.
It is insane! Really unfair.
Pray for Ms. Theron, my friends, we are not ready to lose her yet!
Get up girl! Get up and smile us again.

Decision Tree

Today, I am going to mention about creating a decision tree from a data table. Actually, for this simple operation, a lot of professionals pay huge amounts of money to the other professionals, let's say external data mining consultants, for having them give a meaning to their own enterprise data.
Here is the operation:
Firstly, we are going to analyze our columns (attributes) comprise the data table. The point of the analysis is to determine the classification attribute and the attributes which bring the highest level of information in their values. The attributes carrying the highest level of information are going to be our decision nodes in the tree.
Sample data table is below (fig. 1). The table is about passing a course at a college. The pink column, term result, is the classification attribute and available classes are "passed" and "failed". We are trying to reveal the effect of "self studying", "team work", "relations with the lecturer" and "the course attendance" to passing the course.

Figure 1.

There are some key points of the attrbute analysis. The value of an attribute regarding to the corresponding classification target is called Information Gain. The equation of information gain is as follows:

Equation 1.

Where P() denotes the probability and k stands for the label of the distinct values of an attribute. To make this clear, please check the example below:

Figure 2.

Figure 2 shows the sorted values and their corresponding classes of the attribute "course attendance". And it is a subset of fig. 1. The P(k) in equation 1 will take the values P(Bad), P(Good), P(Moderate) and P(None). The value of P(Bad) is 0.3 beacuse there are 3 out of 10 tuples labeled as Bad in fig. 2. Similarly the value of P(None) will be 0.1 (1/10).

The term Gini in equation 1 is the measure of impurity. And it is applied to the attributes of our table. Some attributes might be homogeneous which means that all the values of this attribute map the same class. In contrary, some attributes, like "course attendance" in fig. 2, have different values addressing the different classes and we call those attributes heterogenous or impure. There are different measures of impurity like classification error, entropy and Gini index. I am giving the equations of all but will be using the Gini in this text for measuring the impurity.

In the equations above P(k) is the probability of the class mapped by the values of the attribute. We can look back to figure 2 for understanding it. Examine the rows containing the "moderate" course attendance which are given in figure 3, below.


Figure 3.


The P(k) in the equation of Gini index will be P(Failed) = 1/3 and P(Passed)=2/3. And the Gini index for course attendance attribute will be 1-[(1/3)^2+(2/3)^2] = 0.44 where ^2 denotes the power of 2, in other words square operator.

As you can see, we will compute the impurity for each distinct value of every attribute, firstly. Secondly, we will calculate the information gain by every attribute by using their impurity degrees. Third, we will compare the information gain of the attributes and pick the one with the highest information gain level as the decision node of our tree. It will be end of a node description cycle. The similar cycles may follow in a recursive manner if further splits in the tree needed.

Let's start the procedure... The Gini of our initial table will be calculated by using our classification column, term result. There are 5 Failed and 5 Passed classes in the table. So

P(Failed)=0.5

P(Passed)=0.5

Gini(Parent) = 1-[0.5^2+0.5^2] = 1 - 0.5 = 0.5

According to that parent Gini value, the below figure shows the evaluation of our attributes regarding to their information gain.



Figure 4.



The winner is course attendance with the gain of 0.23. So our decision tree has a root and some leaves now. The very first form of the tree is given below (Fig. 5).

Figure 5


Now, cycle 1 ended and initial table in fig. 1 became shorter as given in fig. 6 below. We filtered the rows by giving the condition of Course Attendance in Good and Moderate. We have to split the nodes for those values.



Figure 6.


We will use the first 3 rows of data while we are running the second decision node description cycle. So that, in this cycle those 3 rows will become our parent table. Gini(Good) and Gini(Moderate) values have been calculated in cycle 1 and can be examined in fig. 4. Gini(Good) will be our Gini(Parent) in cycle 2. In this stage, course attendance will no longer be evaluated as a node candidate, we will focus on the other 3 columns: Self studied, team work and relations with lecturer. Next figure (Fig. 7) shows the information gain values of those attributes for the first 3 columns of the table in fig. 6.




Figure 7.


We have 2 attributes with the info gain of 0.44 (team work and self studied) so we can chose any of them as our second decision node in the tree. My choice will be team work. After cycle 2, the tree becomes as follows.


Figure 8.

It is time for cycle 3, where the situation with the moderate course attendants will be defined. We will use the second 3 rows of the table in figure 6, Gini(Parent) will be 0.44 and our candidate attributes will be self studied, team work and relations with lecturer. Let us see calculation in figure 9:


Figure 9.

Winner of cycle 3 is the attribute self studied with 0.44 of information gain. Finally, the decision tree is fully constructed. Here you are.


Figure 10.

According to the decision tree, relations with lecturer has no effect on passing this course.

As you can see, a software specialist can easily write a program for creating a decision tree by using a data set. No need to pay extra for this :)

Formally, subject of the decision trees is a vein of classification of predictive data mining which is a branch of machine learning.

God bless mathematics ;)

Envy-Free Cake Division 2

In my previous post, I discussed the mathematics of fair division and I introduced the Selfridge & Conway's algorithm.
While we are talking about the deterministic rules working for setting up controlled decision environments, everything might seem very clear and understandable so that we all might be persuaded about the conditions of the environment and motivations of the rules which are to solve the problems across the environment.

But.

Real life is much more vaguer than the well defined solution environments and because of this, most of the solutions devised can't satisfy the stakeholders of the problem domain. For instance, if I were the party A in the Selfridge-Conway procedure, I could have still been envying to a piece other than mine by arguing that "Why am I chosen for cutting the cake first? If cannot cut the cake in 3 equal pieces, it will be a disadvantage for me! I'd like to be the first picker!" And nobody can criticise me becuse of my opinion about the procedure.

One can say that, "Okay, you have to agree on the pillars of the procedure firstly!".
Yes, it is a good starting point. And a powerful statement that ties me up about obeying the rules. However, even if I agreed the rules of the procedure, after the procedure ends, I might still be unhappy with my piece and crying about it. It is possible!

Then, would it be my psychological problem or would it be the truth that such problems are unsolvable if you are dealing with human beings and their feeling of justice and satisfaction? Is there a way for highly intellectual people to share things without using brute force? In personal interactions, human beings had come a significant way when it comes to solve the problems in a civilized way. On the other hand, in international relations brute force is being used vastly between parties.

I believe that we are standing just besides a threshold!
After a revolutionary step, which has been led by "pure" science, over this threshold, the big question marks in our minds will disappear very fast. And we all are going to take our most relieved breath! ...before finding us new and bigger question marks :))

Think of this!

Envy-Free Cake Division

During my military service in Ankara, in one of the lectures at the military academy, a commander was talking about how to command the team in a fair manner. And he asked "How do you think 2 guys share a cake without envying to each other's piece?" Our answers involved the use of measurement tools but the commander gave the prerequisite that they cannot use any measurement tools, but the knife, hands and eyes. Then, the answer was very clever: "I cut, you choose" procedure works pretty fine for two guys. The first one cuts the cake into 2 equal pieces according to his perception of equity. And the second guy chooses the piece to pick for himself. No one envies.

When you are dealing with such a problem, and when you are a young engineer, your brain generates subsequent problems immediately: What if there are 3 guys to share the cake? I was not able to google this under those circumstances so I and a couple of my "brother-in-arms" discussed the problem and offered some premature solutions. Most successful one was reducing the problem t0 2 guys model after 1 arbitrary guy cuts the cake into 3 pieces. Procedure was like this for players A, B, C:
  1. One of the guys, let's say A, cuts the cake into 3 pieces
  2. B chooses one of the pieces
  3. C chooses one of the pieces
  4. A picks the last piece on the table
  5. A-C, A-B, C-B pairs try to agree that all the pieces are equal. If they cannot agree, they use the "I cut, you choose" procedure for their pieces.
For example, after step 4, A checks the piece which belongs to B and if he envies B's piece, B cuts his piece into two and A picks one of the pieces and then, A cuts his piece into two and B picks one of the A's pieces and at the end they end up with an envy-free division. As a conclusion, A and B have 4 smaller pieces. After that, player C may want to do "I cut, you choose" with B and this operation results in C and B having 6 pieces. And the round goes...

The problem with this approach was this procedure tends to last forever because after A-B, B-C, A-C agreements, B might envy C's pieces and they start sharing again, the second tour... Perhaps, in practice it never goes too far but the procedure must be able to halt in a meaningful fashion.

After all the discussions, I have not focused on the problem for about 4 years.

Then suddenly the problem grabbed me again. But this time, I googled :)) And of course, I found all the literature about envy-free cake division problem. There are more than 6 algorithms designed. To me, two of them are very good: The first one was announced by Selfridge & Conway in 1960s. The latter is called "moving knives" and devised by Stromquist. I will explain the first one here.

The problem: Parties A, B and C want to share the cake fairly. They will use just a knife.


Figure 1. Selfridge & Conway stage 1.


The procedure comprises 2 stages. In stage 1,
  • Party A cuts the cake into 3 pieces regarding just his feelings of equity (step II in fig. 1).
  • Party B controls the pieces, if he thinks that at least two of the pieces are good for choosing (means those two are equal), he does nothing.
  • Party C picks a piece.
  • Party B picks a piece.
  • Party A picks the remaining piece.

Everything is perfect. However, if party B thinks that one piece is quite bigger than the other ones, in the second bullet above, he takes the knife and trims the biggest piece in order to produce at least 2 tied pieces. (See the III in fig. 1) Then, no one can pick the "trm" bit in the stage 1. And procedure goes:

  • Party C chooses a piece.
  • If party C did not choose the trimmed piece (piece number 3 in fig. 1), party B has to pick trimmed piece.
  • Party A picks the remaining one.

Stage 1 is done. No one envies the other. Now, it is time to divide the "trm" bit.



Figure 2. Selfridge & Conway stage 2.

  • Among B and C, the party who did not pick the trimmed piece in stage 1 cuts the trm bit into 3 by his knife.
  • If the party who cuts the trimming into 3 is B, then the parties pick the pieces (t1, t2, t3 in fig. 2) in C, A, B order. If the party that cuts the trm bit is C then the picking order is B, A, C.

Stage 2 ends. It is an envy-free division process. We're all done with this.

The problem, of course, goes too far by considering n parties to share the cake :)) but let us leave the rest of the story to the mathematicians.