필터 지우기
필터 지우기

Testing trained classifier model with new data

조회 수: 2 (최근 30일)
PL
PL 2017년 11월 20일
답변: Mrutyunjaya Hiremath 2020년 4월 12일
Hi everyone,
I've trained a classifier model based on some audio data, using the simple tree algorithm. I extracted 19 features in total from the audio data. The predicted accuracy is 100%, which seems to mainly rely on one extracted feature-peak2rms. After I have exported the trained model, I would like to test it with a set of some new data- I would assume that the features I need to extract from the new data are only those that were used in the final model (most of them were removed while experimenting with the classifier, after realising they don't have any significant effect on the accuracy). However, I have written the below to extract the relevant features from the new data:
sample=miraudio(audio);
T=table(mirgetdata(mirrms(sample)),mirgetdata(mirrolloff(sample)),mirgetdata(mirkey(sample)),mirgetdata(mircentroid(sample)),mirgetdata(mirregularity(sample)),mirgetdata(mirtempo(sample)),mirgetdata(mireventdensity(sample)),mirgetdata(mirkurtosis(sample)),mirgetdata(mirspread(sample)),peak2rms(sample));
a=table2array(T);
decision=trainedModel.predictFcn(a);
I keep getting the following error:
Undefined function 'abs' for input arguments of type 'miraudio'.
Error in peak2rms (line 28)
num = max(abs(x));
Error in testing (line 2)
T=table(mirgetdata(mirrms(sample)),mirgetdata(mirrolloff(sample)),mirgetdata(mirkey(sample)),mirgetdata(mircentroid(sample)),mirgetdata(mirregularity(sample)),mirgetdata(mirtempo(sample)),mirgetdata(mireventdensity(sample)),mirgetdata(mirkurtosis(sample)),mirgetdata(mirspread(sample)),peak2rms(sample));
>>
I can't seem to figure out the problem with the feature, as I am successfully able to extract this feature separately from any audio data.
Any ideas why I'm running into this problem? Any help would be much appreciated!

답변 (1개)

Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020년 4월 12일
sample=miraudio(audio);
will give 'miraudio object'. its NOT an array.
'peak2rms' builtin function of matlab will give an error. It expects an array.
Use:
peak2rms(mirgetdata(sample));

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by