필터 지우기
필터 지우기

kmeans is suddenly behaving differently

조회 수: 1 (최근 30일)
Maximilian Weber
Maximilian Weber 2017년 6월 21일
댓글: Jan 2017년 6월 22일
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.

채택된 답변

Jan
Jan 2017년 6월 21일
편집: Jan 2017년 6월 21일
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
Maximilian Weber
Maximilian Weber 2017년 6월 22일
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 2017년 6월 22일
@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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by