How to solve a task within Machine Learning Onramp Course?
조회 수: 25 (최근 30일)
이전 댓글 표시
Hello everyone
I hope to get help regarding the following inquiry:
I am doing the Machine Learning Onramp Course. Currently I am in the section: Engineering Features Automate Feature Extraction (Create a Feature Extraction Function).
I am following the next instruction to complete the task:
load sampleletters.mat
letter = b1;
aratio = range(letter.Y)/range(letter.X)
idxmin = islocalmin(letter.X,"MinProminence",0.1);
numXmin = nnz(idxmin)
idxmax = islocalmax(letter.Y,"MinProminence",0.1);
numYmax = nnz(idxmax)
dT = diff(letter.Time);
dXdT = diff(letter.X)./dT;
dYdT = diff(letter.Y)./dT;
avgdX = mean(dXdT,"omitnan")
avgdY = mean(dYdT,"omitnan")
corrXY = corr(letter.X,letter.Y,"rows","complete")
featurenames = ["AspectRatio","NumMinX","NumMaxY","AvgU","AvgV","CorrXY"];
Task 1
Make a table from the features stored in the variables aratio, numXmin, numYmax, avgdX, avgdY, and corrXY by using the table function. Store the result in a variable named feat.
feat = table(aratio,numXmin,numYmax,avgdX,avgdY,corrXY,'VariableNames',featurenames)
Task 2
Recreate the table of features feat, but with the table variable names from the array featurenames.
feat = table(aratio,numXmin,numYmax,avgdX,avgdY,corrXY,'VariableNames',featurenames)
Task 3
At the end of the script, add a local function named extract that takes a single variable, letter, as input and returns a table of features, feat, as output. Copy the code from the beginning of the script, from after letter = b1 to Task 1, and from Task 2 to make the body of the function. Test your function by calling it with b2 as input. Store the result in a variable named featB2.
featB2 = extract(b2)
I got the error
Not enough input arguments.
I will really appreciate your cooperation.
댓글 수: 0
채택된 답변
Walter Roberson
2024년 11월 2일 21:37
You did not add a local function named extract to your file. A "local function" is one that is placed at the end of your code, starting with the keyword function . (In most cases, you also need an end statement corresponding to the function keyword)
With you not having added a local function named extract to your code, your code was accidentally invoking the MATLAB extract function.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Project File Management에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!