pipeline

Append to an array variable from a pipeline command

北城余情 提交于 2019-12-07 06:21:18
问题 I am writing a bash function to get all git repositories, but I have met a problem when I want to store all the git repository pathnames to the array patharray . Here is the code: gitrepo() { local opt declare -a patharray locate -b '\.git' | \ while read pathname do pathname="$(dirname ${pathname})" if [[ "${pathname}" != *.* ]]; then # Note: how to add an element to an existing Bash Array patharray=("${patharray[@]}" '\n' "${pathname}") # echo -e ${patharray[@]} fi done echo -e ${patharray[

Pipeline and GridSearch for Doc2Vec

六月ゝ 毕业季﹏ 提交于 2019-12-07 03:05:39
问题 I currently have following script that helps to find the best model for a doc2vec model. It works like this: First train a few models based on given parameters and then test against a classifier. Finally, it outputs the best model and classifier (I hope). Data Example data (data.csv) can be downloaded here: https://pastebin.com/takYp6T8 Note that the data has a structure that should make an ideal classifier with 1.0 accuracy. Script import sys import os from time import time from operator

How do you write a powershell function that reads from piped input?

无人久伴 提交于 2019-12-07 01:18:18
问题 SOLVED: The following are the simplest possible examples of functions/scripts that use piped input. Each behaves the same as piping to the "echo" cmdlet. As functions: Function Echo-Pipe { Begin { # Executes once before first item in pipeline is processed } Process { # Executes once for each pipeline object echo $_ } End { # Executes once after last pipeline object is processed } } Function Echo-Pipe2 { foreach ($i in $input) { $i } } As Scripts: # Echo-Pipe.ps1 Begin { # Executes once before

Building/Waiting for parent job Latest version

走远了吗. 提交于 2019-12-06 18:44:25
We have maven projects on git with structure of -- pro-A -- pro-B -- pro-C pro-D -- pro-E These are all project with their own repo in git and their own build-pipeline in jenkins with stages as follows build -- deploy to TEST -- run tests -- (manual tigger) deploy to QA every build gets deployed to maven repo with jenkins build number appended to it and merge to release branch from master and tag with the new version number: e.g. 1.0.9-649 So, pro-A is parent of all projects, pro-B only depends on pro-A, pro-C and pro-D are at the same level they don't depend on each other but have dependency

Inform right-hand side of pipeline of left-side failure?

▼魔方 西西 提交于 2019-12-06 18:22:47
问题 I've grown fond of using a generator-like pattern between functions in my shell scripts. Something like this: parse_commands /da/cmd/file | process_commands However, the basic problem with this pattern is that if parse_command encounters an error, the only way I have found to notify process_command that it failed is by explicitly telling it (e.g. echo "FILE_NOT_FOUND"). This means that every potentially faulting operation in parse_command would have to be fenced. Is there no way process

Invalid parameter clf for estimator Pipeline in sklearn

半城伤御伤魂 提交于 2019-12-06 15:33:06
Could anyone check problems with the following code? Am I wrong in any steps in building my model? I already added two 'clf__' to parameters. clf=RandomForestClassifier() pca = PCA() pca_clf = make_pipeline(pca, clf) kfold = KFold(n_splits=10, random_state=22) parameters = {'clf__n_estimators': [4, 6, 9], 'clf__max_features': ['log2', 'sqrt','auto'],'clf__criterion': ['entropy', 'gini'], 'clf__max_depth': [2, 3, 5, 10], 'clf__min_samples_split': [2, 3, 5], 'clf__min_samples_leaf': [1,5,8] } grid_RF=GridSearchCV(pca_clf,param_grid=parameters, scoring='accuracy',cv=kfold) grid_RF = grid_RF.fit(X

IIS, Asp.NET pipeline and concurrency

主宰稳场 提交于 2019-12-06 14:26:54
I'm wondering how the concurrency in a web application actually works. Ive read several articles and to my understanding multiple instances of HttpApplication would be working at the same time. Now, I created a simple web app to test concurrency and put the following to global.asax: protected void Application_BeginRequest(object sender, EventArgs e) { Response.Write("Request started: " + DateTime.Now); System.Threading.Thread.Sleep(10000); Response.Write("<br />"); Response.Write("Request ended: " + DateTime.Now); Response.End(); } I was expecting that if I browse to the web app root in

Elasticsearch Pipelining through a Child Aggregation

大憨熊 提交于 2019-12-06 14:12:41
I am trying to Sum up Data through a Child Aggregation in Elasticsearch 2.1. With Pipelining i am trying to get the Child Aggregation Data summed up on the Parent Level of the Aggregation: { "query": { "match_all": {} }, "aggs": { "unit": { "terms": { "size": 500, "field": "unit_id" }, "aggs": { "total_active_ministers_by_unit": { "sum_bucket": { "buckets_path": "ministers>active_minister_by_ministry.value" } }, "ministers": { "children": { "type": "member_ministry" }, "aggs": { "active_minister_by_ministry": { "sum_bucket": { "buckets_path": "ministry>active_minister._count" } }, "ministry":

C# TPL Dataflow - Completion not working

只愿长相守 提交于 2019-12-06 09:41:48
This code never reaches the last line because the completion doesn't propagate from the saveBlock to the sendBlock. What am I doing wrong? var readGenerateBlock = new TransformBlock<int, int>(n => { Console.WriteLine("Read " + n); Thread.Sleep(15); return n; }); var groupingBlock = new BatchBlock<int>(10); var saveBlock = new TransformManyBlock<int[], int>(n => { Console.WriteLine("Saving {0} items [{1}; {2}]", n.Count(), n.First(), n.Last()); Thread.Sleep(150); return n; }); var sendBlock = new TransformBlock<int, int>(n => { Console.WriteLine("Sending {0}", n); Thread.Sleep(25); return n; },

_transform() takes 2 positional arguments but 3 were given

Deadly 提交于 2019-12-06 08:07:16
I try to build a pipeline with variable transformation And i do as below import numpy as np import pandas as pd import sklearn from sklearn import linear_model from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import Pipeline Dataframe df = pd.DataFrame({'y': [4,5,6], 'a':[3,2,3], 'b' : [2,3,4]}) I try to get a new variable for predict class Complex(): def __init__(self, X1, X2): self.a = X1 self.b = X2 def transform(self, X1, X2): age = pd.DataFrame(self.a - self.b) return age def fit_transform(self, X1, X2): self.fit( X1, X2) return self.transform(X1, X2) def fit