小编pie*_*ter的帖子

.NET 中的模板引擎

我正在寻找一个在.NET 中使用的模板引擎。来自 python,我知道 jinja,但我找不到类似的东西。我的用例是从 vb.net 对象开始创建 SQL 查询,其中包含有关要采用哪些列(最终别名)、要加入哪些表的信息...

.net

7
推荐指数
1
解决办法
5696
查看次数

为什么 sklearn 决策树这么大(大 30K 倍)?

为什么 pickle sklearn 决策树可以生成比原始估计器大数千倍的 pickle(就内存而言)

我在工作中遇到了这个问题,随机森林估计器(包含 100 个决策树)在包含大约 1_000_000 个样本和 7 个特征的数据集上生成了一个大于 2GB 的 pickle。

我能够将问题追溯到单个决策树的酸洗,并且能够使用生成的数据集复制该问题,如下所示。

对于内存估计,我使用了pympler库。使用的Sklearn版本是1.0.1

# here using a regressor tree but I would expect the same issue to be present with a classification tree
import pickle
from sklearn.tree import DecisionTreeRegressor
from sklearn.datasets import make_friedman1  # using a dataset generation function from sklear
from pympler import asizeof

# function that creates the dataset and trains the estimator
def make_example(n_samples: int):
    X, y = …
Run Code Online (Sandbox Code Playgroud)

python pickle decision-tree scikit-learn

7
推荐指数
1
解决办法
842
查看次数

如何在 Nim 中获取捕获的正则表达式的一部分

我想从“some text :some_token”文本中提取“some_token”。

下面的代码返回完整匹配,' :some_token'而不是用'some_token'标记的捕获部分([a-z0-9_-]+)

import re

let expr = re("\\s:([a-z0-9_-]+)$", flags = {re_study, re_ignore_case})
for match in "some text :some_token".find_bounds(expr):
  echo "'" & match & "'"
Run Code Online (Sandbox Code Playgroud)

如何修改它以仅返回捕获的部分?

聚苯乙烯

另外,renre模块有什么区别?

regex nim-lang

2
推荐指数
1
解决办法
247
查看次数

标签 统计

.net ×1

decision-tree ×1

nim-lang ×1

pickle ×1

python ×1

regex ×1

scikit-learn ×1