我正在使用hyperopt。我在python中运行以下代码:
from hyperopt import hp, fmin, tpe, rand, SparkTrials, STATUS_OK, STATUS_FAIL, space_eval
trials = SparkTrials()
best = fmin(fn=self.objective, space=space, algo=tpe.suggest, trials=trials, max_evals=iteration_number)
但我犯了以下错误:
File "~/classes/Algorithm.py", line 507, in random_hyperopt
trials = SparkTrials()
File "~/.local/lib/python3.8/site-packages/hyperopt/spark.py", line 93, in __init__
max_num_concurrent_tasks = self._spark_context._jsc.sc().maxNumConcurrentTasks()
File "/opt/spark-3.1.1/python/lib/py4j-0.10.9-src.zip/py4j/java_gateway.py", line 1304, in __call__
File "/opt/spark-3.1.1/python/pyspark/sql/utils.py", line 111, in deco
return f(*a, **kw)
File "/opt/spark-3.1.1/python/lib/py4j-0.10.9-src.zip/py4j/protocol.py", line 330, in get_return_value
py4j.protocol.Py4JError: An error occurred while calling o25.maxNumConcurrentTasks. Trace:
py4j.Py4JException: Method maxNumConcurrentTasks([]) does not exist
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
at py4j.Gateway.invoke(Gateway.java:274)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)
有人知道我怎么修吗
目前没有回答
相关问题 更多 >
编程相关推荐