error in for loop
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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 comentarios
Robert Cumming
el 9 de En. de 2012
show some code to get help.
kash
el 9 de En. de 2012
Robert Cumming
el 9 de En. de 2012
it would have been better to edit your question (and format the code) - also remember that we do not have (or want access) to your spreadsheet. You have still omitted the error message. I personally wont read all that code as I do not know your data - you need to simplify your problem so that it can be repeated in a few lines - doing that you will either solve it yourself or you will be more likely to get help!
kash
el 9 de En. de 2012
Image Analyst
el 9 de En. de 2012
Nor will we go to his separate post to figure out how he got cacc. That's asking a bit much when I'm sure this can be solved with standard debugging techniques, and who better to do that?
kash
el 9 de En. de 2012
Jan
el 9 de En. de 2012
@Kash: It would be helpful, if you post a link to the "previous" post.
kash
el 10 de En. de 2012
Respuestas (1)
Daniel Shub
el 9 de En. de 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.
Finally, please look at: http://www.mathworks.co.uk/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
and href=""<http://www.mathworks.co.uk/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup</a>>
3 comentarios
kash
el 9 de En. de 2012
Daniel Shub
el 9 de En. de 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
el 10 de En. de 2012
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!