Borrar filtros
Borrar filtros

kmeans is suddenly behaving differently

3 visualizaciones (últimos 30 días)
Maximilian Weber
Maximilian Weber el 21 de Jun. de 2017
Comentada: Jan el 22 de Jun. de 2017
Dear Matlab-Community,
just a few days ago I built a skript that required clustering and used the function kmeans(Data,Clusters,Options) and it worked straight away and I got good results with the following settings, analog to a setup from the examples:
opts = statset('Display','final');
[idx1, C1] = kmeans(2,datZ,'Distance','sqeuclidean','Replicates',5,'Options',opts);
Today, if I run the same script I get: Error using kmeans Too many input arguments."
The help for kmeans also returns a different function (?!) now:
kmeans Trains a k means cluster model.
Description
CENTRES = kmeans(CENTRES, DATA, OPTIONS) uses the batch K-means
algorithm to set the centres of a cluster model. The matrix DATA
represents the data which is being clustered, with each row
corresponding to a vector. The sum of squares error function is used.
The point at which a local minimum is achieved is returned as
CENTRES. The error value at that point is returned in OPTIONS(8).
Did the function get updated and change its functionality? Does anyone know what is going on?
If I then try to adapt to the suggestion from the help I get:
Error using kmeans (line 46)
Data dimension does not match dimension of
centres
/Update: This only occurs in R2017a and not in R2016b! kmeans works like expecter kmeans(Data,Clusters,...) like expected. The Bug/Issue is only found in R2017a.

Respuesta aceptada

Jan
Jan el 21 de Jun. de 2017
Editada: Jan el 21 de Jun. de 2017
This means that you have installed the FEX: NETLAB toolbox written by Ian T. Nabney, which contains a kmeans function also. Obviously it was inserted on top of the Matlab path, such that builtin functions are shadowed. You can check this by:
which kmeans -all
  5 comentarios
Maximilian Weber
Maximilian Weber el 22 de Jun. de 2017
Understood! Thank you both for your replies.
The odd thing is: I didn't change anything on the paths and when I started R2017a earlier today everything was fine again. Does Matlab change orders by itself sometimes?
Anyways: I followed your suggestions and moved the correct toolbox up, above the others. So far so good.
Jan
Jan el 22 de Jun. de 2017
@Maximilian: No, Matlab does not modify the path by its own. You could do this temporarily by addpath and as long as the new path is not stored by savepath, teh changes vanish with a restart.
If the pathdef.m file was made writable for users, another user of your machine might have changed the path there. This would be evil and modifying matlabroot\toolbox\local\pathdef.m should be forbidden on multi-user machines.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by