小编jwa*_*lex的帖子

在Windows中使用资源

我有一个使用python资源模块的脚本(有关信息,请参阅http://docs.python.org/library/resource.html).现在我想将此脚本移植到Windows.是否有任何替代版本(python-docs将其标记为"仅限unix").如果没有,还有其他解决方法吗?

我正在使用以下方法/常量:

resource.getrusage(resource.RUSAGE_CHILDREN)
resource.RLIMIT_CPU
Run Code Online (Sandbox Code Playgroud)

谢谢

PS:我正在使用python 2.7/3.2

python windows

12
推荐指数
1
解决办法
8619
查看次数

由于尺寸不同,无法在scikit-learn中使用FeatureUnion

我正在尝试FeatureUnion从数据结构中提取不同的功能,但由于尺寸不同而失败:ValueError: blocks[0,:] has incompatible row dimensions


Implementaion

FeatureUnion的建立方式如下:

    features = FeatureUnion([
        ('f1', Pipeline([
            ('get', GetItemTransformer('f1')),
            ('transform', vectorizer_f1)
        ])),
        ('f2', Pipeline([
            ('get', GetItemTransformer('f2')),
            ('transform', vectorizer_f1)
        ]))
    ])
Run Code Online (Sandbox Code Playgroud)

GetItemTransformer用于从同一结构中获取不同的数据部分.我们的想法是说明这里在scikit学习问题跟踪器.

结构本身存储{'f1': data_f1, 'f2': data_f2}data_f1具有不同长度的不同列表的位置.


由于Y-Vector与数据字段不同,我假设发生了错误,但是如何缩放矢量以适应两种情况?

python classification scikit-learn text-classification

12
推荐指数
2
解决办法
4320
查看次数