SASでPROC fastclusを使用して、クラスごとに単一のセントロイドを計算しました。
proc fastclus data=sample.samples_train mean=knn.clusters
maxc=1 *number of clusters*
maxiter=100;
var &predictors;
by class;
run;
作成されたこれらの重心の最も近いものに基づいて、テスト セットを分類しようとしています。これは、SAS でも PROC discrim を使用して行っています。
proc discrim data=knn.clusters
testdata=sample.samples_test
method=NPAR k=1 metric=identity noclassify;
class class;
var &predictors;
ods output ErrorTestClass=knn.error;
run;
オプションでユークリッド距離測定を使用していますmetric=identity
。
次のエラーが返されます。
ERROR: There are not enough observations to evaluate the pooled covariance matrix in DATA= data set or BY group.
これは、fastproc のクラスター数を 2 に設定すると機能します。
ただし、SAS でクラスごとに単一の重心を持つ 1NN を実行するにはどうすればよいですか?