有keras方法来拆分数据吗? [英] Is there a keras method to split data?
问题描述
我认为标题是不言自明的,但是要详细询问,有sklearn的方法train_test_split()
,其工作方式如下:X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size = 0.3, stratify = Y)
这意味着:该方法将以0.3:0.7的比例分割数据并尝试使百分比成为两个数据中的标签相等.有与之相当的喀拉拉邦吗?
不幸的是,答案(尽管我们希望如此)为否!有一些现有的数据集,例如MNIST等,可以直接加载:
(X_train, y_train), (X_test, y_test) = mnist.load_data()
这种以拆分方式进行的直接加载使人们不希望拥有一种通用方法,但是不幸的是,这里没有这种方法,尽管您可能会对使用类似的问题
I think the title is self explanatory but to ask it in details, there's sklearn's method train_test_split()
which works like: X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size = 0.3, stratify = Y)
It means: the method will split data with 0.3 : 0.7 ratio and will try to make percentage of labels in both data equal. Is there a keras equivalent of this?
Unfortunately, the answer (despite our wish) is No! There are some existing datasets like MNIST etc. which can be directly loaded:
(X_train, y_train), (X_test, y_test) = mnist.load_data()
This direct loading in a splitted way makes one have a false hope to have a general method, but unfortunately that isn't present here, though you may would be interested in using the wrappers for SciKit-Learn on Keras.
There is almost similar question on DataScience SE
这篇关于有keras方法来拆分数据吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!