当我尝试序列化模型时,我遇到了Python0.16和MLeap 3的问题。下面是我的代码:
from mleap.sklearn.logistic import LogisticRegression
from sklearn.datasets import load_iris
X, y = load_iris(return_X_y=True)
clf = LogisticRegression(random_state=0).fit(X, y)
clf.serialize_to_bundle("path", "irismodel")错误:
AttributeError: 'LogisticRegression' object has no attribute 'input_features'有人找到解决办法了吗?
发布于 2020-05-26 22:13:09
我找到了解决方案。
clf.mlinit(input_features="features", prediction_column="prediction") 失踪了。
您也可以使用管道来完成此操作:
from mleap.sklearn.logistic import LogisticRegression
from sklearn.datasets import load_iris
from mleap.sklearn.pipeline import Pipeline
X, y = load_iris(return_X_y=True)
logistic = LogisticRegression(random_state=0)
logistic.mlinit(input_features="features", prediction_column="prediction")
pipeline = Pipeline([("log", logistic)])
clf = pipeline.fit(X, y)
clf.mlinit()
clf.serialize_to_bundle("/dbfs/endpath", "model.json")https://stackoverflow.com/questions/62002060
复制相似问题