【发布时间】:2023-04-01 12:27:01
【问题描述】:
下面这个经典的 sklearm 经典 train_test_split 代码是否有任何 pyspark / MLLib 版本?
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(featuresonly,
target,
test_size = 0.2,
random_state = 123)
# Show the results of the split
print("Training set has {} samples.".format(X_train.shape[0]))
print("Testing set has {} samples.".format(X_test.shape[0]))
print("Training set has good {} samples.".format(len(y_train) -y_train.sum()))
print("Testing set has good {} samples.".format(len(y_test) -y_test.sum()))
【问题讨论】:
标签: python dataframe pyspark apache-spark-mllib