简体   繁体   English

在Tensorflow中使用GMM时的Cholesky分解错误

[英]Cholesky decomposition error while using GMM in Tensorflow

I face this strange problem while using GMM in Tensorflow. 我在Tensorflow中使用GMM时遇到了这个奇怪的问题。

InvalidArgumentError (see above for traceback): Cholesky decomposition was not successful. The input might not be valid.

The code I am using shows below. 我正在使用的代码如下所示。

from tensorflow.contrib.factorization.python.ops import gmm as gmm_lib
import random
import numpy as np
import tensorflow as tf

class DataGen:
    start = 0
    batch_size = 100
    end = start + batch_size

    def __init__(self, points):
        self.points = points

    def next_batch(self):
        start = self.start
        end = self.end
        if end <= self.points.shape[0]:
            self.start += self.batch_size
            self.end += self.batch_size
            return tf.constant(self.points[start: end]), None


mu, sigma = 0, 0.1
x_1d = 10*np.random.randn(500, 1).astype('f') + 50
data_gen = DataGen(x_1d)

gmm = gmm_lib.GMM(1,random_seed=0)
gmm.fit(input_fn=data_gen.next_batch)

Any idea to solving this problem? 有解决这个问题的主意吗? Thx. 谢谢。

Even I am facing the same trouble but that is not the case when we use google colaboratory !! 即使我也面临着同样的麻烦,但是当我们使用Google colaboratory时,情况并非如此! You can perform all your experiment in the cloud within an environment alreay setup : [Colaboratory][1] 您可以在环境协议设置下的云中执行所有实验:[协作] [1]

https://colab.research.google.com/notebooks/welcome.ipynb#scrollTo=-Rh3-Vt9Nev9 https://colab.research.google.com/notebooks/welcome.ipynb#scrollTo=-Rh3-Vt9Nev9

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM