在我遵循的指南中,我遇到了一个错误:CoreMD using Python
需要按照指南创建一个简单的数据集。指南之间的唯一区别是由我制作的:
data["personalityType"] = data["path"].apply( lambda path: "Enfj" if "enfj" in path
else lambda path: "Enfp" if "enfp" in path
else lambda path: "Entj" if "entj" in path
else lambda path: "Entp" if "entp" in path
else lambda path: "Esfj" if "esfj" in path
else lambda path: "Esfp" if "esfp" in path
else lambda path: "Estj" if "estj" in path
else lambda path: "Estp" if "estp" in path
else lambda path: "Infj" if "Infj" in path
else lambda path: "Infp" if "infp" in path
else lambda path: "Intj" if "intj" in path
else lambda path: "Intp" if "intp" in path
else lambda path: "Isfj" if "isfj" in path
else lambda path: "Isfp" if "isfp" in path
else lambda path: "Istj" if "istj" in path
else "Istp")
代替:
data["foodType"] = data["path"].apply(lambda path: "Rice" if "rice"
终端中的错误日志:
python分类器.py
Traceback(最近一次调用最后一次):文件“classifier.py”,第 20 行,在 data.save("ptype.sframe")
文件“/usr/local/lib/python2.7/site-packages/turicreate/data_structures/sframe.py”,第 2808 行,在保存中引发 ValueError("Unsupported format: {}".format(format))
文件“/usr/local/lib/python2.7/site-packages/turicreate/cython/context.py”,第 49 行,退出 raise exc_type(exc_value)
RuntimeError:python 回调函数评估中的异常:
TypeError("无法将类型 'function' 转换为灵活类型。",):
回溯(最后一次调用):文件“turicreate/cython/cy_pylambda_workers.pyx”,第 427 行,位于 turicreate.cython.cy_pylambda_workers._eval_lambda 文件“turicreate/cython/cy_pylambda_workers.pyx”,第 172 行,位于 turicreate.cython.cy_pylambda_workers .lambda_evaluator.eval_simple
文件“turicreate/cython/cy_flexible_type.pyx”,第 1306 行,在 turicreate.cython.cy_flexible_type.process_common_typed_list 文件“turicreate/cython/cy_flexible_type.pyx”,第 1251 行,在 turicreate.cython.cy_flexible_type._fill_typed_sequence 文件中“ turicreate/cython/cy_flexible_type.pyx”,第 1636 行,在 turicreate.cython.cy_flexible_type._ft_translateTypeError:无法将类型“函数”转换为灵活类型。
问题可能是什么,因为我无法使用 Python 2.7 运行我的 classifier.py