标签: pipeline

从管道中的上一个 Cmdlet 获取值

我得到以下命令: Get-Mailbox | Get-MailboxPermission | Select-Object Identity,User,AccessRights | Format-Table -AutoSize. 我希望能够PrimarySMTPAddress从我获得Get-Mailbox. 在我添加属性的那一刻,我PrimarySMTPAddress在列中什么也没有收到。

最终结果应该是这样的:

Identity                       User     AccessRights     PrimarySMTPAddress
--------                       ------   ------------     ------------------
Domain.local/Users/Mailbox1    User1    {FullAccess}     Mailbox1@Domain.local
Domain.local/Users/Mailbox2    User2    {FullAccess}     Mailbox2@Domain.local
Domain.local/Users/Mailbox3    User3    {FullAccess}     Mailbox3@Domain.local
Run Code Online (Sandbox Code Playgroud)

powershell pipeline

3
推荐指数
1
解决办法
3785
查看次数

获取每个交叉验证折叠的混淆矩阵

我正在使用 scikit-learn 通过交叉验证运行逻辑回归管道。我在下面的代码中从每个折叠中获得分数。我如何获得混淆矩阵?

clf = make_pipeline(MinMaxScaler(), LogisticRegression())
scores = cross_val_score(clf, X_train, y_train, cv=3)
Run Code Online (Sandbox Code Playgroud)

pipeline confusion-matrix scikit-learn cross-validation

3
推荐指数
1
解决办法
6271
查看次数

如何在 C# 中创建通用管道?

我正在尝试在 C# 中创建一个通用(通用)管道,以便在许多项目中重用。这个想法与ASP.NET Core Middleware非常相似。它更像是一个可以动态组合的巨大函数(双向管道)(类似于BRE

它需要获取一个输入模型,管理之前加载的一系列处理器,并在输入旁边返回一个包裹在超模型中的输出模型。

这就是我所做的。我创建了一个Context类,代表整体数据/模型:

public class Context<InputType, OutputType> where InputType : class, new() where OutputType : class, new()
{
    public Context()
    {
        UniqueToken = new Guid();
        Logs = new List<string>();
    }

    public InputType Input { get; set; } 

    public OutputType Output { get; set; }

    public Guid UniqueToken { get; }

    public DateTime ProcessStartedAt { get; set; }

    public DateTime ProcessEndedAt { get; set; }

    public long ProcessTimeInMilliseconds
    { …
Run Code Online (Sandbox Code Playgroud)

c# pipeline

3
推荐指数
1
解决办法
3176
查看次数

使用powershell在文本文件中找到特定行后如何停止Get-Content -wait?按需退出管道

我在 Powershell 中使用以下脚本(版本为 5.1):

Get-Content -Path path\to\text\file\to\be\read.txt -Wait
Run Code Online (Sandbox Code Playgroud)

现在,即使文件没有更新,它也会继续读取。在文本文件中找到特定行后如何停止?有没有其他方法可以阻止这种情况?

powershell pipeline break powershell-5.0

3
推荐指数
2
解决办法
2155
查看次数

将 ColumnTransformer() 结果附加到管道中的原始数据?

这是我的输入数据:

在此处输入图片说明

这是所需的输出,其中对列 r、f 和 m 进行了转换,并将结果附加到原始数据

在此处输入图片说明

这是代码:

import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import PowerTransformer    

df = pd.DataFrame(np.random.randint(0,100,size=(10, 3)), columns=list('rfm'))
column_trans = ColumnTransformer(
    [('r_std', StandardScaler(), ['r']),
     ('f_std', StandardScaler(), ['f']),
     ('m_std', StandardScaler(), ['m']),
     ('r_boxcox', PowerTransformer(method='box-cox'), ['r']),
     ('f_boxcox', PowerTransformer(method='box-cox'), ['f']),
     ('m_boxcox', PowerTransformer(method='box-cox'), ['m']),
    ])

transformed = column_trans.fit_transform(df)
new_cols = ['r_std', 'f_std', 'm_std', 'r_boxcox', 'f_boxcox', 'm_boxcox']

transformed_df = pd.DataFrame(transformed, columns=new_cols)
pd.concat([df, transformed_df], axis = 1)
Run Code Online (Sandbox Code Playgroud)

我还需要额外的转换器,所以我需要将原始列保留在管道中。有没有更好的方法来处理这个问题?特别是在管道中进行串联和列命名?

python pipeline pandas scikit-learn

3
推荐指数
1
解决办法
2912
查看次数

ValueError: CountVectorizer() 的输入数组维度不正确

在 sklearn 管道中使用 make_column_transformer() 时,我在尝试使用 CountVectorizer 时遇到错误。

我的 DataFrame 有两列,'desc-title''SPchangeHigh'. 这是两行的片段:

features = pd.DataFrame([["T. Rowe Price sells most of its Tesla shares", .002152],
                         ["Gannett to retain all seats in MNG proxy fight", 0.002152]],
                        columns=["desc-title", "SPchangeHigh"])
Run Code Online (Sandbox Code Playgroud)

我能够毫无问题地运行以下管道:

preprocess = make_column_transformer(
    (StandardScaler(),['SPchangeHigh']),
    ( OneHotEncoder(),['desc-title'])
)
preprocess.fit_transform(features.head(2)) 
Run Code Online (Sandbox Code Playgroud)

但是,当我用CountVectorizer(tokenizer=tokenize)替换OneHotEncoder()时,它失败了:

preprocess = make_column_transformer(
    (StandardScaler(),['SPchangeHigh']),
    ( CountVectorizer(tokenizer=tokenize),['desc-title'])
)
preprocess.fit_transform(features.head(2))
Run Code Online (Sandbox Code Playgroud)

我得到的错误是这样的:


ValueError                                Traceback (most recent call last)
<ipython-input-71-d77f136b9586> in <module>()
      3     ( CountVectorizer(tokenizer=tokenize),['desc-title'])
      4 )
----> 5 preprocess.fit_transform(features.head(2))

C:\anaconda3\lib\site-packages\sklearn\compose\_column_transformer.py …
Run Code Online (Sandbox Code Playgroud)

python pipeline scikit-learn

3
推荐指数
1
解决办法
554
查看次数

Vulkan:一个管道和多个描述符集?

我正在尝试创建一个带有布局的单个管道,它需要两个绑定,一个动态 UBO 和一个图像/采样器绑定。我希望每个绑定都来自一个单独的描述符集,所以我会为每个绘制调用绑定两个描述符集。一个描述符集用于每个对象的纹理,另一个用于动态 UBO(在对象之间共享)。我希望能够在渲染部分做这样的事情:


commandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline);

for (int ii = 0; ii < mActiveQuads; ii++)
{
    uint32_t dynamicOffset = ii * static_cast<uint32_t>(dynamicAlignment);

    // bind texture for this quad
    commandBuffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, sharedPipelineLayout, 0, 1,
            &swapResources[current_buffer].textureDescriptors[ii], 1, &dynamicOffset);

    // draw the dynamic UBO with offset for this quad
    commandBuffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, sharedPipelineLayout, 0, 1,
                &swapResources[current_buffer].quadDescriptor, 1, &dynamicOffset);

    commandBuffer.draw(2 * 3, 1, 0, 0);
}
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用。首先,我不确定我是否了解有关描述符集和管道布局的所有内容,以了解我的操作是否被允许。这甚至有意义吗?我可以创建一个具有 2 个绑定布局的管道,但是创建每个描述符来填充每个绑定中的一个,然后为该管道的每个绘制调用绑定两个描述符?

如果允许的话。这就是我创建管道和描述符的方式:

vk::DescriptorSetLayoutBinding const layout_bindings[2] = { vk::DescriptorSetLayoutBinding()
        .setBinding(0)
        .setDescriptorType(vk::DescriptorType::eUniformBufferDynamic)
        .setDescriptorCount(1)
        .setStageFlags(vk::ShaderStageFlagBits::eVertex)
        .setPImmutableSamplers(nullptr),
        vk::DescriptorSetLayoutBinding()
        .setBinding(1)
        .setDescriptorType(vk::DescriptorType::eCombinedImageSampler)
        .setDescriptorCount(1)//texture_count)
        .setStageFlags(vk::ShaderStageFlagBits::eFragment)
        .setPImmutableSamplers(nullptr) …
Run Code Online (Sandbox Code Playgroud)

pipeline descriptor vulkan

3
推荐指数
1
解决办法
2546
查看次数

在 Scala 中初始化 Apache Beam 测试管道失败

当我尝试运行测试管道时,它会引发错误

这是创建测试管道的源代码:

val p: TestPipeline = TestPipeline.create()
Run Code Online (Sandbox Code Playgroud)

这是错误:

java.lang.IllegalStateException:您的 TestPipeline 声明是否缺少 @Rule 注释?用法:@Rule public final Transient TestPipeline pipeline = TestPipeline.create();

java pipeline scala apache-beam

3
推荐指数
1
解决办法
658
查看次数

在获得最佳 TPOT 管道后获得 feature_importances_?

我已经通读了几页,但需要有人帮助解释如何进行这项工作。

我正在使用TPOTRegressor()以获得最佳管道,但从那里我希望能够绘制.feature_importances_它返回的管道:

best_model = TPOTRegressor(cv=folds, generations=2, population_size=10, verbosity=2, random_state=seed) #memory='./PipelineCache',       memory='auto',
best_model.fit(X_train, Y_train)
feature_importance = best_model.fitted_pipeline_.steps[-1][1].feature_importances_
Run Code Online (Sandbox Code Playgroud)

我在 Github 上的一个现已关闭的问题中看到了这种设置,但目前我收到错误消息:

Best pipeline: LassoLarsCV(input_matrix, normalize=True)

Traceback (most recent call last):
  File "main2.py", line 313, in <module>
    feature_importance = best_model.fitted_pipeline_.steps[-1][1].feature_importances_
AttributeError: 'LassoLarsCV' object has no attribute 'feature_importances_'
Run Code Online (Sandbox Code Playgroud)

那么,我如何从最佳管道中获得这些特征重要性,而不管它落在哪个管道上?或者这甚至可能吗?或者有人有更好的方法来尝试从 TPOT 运行中绘制特征重要性吗?

谢谢!

更新

为澄清起见,特征重要性的含义是确定数据集的每个特征 (X) 在确定预测 (Y) 标签方面的重要性,使用条形图绘制每个特征在得出其预测时的重要性级别。TPOT 不直接执行此操作(我不认为),所以我想我会抓住它提出的管道,在训练数据上重新运行它,然后以某种方式使用 a.feature_imprtances_然后能够绘制图形特征重要性,因为这些都是我正在使用的 sklearn 回归器?

python pipeline regression scikit-learn tpot

3
推荐指数
1
解决办法
1561
查看次数

哪些指令会在 x86 CPU 上产生分支预测错误?

我这里有一个测试题。

哪些指令可能会减慢处理器的工作速度,然后流水线不会预测(分支预测)进一步的执行方式?

可能的答案: JGE | 添加 | 订阅 | 推 | JMP | JNZ | 多| JG | 称呼

如果我们谈论分支预测,JGE、JMP、JNZ 和 JG 是要走的路吗?

cpu x86 assembly pipeline branch-prediction

3
推荐指数
1
解决办法
451
查看次数