Reputation: 2171
I was learning how to do machine learning on mldata.org and I was watching a video on Youtube on how to use the data (https://www.youtube.com/watch?v=zY0UhXPy8fM) (2:50). Using the same data, I tried to follow exactly what he did and create a scatterplot of the dataset. However when he used the scatterplot command, it worked perfectly on his side, but I cannot do it on myside.
Can anyone explain what's wrong and what I should do?
octave:2> load banana_data.octave
octave:3> pkg load communications
octave:4> whos
Variables in the current scope:
Attr Name Size Bytes Class
==== ==== ==== ===== =====
data 2x5300 84800 double
label 1x5300 42400 double
Total is 15900 elements using 127200 bytes
octave:5> scatterplot(data, label)
error: scatterplot: real X must be a vector or a 2-column matrix
error: called from:
error: /home/anthony/octave/communications-1.2.0/scatterplot.m at line 69, column 7
Upvotes: 0
Views: 790
Reputation: 2509
The error message says it all. Your data
is a 2-row matrix
, and not a 2-column matrix
as it should be. Just transpose it with .'
.
scatterplot(data.')
I dropped the label
argument since it is not compatible with the communications
toolbox, either in matlab or in octave.
Update:
According to news('communications')
,
The plotting functions
eyediagram' and
scatterplot' have improved Matlab compatibility
This may be why the behaviour is different. Be ready to find other glitches, as the octave 3.2.4 used in this course is about 5 years old.
In order to use the label
, you should rather use the standard octave scatter
function.
Colors could be changed by choosing another colormap
.
colormap(cool(256))
scatter(data(1,:), data(2,:), 6, label, "filled")
Upvotes: 1