Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

I was solving this problem, got answer too. But it seems not correct

1 Ansicht (letzte 30 Tage)
Shaikat Saha
Shaikat Saha am 19 Jun. 2023
Geschlossen: Cris LaPierre am 20 Jun. 2023
1.
Question 1
In the previous Matlab grader problems, we have created our own classifier method based on fitting PCA models to different classes. Now let's try it out on a new dataset!
The humanactivity dataset contains thousands of samples of a known-class, 60 feature dataset. The 'class' is 1 of 5 possible human activities: sitting, walking, dancing, running, and standing. The 'features' are features derived from acceleration measurements from the accelerometer sensor of a smartphone located in the participant's pocket taken during the course of the recorded activity. If interested, you can find more information about this dataset
here
.
Your goal is to create a classifier program that could be run on a smartphone to classify a person's activity from sensor measurements.
Load the humanactivity dataset into MATLAB and divide it into a training and testing set using the following code.
12345
load humact.matD_train = feat(1:2:end,:);class_train = actid(1:2:end);D_test = feat(2:2:end,:);class_test = actid(2:2:end);
Use your my_fitpca function create a classification model with the training set.
Use your classification model with your my_predictpca function to estimate classifications on the testing set
What is your classification accuracy on the testing set (percent correct), accurate to 2 decimal places)?
humact.MAT File
Code used:
load humact.mat
D_train = feat(1:2:end,:);
class_train = actid(1:2:end);
D_test = feat(2:2:end,:);
class_test = actid(2:2:end);
% Train the PCA model using my_fitpca function (assuming you have implemented it)
pca_model = my_fitpca(D_train, class_train);
% Use the PCA model to predict the class labels for the testing set (assuming you have implemented my_predictpca function)
predicted_labels = my_predictpca(pca_model, D_test);
% Calculate the classification accuracy
accuracy = 100 * sum(predicted_labels == class_test) / length(class_test);
accuracy = round(accuracy, 2); % Round to 2 decimal places
accuracy
0 / 1 point
19.59
Incorrect
Percent correct can be found my computing 100 times the total number of cases for which the my_predictpca output equals class_test, divided by the total number of entries (length) of class_test.

Antworten (0)

Diese Frage ist geschlossen.

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by