我正在分析数据和训练模型,稍后将用于日期预测应用程序.我的服务器上目前有大约700万行数据(表大小=6,400,000行x 8列). 我想知道对于这个行数是否有推荐的n_stimators值.我需要在准确的数据和应用程序的速度之间的平衡比例.
`Python 定义序列随机森林(数据): try : #将数据拆分为要素和目标 X=data.drop(Columns=[‘ident’])#功能 Y=data[‘ident’]#目标
# Split data into train and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# Initialize Random Forest model
model = RandomForestClassifier(n_estimators=100, random_state=42)
# Train the model
model.fit(X_train, y_train)
# Evaluate the model
accuracy = model.score(X_test, y_test)
print(f"Model accuracy: {accuracy}")
return model
except Exception as e:
print("Error training Random Forest model:", e)
return None`
我try 了从1到1500的不同值,但没有找到最好的值.