Sunday, August 26, 2012

Hey Sir, You Can Install An Application Program, Can't You?

Good evening everybody

Glad to find my time and my mood to write a post again. My activities led me to face difficulties to see this blog dashboard for a long time. I am glad to be able to see this "create post" page. Thank you Blogger team, it is a better dashboard page now.

In this post I would like to tell you my experience when I was in taxi to get to the bus station in my way going back to my hometown. I hope this experience was given to teach us to be grateful for what God has given.

After a very exhausting day in campus, in a lazy afternoon, I had to go back to my hometown. The fastest and easiest way to get to the station (but rather expensive of course) is calling a taxi. Great, I ordered one.

When I was on the way I had a conversation with the taxi driver. This is the conversation, approximately, as long as I remember:

driver: "So you are going to the station. Where are you going to go?"
me: "my hometown"
driver: "Holiday?"
me: "not really, a break before final test."
driver: "well you are a student. what semester are you now?"
me: "second"
driver: "wow you are a freshmen, aren't you?"
me: "not really for bachelor degree sir, i already graduated. i am continuing my study in post graduate right now."
driver: "good job, where do you study?"
me: "electrical engineering"

A quite long pause, and the conversation started again.

Suddenly, a hard question...

driver: "so, in your level right now, what kind of electrical engineering ability that you can do?"
me: (Oh my God I don't focus on electrical engineer, my focus is information technology, moreover, I am weak at IT skill) "actually I am taking information technology focus sir, so if you ask me about electricity, power, then I will answer nothing." (lol)
driver: "well, ok, information technology. so what is it about? is it a..."
me: "umm, you know,, website.." (you know what, I didn't bear to say about intelligent system, expert system, induction, and so on, so the common technology may help this time i think)
driver: "well, about your your ability, you can... install an application program, can't you?"
me: "well, hahaha, yes" (i am thinking about clicking "next" button many times to install an app on windows or sudo apt install command on Debian based linux. Oh my God)

After that, I don't expect he said this to me..

driver: "I'm glad to see students. I'm glad to see educated people. I'm old right now, but, you know, I still have a dream to study at university. But, how can I be a student if reading a newspaper makes me sleepy?"

That was a difficult statement to be replied. I didn't know how to entertain him. I just could say a short statement to encourage him.

me: "you can if you want to strive for it sir"

This is a subset of reality in our country, and another countries maybe. This experience teaches me that someone with opportunity for high degree education should thank God, work hard, and should not waste this chance in order to help more people by real contribution.

My apology, let me relate this to religious way of life, it is no use for us to act and to dress like a strict believer when our contribution to society is null.

Thank you. My apology for any mistakes made in this post.

Wednesday, November 30, 2011

Internship at PT. Telkom

Dear readers,

Still in my internship at PT.Telkom, now i would like to tell you a bit about what we are doing here. We are building such a reporting system prototype, large scale reporting system. Let me share a tips for drawing a use case diagram.

You may think that what's the point with creating use case diagram? Just add an actor symbol and connect use cases to the actor, based on what the actor can do in the system.

You got the point there, but please note. Use case is not only about what the user can do. I don't know if it is correct theoritically or not but you better think about the readibility and how that use case can represent the business process of the system.
That is the workflow. Now I want to show you a "bad" use case and a "good" use case.





Instead of drawing a use case just like the "bad" use case example, you can draw the use case better just like the "good" example. The "good" use case can describe how the process flowing from creating a report through the final step, final decision from executive general manager if the escalation happened.

That's all fot the tips. Thanks for reading.

Monday, November 28, 2011

Tips Menjadi Orang Ikhlas

Dari pengajian di PT. Telkom bandung. Menarik.
Tips menjadi orang ikhlas

  1. Lihatlah sesuatu dengan sudut pandang Allah, bukan manusia.
  2. Sinkronkan perbuatan lahir dan batin.
  3. Pujian dan celaan sama saja, mereka hambar.
  4. Jangan lihat suatu perbuatan dari besar kecilnya pahala, tapi carilah keridhaan Allah.
  5. Jangan sebut-sebut perbuatan kita yang ikhlas.
  6. Jaga diri dari riya'.
Sekian dulu, terima kasih.

Saturday, November 26, 2011

Perceptron, Winnow and Balanced Winnow in Java

References

John Wakefield, Single Layer Perceptron [online] (http://dynamicnotions.blogspot.com/2008/09/single-layer-perceptron.html)
Hiroki Arimura, Winnow Algorithm [online] (http://www-ikn.ist.hokudai.ac.jp/ikn-tokuron/arim4winnow.pdf )
Roni Khardon, The Winnow Algorithm [online] (http://www.cs.tufts.edu/~roni/Teaching/CLT/LN/lecture16.pdf )

Here We Go

So many explanation? Please no, I'm sleepy. Let me just post this and explain later.
For simplicity, here is the class diagram.

public abstract class LinearClassifier {
	
	protected double[][] inputs = null;
    protected double[] outputs;
	
	protected Double learningRate = 0.45;
	
	public LinearClassifier(double[][] inputs, double[] output) {
		this.inputs = inputs;
		this.outputs = output;
	}
	
	abstract void calculateWeight();
	
	abstract double activationFunction(double[] input);

	//A class to record the calculation status for each iteration
	public class IterationStatus {
		public int iteration;
		public int instanceNumber;
		public double[] input;
		public double output;
		public double prediction;
		public double error;
	}
}


import java.util.ArrayList;

public class Perceptron extends LinearClassifier {

	/*variable to record the state of computation for each iteration*/
	private ArrayList iterations = new ArrayList();
	
	public double[] weights;

	public Perceptron(double[][] inputs, double[] outputs) {
		super(inputs, outputs);
		
		this.calculateWeight();
	}

	public ArrayList getIterations() {
		return this.iterations;
	}
	
	@Override
	void calculateWeight() {
		// TODO Auto-generated method stub
		
		int	numOfInstance = this.outputs.length;
		int numOfAttribute = this.inputs[0].length;
		
		//1. Initialize weight to 1.0
		this.weights = new double[numOfAttribute];
		for(int i=0; i < numOfAttribute; i++) { 
			this.weights[i] = 1.0 ;
		}
		
		
		//2. Define the total error of instances, iteration counter
		//and maximum iteration
		double totalErrorOfInstances;
		int iteration = 0;
		int maxIteration = 20;
		
		do
		{
			totalErrorOfInstances = 0;
			
			for(int i = 0; i < numOfInstance; i++) {
				
				//set iteration object
				PerceptronIterationStatus current = new PerceptronIterationStatus();
				current.iteration = iteration;
				
				// System.out.println("\nInstance iteration : " + i);
				current.instanceNumber = i;
				
				//Calculate prediction for current instance
				double prediction = this.activationFunction(inputs[i]);
				
				//Calculate error
				double errorOfInstance = outputs[i] - prediction;
				current.error = errorOfInstance;
				
				//Check error
				if(errorOfInstance != 0) {
					
					for(int j = 0; j= 0) return 1;
		else return 0;	
	}
	
	public class PerceptronIterationStatus extends IterationStatus {
		public double[] weight;
	}
}


import java.util.ArrayList;

public class Winnow extends LinearClassifier {

	/*variable to record the state of computation for each iteration*/
	private ArrayList iterations = new ArrayList();
	
	public double[] weights;

	public Winnow(double[][] inputs, double[] outputs) {
		super(inputs, outputs);
		this.calculateWeight();
	}
	
	public ArrayList getIterations() {
		return this.iterations;
	}

	@Override
	void calculateWeight() {
		//get the number of instances and attributes
		int numOfInstances = this.outputs.length;
		int numOfAttribute = this.inputs[0].length;
		
		//Initialize the weights to 1/N
		weights = new double[numOfAttribute];
		for (int i = 0; i < weights.length; i++) {
			weights[i] = 1;
		}
		System.out.println("Weight computed");
		//2. Initialize total error of instances, iteration counter and 
		// max iteration limit
		double productErrorOfInstances;
		int iteration = 0, maxIteration = 20;
		
		//3. While the total error of instance is not zero
		// and it hasn't reach the max limit of iteration, iterate
		do {
			//For each iteration set this variable to 1
			productErrorOfInstances  = 0.0;
			
			for (int i = 0; i < numOfInstances; i++) {
				// System.out.println("\nInstance iteration " + i);
				
				//set the iteration status 
				WinnowIterationStatus current = new WinnowIterationStatus();
				current.iteration = iteration;
				
				current.instanceNumber = i;
				
				//calculate prediction
				double prediction = this.activationFunction(this.inputs[i]);
				// System.out.println("Prediction " + prediction);
				// System.out.println("Output " + this.outputs[i]);
				
				//check the error of this instance, this statement will
				//produce 0 if error, 1 otherwise
				double error = this.outputs[i] - prediction;
				// System.out.println("Error " + error );
				
				//if error, e.g. error = 0
				if(error != 0.0) {
					for (int j = 0; j < numOfAttribute; j++) {
						//if error occurs in positive example, e.g. output == 1
						//then multiply weight by n^input[j]
						if(this.outputs[i] == 1.0 && this.inputs[i][j] == 1.0) {
							weights[j] = weights[j] * Math.pow( new Integer( numOfAttribute).doubleValue(), this.learningRate);
						}
						else if(this.outputs[i] == 0.0 && this.inputs[i][j] == 1.0) {
							weights[j] = weights[j] / (Math.pow(new Integer(numOfAttribute).doubleValue(), this.learningRate));
						}
					}
					
					
				}
				
				current.input = this.inputs[i].clone();
				current.output = this.outputs[i];
				current.prediction = prediction;
				current.weight = this.weights.clone();
				
				this.iterations.add(current);
				//set the productErrorOfInstances
				productErrorOfInstances = productErrorOfInstances + error;
				
			}
			//increment iteration
			iteration++;
			
		}while(productErrorOfInstances != 0 && iteration < maxIteration);
		
	}

	@Override
	double activationFunction(double[] inputs) {
		// if wx > n -> positive, if wx < n -> negative
		double output = 0.0;
		double n = (new Integer(weights.length)).doubleValue();
		// System.out.println("Inside activation func, n = " + n);
		for(int i=0; i= numOfAttribute) return 1;
		else return 0;
	}
	
	public class BalancedWinnowIterationStatus extends IterationStatus {
		public double[] positive_weights = null;
		public double[] negative_weights = null;
	}
}


import java.util.ArrayList;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		//AND pattern
		double[][] andInput = new double[4][3];
		double[] andOutput = new double[4];
		
		andInput[0][0] = 1.0; //bias
		andInput[0][1] = 0;
		andInput[0][2] = 0;
		andOutput[0] = 0.0;
		
		andInput[1][0] = 1.0; //bias
		andInput[1][1] = 0;
		andInput[1][2] = 1.0;
		andOutput[1] = 0.0;
		
		andInput[2][0] = 1.0; //bias
		andInput[2][1] = 1.0;
		andInput[2][2] = 0;
		andOutput[2] = 0.0;
		
		andInput[3][0] = 1.0; //bias
		andInput[3][1] = 1.0;
		andInput[3][2] = 1.0;
		andOutput[3] = 1.0;
		
		System.out.println("\n\n==================================");
		System.out.println("---------AND---------");
		System.out.println("\n\n==================================");
		System.out.println("PERCEPTRON ALGORITHM");
		Perceptron p = new Perceptron(andInput, andOutput);
		displayIterations(p);
		System.out.println("\n==================================");
		
		System.out.println("\n\n==================================");
		System.out.println("WINNOW ALGORITHM");
		Winnow w = new Winnow(andInput, andOutput);
		displayIterations(w);
		System.out.println("\n==================================");
		
		System.out.println("\n\n==================================");
		System.out.println("BALANCED WINNOW ALGORITHM");
		BalancedWinnow bw = new BalancedWinnow(andInput, andOutput);
		displayIterations(bw);
		System.out.println("\n==================================");
		
		//OR pattern
		double[][] orInput = new double[4][3];
		double[] orOutput = new double[4];
		
		orInput[0][0] = 1.0; //bias
		orInput[0][1] = 0.0;
		orInput[0][2] = 0.0;
		orOutput[0] = 0.0;
		
		orInput[1][0] = 1.0; //bias
		orInput[1][1] = 0.0;
		orInput[1][2] = 1.0;
		orOutput[1] = 1.0;
		
		orInput[2][0] = 1.0; //bias
		orInput[2][1] = 1.0;
		orInput[2][2] = 0;
		orOutput[2] = 1.0;
		
		orInput[3][0] = 1.0; //bias
		orInput[3][1] = 1.0;
		orInput[3][2] = 1.0;
		orOutput[3] = 1.0;
		
		System.out.println("\n\n==================================");
		System.out.println("---------OR---------");
		System.out.println("\n\n==================================");
		System.out.println("PERCEPTRON ALGORITHM");
		p = new Perceptron(orInput, orOutput);
		displayIterations(p);
		System.out.println("\n==================================");
		
		System.out.println("\n\n==================================");
		System.out.println("WINNOW ALGORITHM");
		w = new Winnow(orInput, orOutput);
		displayIterations(w);
		System.out.println("\n==================================");
		
		System.out.println("\n\n==================================");
		System.out.println("BALANCED WINNOW ALGORITHM");
		bw = new BalancedWinnow(orInput, orOutput);
		displayIterations(bw);
		System.out.println("\n==================================");
	}
	
	static void displayIterations(LinearClassifier classifier) {
		
		if(classifier.getClass() == Perceptron.class) {
			Perceptron pClass = (Perceptron)classifier;
			ArrayList iterations = pClass.getIterations();
			
			System.out.println();
			System.out.print(" | Iteration | ");
			System.out.print(" | Instance | ");
			for (int j = 0; j <  pClass.weights.length; j++) {
				System.out.print(" | W " + j + " | ");
			}
			System.out.print(" | Output | ");
			System.out.print(" | Prediction | ");
			
			for (int i = 0; i < iterations.size(); i++) {
				System.out.println();
				System.out.print( " | " + iterations.get(i).iteration + " | ");
				System.out.print( " | " + iterations.get(i).instanceNumber + " | ");
				for (int j = 0; j < pClass.weights.length; j++) {
					System.out.print(" | " + iterations.get(i).weight[j] + " | ");
				}
				System.out.print( " | " + iterations.get(i).output + " | ");
				System.out.print( " | " + iterations.get(i).prediction + " | ");
			}
		}
		
		if(classifier.getClass() == Winnow.class) {
			Winnow wClass = (Winnow)classifier;
			ArrayList iterations = wClass.getIterations();
			
			System.out.println();
			System.out.print(" | Iteration | ");
			System.out.print(" | Instance | "); 
			for (int j = 0; j <  wClass.weights.length; j++) {
				System.out.print(" | W " + j + " | ");
			}
			System.out.print(" | Output | ");
			System.out.print(" | Prediction | ");
			
			for (int i = 0; i < iterations.size(); i++) {
				System.out.println();
				System.out.print( " | " + iterations.get(i).iteration + " | ");
				System.out.print( " | " + iterations.get(i).instanceNumber + " | ");
				for (int j = 0; j < wClass.weights.length; j++) {
					System.out.print(" | " + iterations.get(i).weight[j] + " | ");
				}
				System.out.print( " | " + iterations.get(i).output + " | ");
				System.out.print( " | " + iterations.get(i).prediction + " | ");
			}
		}
		if(classifier.getClass() == BalancedWinnow.class) {
			BalancedWinnow bwClass = (BalancedWinnow)classifier;
			ArrayList iterations = bwClass.getIterations();
			
			System.out.println();
			System.out.print(" | Iteration | ");
			System.out.print(" | Instance | "); 
			for (int j = 0; j <  bwClass.positive_weights.length; j++) {
				System.out.print(" | P_W " + j + " | ");
			}
			for (int j = 0; j <  bwClass.negative_weights.length; j++) {
				System.out.print(" | N_W " + j + " | ");
			}
			System.out.print(" | Output | ");
			System.out.print(" | Prediction | ");
			
			for (int i = 0; i < iterations.size(); i++) {
				System.out.println();
				System.out.print( " | " + iterations.get(i).iteration + " | ");
				System.out.print( " | " + iterations.get(i).instanceNumber + " | ");
				for (int j = 0; j < bwClass.positive_weights.length; j++) {
					System.out.print(" | " + iterations.get(i).positive_weights[j] + " | ");
				}
				for (int j = 0; j < bwClass.negative_weights.length; j++) {
					System.out.print(" | " + iterations.get(i).negative_weights[j] + " | ");
				}
				System.out.print( " | " + iterations.get(i).output + " | ");
				System.out.print( " | " + iterations.get(i).prediction + " | ");
			}
		}
		
	}
}


Thursday, November 17, 2011

Bandung Internship Adventure





Insert title here


Dear readers,

Before I go so far I would like you to guess what kind of tool I use to write this post.
Microsoft Word? No. Libre office Writer? No. Google docs? No. Well, this is eclipse for PHP development. I found it hard to write a post in word processor as I faced some troble in the text formatting. It messed up when I copy-paste it from the word processor.

Friends, my gratitude to Allah SWT as I could have my internship in PT. Telkom Bandung which located in Japati. Not only internship I am finding it nice here, but also a warm welcome from my ex-classmates at senior high school. Friends, you're still, amazing.

In this post I would like tell you, in general, about two worthful experience that I gained here. The first may be a "request" as I have to write down any experience in knowledge sharing activity, the one who share the same sponsorship as me may know what I meant. The second is about life.

It's nice to have internship in PT. Telkom at Japati, Bandung. The professional working atmosphere and friendly workmates are some of the best thing. Then, what are me and my friends doing here? A prototype of enterprise level software project must be delivered. Here I've learnt that the design phase and requirement phase are really important step in software development, especially when we deal with a big scale project..

The second is about gratitude. Friends, I must tell you that we are in a privileged condition. I don't know how to tell this, but, please think deeply when you face our brothers and sisters on the street who are not as lucky as us. You know, when I have a little reunion with my ex-classmates few days ago, I found a man with a very poor condition, not only economically, but also physically. I just can bless a big gratitude for my condition right now after looking such that condition myself.

Thank you for reading.


Monday, October 24, 2011

The Wild Adventure At Gemastik 4 – 2011


Dear readers,

After my exhausting but pleasant and fantastic period, dealing with such master degree proposal, let me spend my time to tell you my experience in Gemastik 4 through this amazing cyber world.

I only one of the Gadjah Mada University – gemastik team squad members. The other
members are our friends in the second year, third year, fourth year and fifth year.
It's an honor for me to lead two brilliant partners in the Data Mining Team, they
are the MSP and the leader of mapres (mahasiswa berprestasi, whatever we call it
in english, I don't care), They are Risqi and (mas) Nasikun. They have enormous
experiences related to competition, public related activities and so on. Moreover,
the thing they've done that I wouldn't forget easily is, the name they gave to our data mining group, Toro Kun. They must pay for that (lmao). The other members of our squad are Theo, Anto, Trias, Ema, and Mona.

Our massive and long struggle starts from, I forgot the date but it's just several
days before the elimination – paper submission deadline (don't try this at home),
the day when I was conducting KKN, a kind of society dedication program. We worked
parallelly. That time I even don't know much about data mining. The easiest way
to deal with such condition is our big search engine Google. The resource we found
told us that we must do such data pre-processing (attribute selection, removing
outliers, replacing missing values), discretization and the last and the main job
of data mining to gain knowledge and do a prediction, what we call classification.
Then I proposed a method to deal with the problem given to the competitor, which
is similar from the method we found while surfing the internet. After that, Mr.Q
gave some better options and opinions which cut the naive method I proposed, of course it's a more brilliant and reasonable method. What we did when the time was very limited, of course using our naive human instinct. Pick the most reasonable one, write the report and submit it to the committee.

Yes, after several moment, out of the blue, the finalist announcement shocked us
by carrying the fact that we pass the final. Well It meant that our struggle must
not stop in elimination stage. They gave us about two weeks to correct out paper
without changing the method. As the commitee told us, we spent our time to make our
paper more beautiful.

It came to the moment when we must send our beautiful repaired paper to the commitee.
It is almost unsent as we just realized that the deadline was at 16:00 o'clock
when it was at 15:00 o'clock that day.

Let's skip some days and go to the time of the final.
We departed from Jogja to Surabaya in October 10th 2011 at 14:00 pm. That was an
amazing travel, as the genset of the train got down in the middle of our
journey. We're still luck that only the air conditioner and secondary purpose
electricity that was off. After the genset had repaired, the staff apologized to
all of the passengers.

After a welcoming dinner at, I forgot the place, we lodged at Mrs.E's house in
the first day, and was planned to do so for the last day. We arrived at night
and went to STIESIA for check in, as it was the place prepared for finalists
lodging.


Briefing and welcome party those were the agenda for the first day. The data
mining finalists must do a lottery to determine the order for the presentation.
Our pleasure to have number 7.

How's the battle? Let me tell you in "Wild Adventure At Gemastik 4 – 2011 part
2".


Thank you very much. See ya.

Wednesday, October 5, 2011

IT Productivity Paradox

Just free my exhaustion from surfing the web, looking for a reference for my assignment: analyzing an example of IT productivity paradox, the cause and solution. Finally found it after 4 hours searching. You may have one, could you please share?

That's all. Thank you for reading. Have a nice day. :D