When plotting perceptron dataset using plotpv, the plot doesn't categorize the legends, but just repeats for all target data.

I'm using 2X92 Input data and 1X92 target data and plotting the dataset using plotpv. The target data values are either 0 or 1. The plot generated with different marker for 0 and 1 of target data, but the legends are not set right. Both legends show the same marker for zero.
plotpv(P, T);
legend('A','B');
When I use the following, the system shows all 92 target data as legends. Not the marker type.
legend();
How to fix this to show the legends to show the marker types only?

Risposte (1)

plotpv(X,T) take an RxQ matrix of Q R-element input vectors X and
an SxQ matrix of S-element target vectors T, and plots the columns of
X with markers based on T.
You have 92 columns, so you get 92 lines plotted.
This differs from plot(). When you use plot() and one of X or Y is a vector but the other is a matrix, then the vector will be converted to a column vector, and then the matrix will, if necessary, be transposed so that it has the same number of rows as that column vector has -- after which it will produce one line for each column of the modified array. So in the case of 2 x 92 X and 1 x 92 Y, it would rotate the Y to be 92 x 1 then rotate the X to be 92 x 2, and then would create 2 lines.
... but that is not what plotpv does. plotpv does not do any automatic alignment of vectors and matrices.

1 Commento

Actually the columns are not plotted as lines. They are the target identifiers. Yea plotpv does the assignment internally, and there is no much alterations we can do with that.
Following are the pictures of the plots for further information.

Accedi per commentare.

Categorie

Prodotti

Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by