Hello! I'm working on my dataset, which contains 5955 images of 4 classes
For SMOTE, I tried the following code with input values
function allData_smote = mySMOTE ((5955,4); 5;('2552,227,621,2555'));
The result is an error
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched
delimiters.
Error in barh (line 44)
h = bar(varargin{:});
Error in smote (line 22)
barh(sortedIDX);
Here is the SMOTE code
https://www.mathworks.com/matlabcentral/fileexchange/70315-smote-over-sampling?focused=49932cb1-a438-4224-a262-b9e09a382c4c&tab=function

 채택된 답변

Voss
Voss 2022년 2월 13일

0 개 추천

It looks like you are attempting to use the function mySMOTE() with your data by putting values into the definition of the function mySMOTE(). You shouldn't do that. Instead, restore the function definition to how it was originally:
function allData_smote = mySMOTE(allData, k,sortedIDX)
And then you can use the function mySMOTE() by calling it with your values as input arguments:
% Note: I'm not sure these are what you intended or whether the function
% mySMOTE() will run with these values, but this is how you call a function
your_allData = [5955,4];
your_k = 5;
your_sortedIdx = {'2552','227','621','2555'};
your_result = mySMOTE(your_allData,your_k,your_sortedIdx);

댓글 수: 4

Emma Skye
Emma Skye 2022년 2월 13일
I found it to be really helpful, thanks a bunch!
The answer you gave me worked but I ended up with this error message
Out of memory. The likely cause is an infinite recursion within the program.
Error in mySMOTE (line 5)
your_result = mySMOTE(your_allData,your_k,your_sortedIdx);
I would appreciate it if you could help me again with this .Thanks
Oh, don't call mySMOTE() from within mySMOTE.m.
This part should be somewhere outside mySMOTE.m, like a separate m-file or on the command line:
% Note: I'm not sure these are what you intended or whether the function
% mySMOTE() will run with these values, but this is how you call a function
your_allData = [5955,4];
your_k = 5;
your_sortedIdx = {'2552','227','621','2555'};
your_result = mySMOTE(your_allData,your_k,your_sortedIdx);
Then your mySMOTE.m file will have the definition of the function mySMOTE like this:
function allData_smote = mySMOTE(allData, k,sortedIDX)
% function contents go here, exactly as they were when you downloaded it
end
Emma Skye
Emma Skye 2022년 2월 14일
Thank you for giving me the feedback and for your assistance!
Voss
Voss 2022년 2월 15일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

질문:

2022년 2월 13일

댓글:

2022년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by