如何随机保留训练样本X%的标记(label)。

我正在尝试在MNIST数据集上复现一个机器学习的项目https://github.com/hdcouture/TOCCA。用的是python, tensorflow 1.13.1 and Keras 2.2.4. 结果报错Self-adjoint eigen decomposition was not successful. The input might not be valid. 我猜可能是因为code里有一个TODO: 

if semi is not None:
    # TODO: semi-supervised: randomly retain only X% of labels on training set

 随机保留训练样本 X%的标记(label)。

请问该怎么实现?或者对这个报错你们有什么想法嘛

救救孩子吧 

没太明白你的意思,是要做数据分割的话可以用调用 
from sklearn.model_selection import train_test_split 这个函数 参数 test_size 可以设置切割的百分比

from keras.datasets import mnist
import numpy as np
from sklearn.model_selection import train_test_split

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x = np.concatenate((x_train, x_test))
y = np.concatenate((y_train, y_test))

train_size = 0.7
x_train, x_test, y_train, y_test = train_test_split(x, y, train_size=train_size, random_seed=2019)

 

github 打不开,要是有网盘,或者其他形式就好了

您可以先用更少的层进行测试。

try捕捉错误行数,不能猜测错误是哪一行。

或者每行输出一数字,这样可以识别哪里出错。