Matlab - Modelformed.NumNeighbors
Mostrar comentarios más antiguos
What should NumNeighbors be equal to so I can find the correct result? How is NumNeighbors determined?
I tried all the values, but some outputs show correct and then incorrect responses.
I have a Higher Education Students Performance Evaluation Dataset (145rows and 32columns)
opts = delimitedTextImportOptions("NumVariables", 32);
opts.DataLines = [1, Inf];
opts.Delimiter = ",";
opts.VariableNames = ["Q1", "Q2", "Q3", "Q4", "Q5", "Q6","Q7","Q8","Q9","Q10","Q11","Q12","Q13","Q14","Q15","Q16","Q17","Q18","Q19","Q20","Q21","Q22","Q23","Q24","Q25","Q26","Q27","Q28","Q29","Q30","Q31","Output"];
opts.VariableTypes = ["double", "double", "double", "double", "double","double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double" "categorical"];
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
opts = setvaropts(opts, "Output", "EmptyFieldRule", "auto");
DATASET = readtable("HESPENUMERICDATAwithCategory.data", opts);
clear opts
modelformed = fitcknn(DATASET,'Output~Q1+Q2+Q3+Q4+Q5+Q6+Q7+Q8+Q9+Q10+Q11+Q12+Q13+Q14+Q15+Q16+Q17+Q18+Q19+Q20+Q21+Q22+Q23+Q24+Q25+Q26+Q27+Q28+Q29+Q30+Q31');
modelformed.NumNeighbors=31;
a1=input('Enter Student Age: ');
a2=input('Enter Sex: ');
a3=input('Enter Graduated high-school type: ');
a4=input('Enter Scholarship type: ');
a5=input('Enter Additional work: ');
a6=input('Enter Regular artistic or sports activity: ');
a7=input('Enter Do you have a partner: ');
a8=input('Enter Total salary if available: ');
a9=input('Enter Transportation to the university: ');
a10=input('Enter Accommodation type in Cyprus: ');
a11=input('Enter Mother education: ');
a12=input('Enter Father education: ');
a13=input('Enter Number of sisters/brothers (if available): ');
a14=input('Enter Parental status: ');
a15=input('Enter Mother occupation: ');
a16=input('Enter Father occupation: ');
a17=input('Enter Weekly study hours: ');
a18=input('Enter Reading frequency (non-scientific books/journals): ');
a19=input('Enter Reading frequency (scientific books/journals): ');
a20=input('Enter Attendance to the seminars/conferences related to the department: ');
a21=input('Enter Impact of your projects/activities on your success: ');
a22=input('Enter Attendance to classes: ');
a23=input('Enter Preparation to midterm exams 1: ');
a24=input('Enter Preparation to midterm exams 2: ');
a25=input('Enter Taking notes in classes: ');
a26=input('Enter Listening in classes: ');
a27=input('Enter Discussion improves my interest and success in the course: ');
a28=input('Enter Flip-classroom: ');
a29=input('Enter Cumulative grade point average in the last semester (/4.00): ');
a30=input('Enter Expected Cumulative grade point average in the graduation (/4.00): ');
a31=input('Enter Course ID: ');
predict(modelformed,[a1,a1,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31])
4 comentarios
Walter Roberson
el 16 de Dic. de 2022
Are you asking what number of neighbors to use to get 100% prediction accuracy??
Mustafa Furkan SAHIN
el 16 de Dic. de 2022
Walter Roberson
el 16 de Dic. de 2022
As an outside observer (especially one who does not have access to your data), I have no reason to expect that getting 100% accuracy is even possible
Mustafa Furkan SAHIN
el 16 de Dic. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!