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

Diagonal/spherical covariance GMMs have no covariance variable #25

Open
MacDaddio opened this issue Jun 25, 2022 · 1 comment
Open

Diagonal/spherical covariance GMMs have no covariance variable #25

MacDaddio opened this issue Jun 25, 2022 · 1 comment

Comments

@MacDaddio
Copy link

Hello:

The title kind of says it all. The gmm.model_.covariances variable is None for some reason for both of these models. I don't think this was the case in the past so maybe one of the last commits had a bug. Unless this is intentional?

Here is a minal working example:

from pycave.bayes import GaussianMixture
import torch
import numpy as np
import pycave
import random
import time

#Set seed
seed = 0
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
random.seed(seed)

#Inputs
d = 10
k = 1
n = 1000

#Data
x = torch.randn(n,d)

#Fit PyCave GMM
gmm = GaussianMixture(num_components=k,
covariance_type='diag',
init_strategy='kmeans',
trainer_params={'gpus':1,'enable_progress_bar':True, 'logger':True},
covariance_regularization=1e-6)
gmm = gmm.fit(x)

print(type(gmm.model_.covariances))

@pcbua
Copy link

pcbua commented Jan 20, 2025

I have similar problem, my covariances looks like that:
.covariances: tensor([[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan],
[nan, nan, nan, nan, nan, nan, nan, nan]])

Can authors provide example with extracted covariances?

There is problem with accessing related documentation, these links not works:

:(

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

2 participants