flucoma/flucoma-sc

PCA of 0 `fitTransform` returns DataSet with 1 column

Closed this issue · 3 comments

Perhaps I'm misremembering. I thought that setting numDimesions in PCA to 0 caused it to return all the PCs? In this dummy example (extracted and simplified from other code) it's returning a DataSet with 1 dimension.

setting PCA's numDimensions to 1 also returns a DataSet of 1 dimension
setting PCA's numDimensions to 2 returns a DataSet of 2 dimensions

~ds = FluidDataSet(s);
~pca = FluidPCA(s,0);

(
~cols = 10;
~data = Dictionary();
100.do{
	arg i;
	~data["point-%".format(i)] = Array.fill(~cols,{rrand(0.0,1.0)});
};
~dict = Dictionary.newFrom([
	"cols",~cols,
	"data",~data
]);
~ds.load(~dict);
)

~pca.fitTransform(~ds,~ds);

~ds.print;

You are misremembering. But it's not a bad idea.

and interface wise we could put -1 or 0 - for kdtree 0 is all indeed but I think all other objects have -1 as dummy-value-as-default

(Although I'm still very much of the opinion that both these things should revert to being message arguments as soon as we have a way of expressing defaults).