我有一个应用于逻辑回归函数的数据集,但是我不知道如何在dolphindb中将数据集分为训练集和测试集。例如,Python可以通过sklearns拆分数据集。
python:
from sklearn import datasets
from sklearn import train_test_split
from sklearn.linear_model import LogisticRegression
iris = datasets.load_iris()
X_train,X_test,Y_train,Y_test = train_test_split(iris.data,iris.target,test_size=0.2, random_state=0)
logreg = LogisticRegression()
logreg.fit(X_train,Y_train)
logreg.predict(X_test)
dolphindb:
n =2000
t = table(take(0 0 0 0 0 1 1 1 1 1,n) as y, take(1..10, n) as x0, take(1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0, n) as x1, take(11..20, n) as x2)
model = logisticRegression(sqlDS(<select * from t>), `y, `x0`x1`x2)