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

Tuesday, October 4, 2011

A Good (OOP) Practicum Report

It is an honor for me to be one of the OOP/object oriented programming practicum assistant – works at 10:00 am - beside my friend who works at 13:00 pm in the same day.
My great gratitude belongs to my friends – the third year student of electrical engineering and information technology bachelor – my partners in OOP practicum, for all of your efforts and striving to carry this practicum out.
Especially for my friends who are on the third year, I understand the hard strive you undergo to finish that report. It needs a lot of work and time, doesn't it? I felt the same when I made mine, too. Well, I have read some of your first practicum report. My apology, without any means to ignore your hard work, I must say that you really have to make your report better. Don't misunderstand – I found that your work is worth appreciating but there are still more improvements and changes required. This is actually essential when you later do your final task to finish your degree.
To the point, actually I'm not an expert in writing a report or any writing yet, but please note some points that you must follow in writing your report, especially OOP practicum report.
A good OOP practicum report
  • Is an explanation of what you did in practicum, from the objectives, source code, to conclusion.
  • Is written in Bahasa Indonesia with correct grammar (use passive sentence, no equal conjunction as the first part of the sentence, no sentence without subject, etc). You have learned about this in high school, haven't you?
  • Is not a list of steps describing what you have done in practicum only without any proper explanation.
  • Is not a product of Ctrl+A Ctrl+C Ctrl+V feature of your word processor implemented on someone's work. Without any means of distrusting anyone, please mention the reference clearly and cite with a proper format when you cite other 's work. My apology for not telling this before.
  • Consists of Introduction (objective and a little background theory), Analysis, Assignment answers, Conclusion, (the structure as we have told you before), plus Reference. My apology for not telling this before. The first report is condonable.
  • 's conclusion must be in a harmony with the objectives. Please note, a conclusion is not a general fact, however, it is a summary of the result of your practicum
Take some examples
  1. You wrote on your report
    Tujuan : Praktikan diharapkan mampu untuk
      1. Membuat program C#
      2. Meng-compile blah blah and so on
    Your conclusioin is
    Kesimpulan Pada melalui command prompt pada Visual Studio .NET Command Prompt kita dapat menjalankan atau mengeksekusi program. Blah blah and so on
    If Visual studio has a Bahasa Indoensia debugger, it will throw a System.GrammaticalException when debugging your report. Moreover, it doesn't sound in harmony with the objectives. So, instead of writing that way, do this way
    Tujuan : Praktikan diharapkan mampu untuk
    1. Membuat program C#
    2. Meng-compile dan menjalankan blah blah blah
    3. Menggunakan Visual Studio Debugger
    4. Menambahkan Exception Handling ke program C#
    ...
    Kesimpulan:
    1. Program-program pada latihan ini berhasil dibuat dan dieksekusi.
    2. Proses compile berhasil dilaksanakan baik melalui Visual Studio IDE (percobaan pertama, ketiga dan keempat) dan Command Prompt (percobaan kedua).
    3. Pemanfaatan debugger berhasil untuk mengamati nilai suatu variabel saat dieksekusi pada percobaan ketiga.
    4. Pada percobaan keempat error pembagian dengan nol berhasil ditangani dengan try catch statement. Exception yang tertangkap yaitu DivideByZeroException.
  2. You wrote this way on your report
    Pertanyaan blah blah . . .
    1. Apakah fungsi static void main dalam sebuah program blah blah blah... ? Static sebagai pernyataan bahwa metode tersebut berdiri sendiri (mandiri), dan bersifat tetap serta tidak berubah-ubah selama eksekusi program blah blah blah...
    Out of the blue, one of your friend wrote this way Pertanyaan blah blah . . .
    1. Apakah fungsi static void main dalam sebuah program blah blah blah... ? Static sebagai pernyataan bahwa metode tersebut berdiri sendiri (mandiri), dan bersifat tetap serta tidak berubah-ubah selama eksekusi program blah blah blah... No one has identical fingerprint in this world. However, some students in electrical engineering have strong emotional and psychic relation which makes their work can be almost exactly identical. What an amazing phenomenon. Once again, please mention the reference for the purpose of indicating your work's originality.
Please
  • Do not give any code explanation using comments in the source code. Make it in paragraph format.
  • The term Class, Method is not only specific for Console application.
  • Static doesn't mean static in the real semantic, but it means that the member is possessed by the class. You may see that later.
  • “Untuk menyelesaikan permasalahan tersebut maka harus dilakukan penambahan exception handling blah blah”, this is too practical. You can get better score by explaining what is the essence of exception handling and how it can solve the divide by zero problem on the program execution. Please show the essence of the code.
  • You wrote “Aplikasi yang akan dibuat terdiri dari dua jenis yaitu aplikasi berbasis Console dan aplikasi berbasis Windows”. Hang on dude, we didn't build any Windows app in Unit 1.
  • Try to practice on how to use a word processor. There are still some “bugs” like non-capital letter in the beginning of a sentence.
In conclusion, I have read some of your report. Some of you make a good job (but still need improvements) but some others need more improvements. These mistakes are forgivable for your first report. However I will offer a chance to re-make your report for the next units if there is a report below standard. Please make a better report in the next units.

Thank you very much.