Trying to train a k-means clustering algorithm

2 ビュー (過去 30 日間)
Josh Hershman
Josh Hershman 2018 年 4 月 2 日
コメント済み: Josh Hershman 2018 年 4 月 3 日
Hello, I'm trying to follow this example to training a k-means clustering algorithm for a data set of my own. My attached data file is a 73x2 double. I am running into trouble with these specific lines in the example:
x1 = min(X(:,1)):0.01:max(X(:,1));
x2 = min(X(:,2)):0.01:max(X(:,2));
[x1G,x2G] = meshgrid(x1,x2);
XGrid = [x1G(:),x2G(:)]; % Defines a fine grid on the plot
Specifically, I keep getting errors that the arrays I am trying to create exceed the maximum array size preference. I'm not really sure how to manipulate the arguments for x1 and x2 such that they properly fit my data and don't give extremely large matrices. The meshgrid command especially is giving me trouble, as I get the error : Error using repmat Requested 536389556x21511164 (85967508.8GB) array exceeds maximum array size preference.
Any help would be greatly appreciated!

採用された回答

Von Duesenberg
Von Duesenberg 2018 年 4 月 2 日
編集済み: Von Duesenberg 2018 年 4 月 3 日
Your numbers are much much bigger than those of the original example. So you should increase the step size between your min and max value before you create the grid. For example:
x1 = min(X(:,1)):10e7:max(X(:,1));
x2 = min(X(:,2)):10e7:max(X(:,2));
  1 件のコメント
Josh Hershman
Josh Hershman 2018 年 4 月 3 日
Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by