hypertools
hypertools copied to clipboard
extend cluster function api
Add the following to hyp.tools.cluster:
Alignflag which aligns data before running clustering algmodelflag to specify dimensionality reduction alg used if ndims is notNonemodel_paramsflag to specify model parameters for dimensionality reduction model
@rarredon any interest? similar to what you helped with during the moz sprint :)
Also: we should add the normalize flag
Sounds good. I should be able to get those implemented this week, maybe even today.
awesome-- thanks @rarredon!
OK, I implemented the new kwargs but I'm getting an error when align=True. It seems kmeans.fit(x) expects x to be a 1 or 2 dimensional array for example, something like,
array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
but tools.align returns a 3 dimensional array; something like
[array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])]
Do you guys have any ideas for how to handle this?
I think you want something like this before passing the data to kmeans.fit:
if type(x) is list:
x = np.vstack(x)
This should work, let me know!