Info

This question is closed. Reopen it to edit or answer.

error in for loop

1 view (last 30 days)
kash
kash on 9 Jan 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
1 Input: Dataset with i continuous attribute, M examples and S target classes;
2 Begin
3 For each continuous attribute Ai
4 Find the maximum dn and the minimum d0 values of Ai;
5 Form a set of all distinct values of A in ascending order;
6 Initialize all possible interval boundaries B with the minimum and maximum
7 Calculate the midpoints of all the adjacent pairs in the set;
8 Set the initial discretization scheme as D: {[d0,dn]}and Globalcacc = 0;
9 Initialize k = 1;
10 For each inner boundary B which is not already in scheme D,
11 Add it into D;
12 Calculate the corresponding cacc value;
13 Pick up the scheme D’ with the highest cacc value;
14 If cacc > Globalcacc or k < S then
15 Replace D with D’;
16 Globalcacc = cacc;
17 k = k + 1;
18 Goto Line 10;
18 Else
19 D= D;
20 End If
21 Output the Discretization scheme D’ with k intervals for continuous attribute Ai;
22 End
i have completed till step 8
i am struck in for loop can u tell how to process please
B is a matrix
for calculating cacc i have posted in my previous post
please help
  8 Comments
Jan
Jan on 9 Jan 2012
@Kash: It would be helpful, if you post a link to the "previous" post.
kash
kash on 10 Jan 2012
http://www.mathworks.in/matlabcentral/answers/25635-error-in-performing-summation

Answers (1)

Daniel Shub
Daniel Shub on 9 Jan 2012
Doing things like:
F=OriginalData
F1=F(:,1);
F2=F(:,2);
F3=F(:,3);
F4=F(:,4);
F5=F(:,5);
F6=F(:,6);
is really ugly and rarely useful in MATLAB. I would suggest reading the getting start section of the manual ( http://www.mathworks.co.uk/help/techdoc/learn_matlab/bqr_2pl.html ) and the FAQ ( http://matlab.wikia.com/wiki/FAQ ). This will be more beneficial to you in the long run.
You should also search this site for the reasons not to use
clear all
at the beginning of your code.
and href=""<http://www.mathworks.co.uk/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup</a>>
  3 Comments
Daniel Shub
Daniel Shub on 9 Jan 2012
I am not IA. I would say the original F is an elegant way to present F instead of F1, F2, ... F6. My guess is I could code for you line 9 and help with cacc, but I am not going to. Spend a little time reading and working through the documentation and FAQs, and I bet this will all become much easier.
kash
kash on 10 Jan 2012
Daniel i tried a lot only ten i seek help from others ,,,,i get only one cacc value for a loop where i should get many values ....this is my project thats the reason posting many question , i seek guide from u in my first project...please guide

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!