我正在尝试在apachespark中使用elephas为二进制文本分类运行keras模型。以下是我的代码:
# my initial spark statements
from pyspark import SparkContext, SparkConf
from pyspark.sql import SQLContext
conf = SparkConf().setAppName('Elephas_App').setMaster('local[4]')
sc = SparkContext(conf=conf)
sql_context = SQLContext(sc)
#SQLcontext is created using sc for realational functionality
sql_context = SQLContext(sc)
#elephas estimator parameters
optimizer_conf = optimizers.Adam(lr = 0.01)
opt_conf = optimizers.serialize(optimizer_conf)
estimator = ElephasEstimator()
estimator.set_keras_model_config(model.to_yaml())
estimator.set_categorical_labels(True)
estimator.set_nb_classes(tar_class)
estimator.set_num_workers(1)
estimator.set_epochs(5)
estimator.set_batch_size(64)
estimator.setFeaturesCol("features")
estimator.setLabelCol("label")
estimator.set_verbosity(1)
estimator.set_validation_split(0.10)
estimator.set_optimizer_config(opt_conf)
estimator.set_mode("synchronous")
estimator.set_loss("binary_crossentrophy")
estimator.set_metrics(["acc"])
我面临以下问题:
AttributeError Traceback (most recent call last)
<ipython-input-92-74397f47b924> in <module>()
7 estimator.set_epochs(5)
8 estimator.set_batch_size(64)
----> 9 estimator.setFeaturesCol("features")
10 estimator.setLabelCol("label")
11 estimator.set_verbosity(1)
AttributeError: 'ElephasEstimator' object has no attribute 'setFeaturesCol'
“setfeaturescol”和“setlabelcol”都存在此问题。
谁能帮帮我,因为我是新手?提前谢谢!
暂无答案!
目前还没有任何答案,快来回答吧!