Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using the VFC algorithm for clustering analysis #55

Open
GabrielBaldissera opened this issue Jan 10, 2022 · 3 comments
Open

Error using the VFC algorithm for clustering analysis #55

GabrielBaldissera opened this issue Jan 10, 2022 · 3 comments

Comments

@GabrielBaldissera
Copy link

GabrielBaldissera commented Jan 10, 2022

Hello!

I am trying to use the VFC to obtain clusters. I tried to adapt from the Jupyter notebook but I think I am missing something as I am getting an error.

My code:

G = gt.Graph(mir128_28H, knn=int(top_result['knn']), use_pygsp=True) #Obtain graph with best parameter
G.compute_fourier_basis()
VFC = meld.VertexFrequencyCluster(n_clusters=8, random_state=0)
VFC.fit_transform(G, sample_indicator=mir128_28H.obs['condition'], likelihood=mir128_28H.obs["MT_likelihood"])
VFC_clusters = VFC.predict(n_clusters=8)

My first error is for the VFC object I created:

AttributeError: 'VertexFrequencyCluster' object has no attribute 'random_state'

The second is for the VFC fit transform which I understand could be related to the sample IDs:

TypeError: unsupported operand type(s) for /: 'str' and 'int'

Any suggestions on how to do this?

Thank you for your help!

Best,

Gabriel

@fouerghi
Copy link

fouerghi commented Feb 8, 2022

I am also running into this issue!

@dburkhardt
Copy link
Member

If someone gets this issue again, can you please share the input you're passing to sample_indicator?

@barbareyex
Copy link

Hello!

I am trying to use the VFC to obtain clusters. I tried to adapt from the Jupyter notebook but I think I am missing something as I am getting an error.

My code:

G = gt.Graph(mir128_28H, knn=int(top_result['knn']), use_pygsp=True) #Obtain graph with best parameter
G.compute_fourier_basis()
VFC = meld.VertexFrequencyCluster(n_clusters=8, random_state=0)
VFC.fit_transform(G, sample_indicator=mir128_28H.obs['condition'], likelihood=mir128_28H.obs["MT_likelihood"])
VFC_clusters = VFC.predict(n_clusters=8)

My first error is for the VFC object I created:

AttributeError: 'VertexFrequencyCluster' object has no attribute 'random_state'

The second is for the VFC fit transform which I understand could be related to the sample IDs:

TypeError: unsupported operand type(s) for /: 'str' and 'int'

Any suggestions on how to do this?

Thank you for your help!

Best,

Gabriel

Hi Gabriel,

I also faced the first error and solved it by joining the VFC lines of code as:
VFC = meld.VertexFrequencyCluster(n_clusters=8, random_state=0).fit_transform(G, sample_indicator=mir128_28H.obs['condition'], likelihood=mir128_28H.obs["MT_likelihood"])

The second error appears probably because in the sample_indicator you are including a list of strings. If you have two conditions, you could create another column in adata.obs with 0 values for one condition, and 1 for the others. That would solve the issue I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants