_LinearSVC.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:coremltools 作者: gsabran 项目源码 文件源码
def convert(model, feature_names, target):
    """Convert a LinearSVC model to the protobuf spec.
    Parameters
    ----------
    model: LinearSVC
        A trained LinearSVC model.

    feature_names: [str]
        Name of the input columns.

    target: str
        Name of the output column.

    Returns
    -------
    model_spec: An object of type Model_pb.
        Protobuf representation of the model
    """
    if not(_HAS_SKLEARN):
        raise RuntimeError('scikit-learn not found. scikit-learn conversion API is disabled.')

    _sklearn_util.check_expected_type(model, _LinearSVC)
    _sklearn_util.check_fitted(model, lambda m: hasattr(m, 'coef_'))

    return _MLModel(_logistic_regression._convert(model, feature_names, target))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号