フィルターのクリア

kmeans is suddenly behaving differently

3 ビュー (過去 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