Archives

Basic Neural Network Classification using MATLAB: Graphical User Interfaces

After training the nets with mean value of all attributes and it showed 97.2% correctness, now I will perform the GUI one 😀 because  it is a lot better than before in graphics, of course. Well, the pre-processing steps are similar to previous one, all you need is just preparing the data, install them into your workspace, and transpose it. But please notice that this experiment will use standard error value and worst value of each field. So, the class attributes are exactly same with the previous, but the atts attributes are not same, you have to copy the next ten attributes to have it.

Firstly, activate Neural Network Fitting Tool by this script and then a window immediately pop-out to your screen (yay!)
>> nftool

Nftool interface

Nftool interface

The first page of GUI just consists of brief explanation about NNF Tool. Similar with variable formats and targets used in Command Prompt, this GUI also use exactly same rule to define variables. Please prepare your variables before doing classification in MATLAB workspace to ease the next process. Click Next Button.

Installing Variable

Installing Variable

After installing variable

If you get the warning sign, it indicates that you haven’t transposed your variables. Please transpose it before doing the next step. Click Next Button.

Validation data window

Validation data window

This step is skipped from Command Prompt, but actually this step is adjustable by users. By default, the proportion between Training, Validation and Testing is 70:15:15. In other references suggest different scale, for example: 80:0:20, 60:30:10 or 90:0:10. The existence of validation part is negotiable, thus, in several books, it might be eliminated.

The bigger portion of training data might yield the perfect classifier rule but it also increases the probability of having over-fitting model which will cause low performance. In contrast, the lower part of training data can cause under-fitting model which means that model doesn’t cover enough the requirements through fewer given samples. The error value of under-fitting is usually worse than over-fitting’s error value. In order to make it apple-to-apple comparison with previous one, let it be the default one. Click Next Button.

Network Architecture

Network Architecture

Congratulations! you don’t have to type anything in command window to view your network architecture now. Input your preferable hidden neurons which are contained in hidden layer. 20 is the default value. In order to make it apple-to-apple comparison with previous one, let it be the default one. Click Next Button.

Before training

Before training

After training

After training

To perform training in built neural networks, click Train Button. The results will be displayed in top-right container. After training phase, MSE and R value will be fulfilled according to each data portion. Click Next Button.

Evaluate Network

Evaluate Network

This interface provides opportunities to re-train network if the result has not been satisfying yet. Re-train can be performed by adjusting network size or import another large dataset. Moreover, it can also perform another test with additional dataset test. Click Next Button.

Saving Result

Saving Result

This graphic makes a big difference in operability of data saving. It also helps users to generate M-File to operate the created Neural Network architecture in other occasions and needs. Click Finish Button after Click Save Results Button.

Then in your workspace will be like this

Workspace after

Workspace after

Let’s do the confusion matrix, but, do not forget that the output have not transformed into binary digit yet, we still have to round and plot confusion manually 😀
>> output = round(output)
>> plotconfusion(class2, output)

I bet that my result is worse than previous one. It caused by the performance value is highly different. The first one was 0.0151, meanwhile, this one is 0.4 😀 Here is my confusion matrix.

Confusion Matrix 2

Confusion Matrix 2

Huwaaa, my correctness decrease from 97.2% to 92.1% hahaha.. its okay, it means that the standard error has a worse classifier to predict compared to mean value. Lets compare with the worst value one..

Confusion Matrix Worst Value

Confusion Matrix Worst ValueTraining MSE

Training MSE

Wow, I have 98.8% accuracy through Neural Nets 😀 Well, it can be concluded that the worst value or the highest value have the best performance to predict cancer than mean and standard error value 🙂

Let’s try with another tool and classifier at the next trial 🙂

Basic Neural Network Classification using MATLAB: Command Prompt

This post will explain you step by step process to classify data according to its classes using command prompt in MATLAB. This is only one way to classify with MATLAB, you absolutely can find another ways 🙂 In general, classification processes need three main steps which are pre-process, main process and post-process. Pre-processing steps contain data attribute selection, cleansing and converting steps, mean while the post-processing steps contain data denormalization and interpretation.

This classification process use data stored in UCI Machine Learning Repository which is widely used in Data Mining field.

  • Pre-processing steps
    Download Breast Cancer Wisconsin dataset and scrutinize how many the attributes are and which one is the class attribute through the site. It can be seen that it has 32 attributes which the first two attributes show patient ID and diagnose result (M=Malignant and B=Benign). Save it as .csv file and open it through spreadsheet. From this first step we can clearly eliminate the patient ID because it is the key identifier of each instance, therefore, it will not be repeated and can not be taken as one of decision makers’ attributes.To convert the class attribute, you have two ways. The first option, convert M and B into binary digit which fills two columns. First column indicate the M, thus, you have to fill it with ‘1’ if it is Malignant Cancer and the second column indicate the B which will be filled by ‘1’ if it is categorized as Benign Cancer . So, you will have a spreadsheet file which have two columns and 569 rows which only contain 0 and 1 like this picture.

    Binary Matrix

    Binary Matrix

    Or the second option, you can assign M as ‘1’ or B as’2′. If you choose this way, you will only have one column which consists of 1 and 2 with 569 rows.

    Class Encoding

    Class Encoding

    From data.names you can obtain information about dataset attributes. It only consists of 10 attributes, but why there are 30 attributes. It has three values of each attributes which are mean, standard error and the worst value. So, you don’t have to use those all to predict the cancer. In order to have some challenges experiments this post will compare three data and select the best measurement to predict cancer.

    After eliminating and converting the raw data, we ready to the main process. Prepare your 10 data attributes (mean or standard error or worst one) and your binary code.

  • Main Process
    Install the data into MATLAB workspace by creating two new variables and fill it with your data preparation. I will give the attribute variable with ‘atts’ and the variable which contain binary digit as ‘class’. Then, your workspace will look like this.

    Workspace

    Workspace

    You had better to transpose it first, because in newff it requires the output number not as records. Please type this syntax in your command window to transpose those variables.
    >> atts = atts’
    >> class = class’

    if you notice, the small apostrophe (‘) will transpose it immediately and you can see the Value dimension of those two attributes will change from <569×10 double> to <10×569 double>.

    You can see what the requirements are to create the new feed-forward network through
    >> help newff

    Please define which one is the inputs, targets and hidden neurons (X) in breast cancer data.
    >> net = newff(atts, class, 20)

    If you succeed to create the network, the workspace will be like this

    Workspace after creating network

    Workspace after creating network

    To view the neural network architecture can be obtained by stating the following code and the following figure shows an example of neural network model.
    >> view(net)

    Snap107

    The following step after creating the architecture of neural network is doing training session. The training session matches measurements that each individual has with their classes (Benign, Malignant).
    >> net = train(net, atts, class)

    After calling the ‘train’ function, there will be an interface as shown below, please wait a moment until it reaches the optimum condition. Note that each computing can have different iteration numbers (epochs) because it started with random value which may cause different way of processing. My suggestion, please training until Validation Checks is not 6 as its maximum value or choose the lowest Performance indicator (performance was measured by MSE then the lower the value, the best the result will be).

    Before re-train

    Before re-train

    After re-train

    After re-train
    • Epoch: filling by number of how much iteration actually did for achieving the optimum result. Usually it has maximum iterations for determining the time, accuracy and resources which obviously be needed. Why should we have maximum iterations? As regards of one method belong to heuristic solutions, it will be taking much time and efforts to find the perfect answer of a problem. Due to the complexity and attributes numbers which is not only one or two but may be hundreds, heuristics solution (e.g. neural networks) have fair ways to achieve a good answer but only need few time and resources. It will be looping all day if we do not specify how much maximum iterations allowed. This constraint is well-known as stopping rules or stopping criteria.
    • Performance: usually this field filled by error measurement (e.g. MSE, SSE, RMSE, PE) to judge the perfectness of a training session. Starting from 3.29 at the first iteration, it can be revised up to 0.0273 at ninth iteration in training session. Besides the aforementioned stopping rule, maximum iterations, minimum improvements also works as another stopping rule. In case that the revising process worked not optimally by reducing almost zero improvement. The measurement related to training algorithm used.

      Performance Bar

      Performance Bar

    • Gradient: during training session, besides measuring performance and iteration number, it also checks gradient decency. The bigger its value, the larger adjustment of weights and biases it performed which means that it has bigger improvement to do. Admittedly, at the first iteration it would have 1 as gradient because they are random numbers and iteration will be ended if the gradient less than 1e-10. You can adjust this parameter through net.trainParam.min_grad.

      Gradient Bar

      Gradient Bar

    • Validation checks: the number showed in this field represents the number of iteration that did successfully. If this number showed 6 which is the default value, the training will be ending. In this run, you can see that the training did stop because of the number of validation checks. You can change this criterion by setting the parameter net.trainParam.max_fail.

    The next process after training is obtaining the result by filling a variable with simulation result through this following command.
    >> output = sim(net, atts)

  • Post-process
    The output that have been produced by the code above is varied between -m to +n, however, the result that will be needed to classify is binary digit just as its inputs. Thus, this output result should be converted to 0 and 1 through post processing activity. To make this come true, round function is performed to convert those numbers to the nearest integer.>> output = round(output)To see how good the percentage of instance data that perfectly classified and misclassified, please check it through value of confusion matrix below.
    >> [misclassified, confmats] = confusion(output, class)This is mine, how about yours? 😉 I misclassified 2.8% of the total instances 😦

    Percentage of misclassification

    Percentage of misclassification

    If you need more visualization, you can have the ‘real’ confusion matrix by doing this
    >> plotconfusion(class, output)

    Confusion Matrix

    Confusion Matrix

    There must be an explanation about how to read it, so here they are the explanation

    • Vertical and Horizontal Columns represent each class which Class 1 Malignant and Class 2 Benign.
    • Diagonal cells are correctly classified instances. It should be perfect if it listed 212 and 357 because the raw data contain of 212 Malignant and 357 Benign instances.
    • Vertical Columns read from bottom to top, let see the second vertical column which has twelve instances that are misclassified (the red ones). It means there is twelve instances of Malignant that was misclassified as Benign by the classifier. In addition, there are 4 Benign instances were disguised as Malignant.
    • Therefore, in the most bottom-left cell (the blue one) was not listed as 100% instead 97.2%. This value was counted by misclassified instances compare to the whole instances.

Well, this experiments have not  been done yet. Be patient, I will do it soon by GUI experiments 😉 I guess you will like the GUI more than command prompt, but for me personally, I prefer this one.

The easiness of dashboards reading ;)

Wow, I just clicked summaries in 30 last days in my blog’s dashboard then it showed this summary. It is one of the advantages of using dashboards, easy and understandable 🙂 but I guess the nuclear engine is not that simple :p

The whole nations of my blog's readers..

The whole nations of my blog’s readers..

 

 

 

 

 

 

 

I have to write many more things in English and stick it to my head that the purpose of my life in this earth must be cleared. It is for the sake of the world not only one or two countries. Just like my lovely prophet Muhammad SAW that enlighten the whole world to date and not limited to Arab only 🙂

Should we sell our faith for our dreams?

Bunch of essay tasks that should I fill to complete my scholarship application made me think carefully towards my dream in the future. Most of them ask me to write the reason why should I back to my country or what will I do after I graduated from my PhD. Well, I have no difficulties to make it up, and then I end up buying a motivational book to achieve our scholarships including how to make convincing essays from the successful ex-awardees.

I got a lot of examples, but then it suggested me to be the one that I don’t want to be or write that I don’t want to write. For example, it suggested me to write a ‘Professor’ to be my dream because the Host University really want that answer or I should answer NO questions that related to taking advantage another scholarship even though I am looking for or applying another scholarships. In my opinion, those are stupid questions that must be answered by stupid answers. Well, everyone knows that they shouldn’t put eggs in only one basket; of course they are trying to apply another scholarship. In addition, why should I become a Professor someday? I have no reason right now. That is not my dream and I am not going to write it in all of my essays or my interview answers. Why should I lie to myself then just for financial supports?

Last night I watched one Grey’s Anatomy episode (again), there is a patient that belongs to Jehovah’s Witnesses. Suddenly, the doctor (Yang) stopped blood transfusion into him and warned others not to give him any kind of bloods. Admittedly, she got protest from other nurses and doctors because without blood support he is going to die. Saving lives is their motto. She didn’t explain to other paramedics but then I pushed the ‘Pause’ button and start googling what is the Jehovah’s Witnesses.

According to my reliable sources in internet, Jehovah’s Witnesses reject any kind of military services and blood transfusion whatever the condition. They believe that live only granted by God, if God still gave him a live then he wouldn’t die with or without blood transfusion. Without judging their reasons which are make sense to me, I just remind what the Rasulullah SAW and his fellows did in the past, he wouldn’t surrender to say that the only God is Allah even though his enemies tortured them. Well, maybe it doesn’t happen anymore in this era, it could be easier or even harder condition that we shouldn’t die to sell our faith. It is easier because we shouldn’t suffer for physical torturing but it is harder because it is less easy to distinguish or judge. Well, for me personally, the hardest decision is when we have a pleasant or enjoyable situation.

May be some of you think that, ‘Oh come on, it is just blood money, it doesn’t change your whole life, you can still have those money and live your life after you receive that money’. Some others named it ‘White Lie’, but unfortunately they forgot to erase the ‘Lie’ word after ‘White’. Yes it is true, I will abroad and graduate my PhD after I said that I want to become a Professor and back to my country because of my previous make-up reasons and data in my essays. Yes it is true and then I have no differences with the corruptors who steal money from citizens’ tax just for themselves and said that it is for the country needs.

I just want to be a mom and a teacher who spend my time only for my children and students. Hmm, it sounds selfish but being a Professor only steal my whole time and my focus to teach and educate them. Will I get that scholarship if I just write those two reasons in my essay? Let us see then. I am sure that God wrote a perfect plan for me and my family in the future and all I have to do is just do my best and pray 🙂

Dad, I am more like you now 🙂

The required documents for PhD requirements..

At the first time I applied PhD programme, I got confused which one I should apply first, the scholarship or the offer/acceptance letter from the University? Actually, you can do both in the same time. But in my opinion, if I were the owner of scholarship foundation, I wouldn’t give my scholarship to person who doesn’t have any eligible proof to make me sure that he/she will going to take a higher study. Well, you can think conversely, once I had an email reply from Professor XX in Univ YY, he required a financial letter to prove my funding at the first we chatted, even though I haven’t submit any application yet in his University. That time, I couldn’t give him any letters yet, so he dumped me *sad*.

That’s why, you can do that in both ways, never give any limitations to yourself. Here they are the documents that will be required through your PhD applications process. Good Luck!

– English translation of your undergraduate and master certificates and transcripts (mandatory)
Please go to the accredited translators to have those eligible translations or you can go to university that issue your academic certificates. In my experience, it took about 3-4 weeks and it can be requested whenever you want. So, I suggest you to have those translations long time before your PhD application due date.

– Referee Letters or Recommendation Letters (mandatory – one is from your master’s supervisor)
Again, never burn the bridges. You should maintain your good relationships with your previous supervisors, both in undergraduate and master degree, because you will never know that they are the most valuable persons in your next education. Please make sure that your supervisors are IT literate, most of good universities will send an email directly to your supervisors and they will be asked to log into their application systems with provided username and password. So, your physical recommendation letters sometimes are no longer required.

– Cover letter (mandatory)
This letter is your first gun. By reading this letter, the proposed professor will have the first impression of you, whether you are just an ordinary applicant or you are the one that they looking for. So, sometimes you need to revise it several times to have the feeling. FYI, the professor is not always available, most of them are really busy with their publications and teaching agenda, moreover it is not only you who sent them offer letter, may be there are hundreds emails in their inbox. That’s why you should catch their attention begin from the email subject. Don’t have a hard feeling if they don’t reply you yet or they ask someone else (secretary) to reply your email. I’ve sent around 50 cover letters before I got my offer letter.

– Curriculum Vitae (mandatory)
There are bunch of websites which provide tutorials about how to make your CV alive *not literally alive*. It has to be concise, detail and simple. Attach your newest and formal photograph in your CV, in case they have abnormal personalities (racism or hate specific religion), they can decide it by the time they look at your CV. My friend suggested me to put my marital status too, may be it also works.

– Personal Statement (mandatory)
This is similar to CV but you have to explain it in paragraphs, please do not write the same things as you wrote in your CV. It needs special skills to make your personal statement speaks ‘more’ than your CV, I don’t think that I can write my personal statement perfectly too, but please ask someone expert to check your sentence, grammar and logical order. You can also find many dos and don’ts in writing personal statement in Google 🙂

– Passport (optional)
As your plan to going abroad, it certainly require an ID proof that is internationally recognized which is Passport. Please obtain your passport as soon as possible 🙂 In some cases they require the passport number and expiry date of your passport, furthermore they ask you to enclose scan image of your passport.

– English proficiency test certificate (optional)
I noted it as an optional requirement, yes it is true, you can still be accepted even you haven’t uploaded your IELTS yet. But, once again, if you are trying to pursue PhD abroad, it is mandatory to have English proficiency test certificate 🙂 at least if your score is below than their minimum requirement, they will ask you to attend English course there based on your score which is not free, of course. If your test score has not been published yet, they will require your TFN number (IELTS).

– Research Proposal (optional)
Emm, well it took a long time for me to decide whether it is mandatory or optional, because usually in my offer letter I prefer attaching CV and Research Proposal. Well, research proposal can help you to find professor that really match with your research preference, but I decided to make it as an optional requirement because in my friend experience, her professor didn’t ask about her research proposal and she has been accepted. But, it is better to you if you already made your research proposal before applying or sending offer letters to professors.

– List of Publications (International preferred)
This is a valid evidence that show your capability of writing publications. Preferable the international publication either in conference or journal. If you already published books, it would be more than better.

– Field of Study (optional)
While Research Proposal tells about the next research you want to do, the field of study consist about the summary of your undergraduate and master theses. May be they want to know the quality of your previous final projects to help them decide whether you are eligible or not.

– Funding Information (optional)
I haven’t this document, so I can’t write much about this 🙂 Later, I will show you once I get it.

– Award Certificates (optional)
Many of universities require distinction degree, previously I didn’t really get what it means. But, several professors call it ‘Cum Laude’ degree, they will be delighted if you can show your distinction or any award certificates you have.

I hope this list can help you to prepare your PhD study 🙂 Keep it in your mind that all documents must be written in English. Best wishes for you!

Why should I take a higher education?

This question has been questioned to every woman when they decided to take a higher education of herself. Why did you take a master degree? I simply said that I want to be a lecturer of undergraduate students. Everyone will stop asking me that annoying question.

But now, that similar question came once more, why should you take doctoral degree? you still can teach your student with your master degree. Well, they are not entirely wrong, I have no further career obsession, for example a professor. Being a professor is the last thing I will consider in my life. For being a mom? every woman will be a mom for their children, they must not take a PhD study to be a mom, right?

Why should I?

Let’s us list the disadvantages of taking PhD study, as they said to me..
– Getting far away from my families
– Spend more money
– Spend more emotional feeling
– Spend more time
– No guarantee to be successful in further life

So, why should I? I have no specific reason to take it. People may judge me as a hilarious girl who dreamed to high, question and make jokes with my teaching method in my class. All of they done will just boost my energy more than ever, to be greater than before ^_^V

As I know they didn’t expect any of your answers, they are questioning not truly asking and having a good discussion with you. So, you don’t have to explain your answer to them just like an Apple Founder said “Stay Hungry, Stay Foolish”.

P.S. Anyway, thank you for boosting my energy 🙂

How to read the unreadable papers?

Reading papers could be triggered by a certain purpose, your purpose will affect to how they should read, in order to optimize your time and energy. There are some tips from me, when you catch up with a lot of papers, of course with the variance of purposes.

  • First of all, please make sure that you downloaded from an eligible journal sources repository, in my major (engineering) it could be Science Direct, Springer Link, IEEE or ACM. A white paper, which contains no headings on top of the paper, may become your reference, but it indicates that the paper has not published yet in anywhere. I don’t mean that it is a bad paper; it could be a good one, yet no journal/conference as a judgmental party to make sure about its eligibility.
  • One of the novelty judgments can be found by the time it published, furthermore usually you can see it on the top of paper. FYI, it needs almost 5 months-1.5 years to submit in a good international journal, so if that is listed on 2010, we may conclude that the research was conducted about 2008-2009. Some of resources said that the papers should be taken within 5 years from now, even though it means that you already late about 6-7 years from now.
  • Please be careful with ‘article in press‘ notation, it could be meaning anything. In addition, you can found the explanation below:

Articles in Press (articles that have been accepted for publication but which have not been formally published and will not yet have the complete volume/issue/page information) that include errors, or are discovered to be accidental duplicates of other published article(s), or are determined to violate our journal publishing ethics guidelines in the view of the editors, may be “Withdrawn” from Science Direct.

  • Please note it to your mind, that paper is just tenths of the hundreds pages of person’s research, it’s quite short if you compare to the real research that have been done by the authors. It’s obvious that they do not write fully explanation on it, you should learn it by yourself through other papers/books.
  • Besides I have mentioned above, there is another evidence to judge the paper eligibility. The Reference List is talk more than the references they have been used. The longer it is, the more comprehensive their experiments.

Okey, here they are my suggestions to you, according to your first purpose that lead you drown into papers.

 – Looking for an idea to your undergraduate/graduate thesis

Firstly, read the title, is it suitable with your interest? If you think so, please continue to the keywords (below the abstracts). The keywords are the paper’s title contractions, so if you are not really sure about the title you can look to these three musketeers words.

After you read the keywords, please read all the abstracts, for minimizing your time and effort to understand all of the paper’s contents. The good abstracts usually consist of three parts in one paragraph, separated by dots: Research’s position between the others similar research; Methods and tests that have been done; Results of their experiments. So, if you have read the abstract’s sentences one by one, you definitely read all the important features of that paper. Although, it is hard to understand what the authors mean, isn’t it?

The most valuable part to look for a new idea took place on the end of the paper, before the references list of course. It is a conclusion chapter; usually in the last paragraph of it, the authors will reveal a little secret about their future research/discussion or the possibility of another method that could be works. Not all the papers contain these clues, as not all the authors are generous enough to write it. If you found this one, please keep it carefully, in case you may need it later.

From this part hopefully you can find your idea to do your research, I think it would be better if you take a step twice faster because not only you that have read that papers.

– As a reference (Introductory part)

For adding eligibility to your writings in thesis, research reports or papers, usually they will look for another similar research to strengthen their position, as it quite impossible that you conduct your research without any previous experiments done by others before. In your introduction part, it should be written all of your references that have been read by you. The thicker your introduction part, the more previous supporting references you have understood.

Please go to the last part; yes it is the reference list of your candidate reference paper, please tick the most suitable paper titles, and please remember the name or the number of them. Look for it in the second, third or fourth paragraph (after introduction heading), what did it state or explain? If you find something useful, you can quote it to your research, but it is better if you download the ticked references and read it thoroughly by yourself. Yeah, as long as it written by human not by God, it possibly contain any error or digression perception.

– As a reference (Literature Review part)

Well, I don’t suggest you to look for a paper to meet this need, because books are always the best reference for literature review part for your studies. Books are more complete and comprehensive than papers, but if you insist, I will show you where the place to gain this information.

Instead of the introduction part, it’s better to look thoroughly in second, third and fourth paragraph. For a quick look, you can observe the experiments results, in order to choose the best method’s performance. Charts and tables will improve your reading skill without read all of those painful sentences and formulas.

It’s your lucky day, if you find the flowchart to guide how the method’s work, because it’s rarely happened in paper. They prefer writing it at a glance to explaining them in details, because of their maximum pages rule that they must obey.

Well, with these tips hopefully you will optimize your eyes, time and energy to read a paper, you shouldn’t read whole of them. In my case, it will work on Engineering Articles, because I haven’t read and drown into the sociology or history journal. It may be different with my tips.

Good Day everybody!