abidlabs / contrastive

Contrastive PCA
MIT License
199 stars 47 forks source link

Ability to specify the number of PCs to return #3

Closed kieran-mace closed 7 years ago

kieran-mace commented 7 years ago

I'd like to be able to access more than just the first 2 PCs from the projected_data object. Is there a way to specify this?

abidlabs commented 7 years ago

Thanks @kmace we'll be releasing an updated library in the next couple of days that allows that option. Hang tight and I'll shoot you an update.

abidlabs commented 7 years ago

OK, you should be able to do that now:

from contrastive import CPCA

mdl = CPCA(n_components=3) #the top 3 components will be returned
projected_data = mdl.fit_transform(foreground_data, background_data)

You may have to update your package first by running pip install contrastive --upgrade