问题描述
有人知道如何将参数仅传递给PySpark ML Pipeline对象的一个步骤吗?我知道,在使用sklearn的情况下,可以使用各个步骤的名称和以“ __”分隔的参数名称来设置各个步骤的参数。以下是这个问题How to pass a parameter to only one part of a pipeline object in scikit learn?
的一个sklearn示例m = Pipeline([
('feature_selection',SelectKBest(
score_func=sklearn.feature_selection.f_regression,k=25)),('model',RandomForestClassifier(
random_state=0,oob_score=True,n_estimators=500,min_samples_leaf=5,max_depth=10))])
m.fit(X,y,model__sample_weight=np.array([3,4,2,3]))
我正在PySpark中寻找类似的解决方案。假设这是我的管道:
tokenizer = Tokenizer(inputCol="text",outputCol="words")
hashingTF = HashingTF(inputCol=tokenizer.getOutputCol(),outputCol="features")
lr = LogisticRegression(maxIter=10,regParam=0.001)
pipeline = Pipeline(stages=[tokenizer,hashingTF,lr])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)