matching

consistent matched pairs in R

老子叫甜甜 提交于 2020-01-04 13:37:09
问题 So using the Matching Package (Link to package here) We can work through a modified GenMatch example. library(Matching) data(lalonde) #introduce an id vaiable lalonde$ID <- 1:length(lalonde$age) X = cbind(lalonde$age, lalonde$educ, lalonde$black, lalonde$hisp, lalonde$married, lalonde$nodegr, lalonde$u74, lalonde$u75, lalonde$re75, lalonde$re74) BalanceMat <- cbind(lalonde$age, lalonde$educ, lalonde$black, lalonde$hisp, lalonde$married, lalonde$nodegr, lalonde$u74, lalonde$u75, lalonde$re75,

Matching multiple date values in R

本小妞迷上赌 提交于 2020-01-03 17:04:04
问题 I have the following dataframe DF describing people that have worked on a project on certain dates: ID ProjectName StartDate 1 Health 3/1/06 18:20 2 Education 2/1/07 15:30 1 Education 5/3/09 9:00 3 Wellness 4/1/10 12:00 2 Health 6/1/11 14:20 The goal is to find the first project corresponding to each ID. For example the expected output would be as follows: ID ProjectName StartDate 1 Health 3/1/06 18:20 2 Education 2/1/07 15:30 3 Wellness 4/1/10 12:00 So far I have done the following to get

Matching two elements (people) together based on similarity of preferences

旧城冷巷雨未停 提交于 2020-01-03 05:55:29
问题 I'm in the planning stages of a website that will match two users together periodically. Each person in the pool will have several preferences that are used in the matching process, e.g. what genres of music they like and which days of the week they are available. For the purposes of this project, I'd like to assign higher weight/match priority if the preferences are specific; i.e. two people who ONLY like 'science fiction' are a better match than simply putting together two people who

Matching two series of Mfcc coefficients

时光毁灭记忆、已成空白 提交于 2020-01-01 19:04:18
问题 I have extracted two series MFCC coefficients from two around 30 second audio files consisting of the same speech content. The audio files are recorded at the same location from different sources. An estimation should be made whether the audio contains the same conversation or a different conversation. Currently I have tested a correlation calculation of the two Mfcc series but the result is not very reasonable. Are there best practices for this scenario? 回答1: I had the same problem and the

Extract pattern between a substring and first occurrence of numeric in a string

 ̄綄美尐妖づ 提交于 2020-01-01 12:03:13
问题 Following is the content of a file: xxx_component1-1.0-2-2acd314.xc-linux-x86-64-Release-devel.r xxx_component2-3.0-1-fg3sdhd.xc-linux-x86-64-Release-devel.r xxx_component3-1.0-2-3gsjcgd.xc-linux-x86-64-Release-devel.r xxx_component4-0.0-2-2acd314.xc-linux-x86-64-Release-devel.r I want to extract component names component1 component2 etc. This is what I tried: for line in `sed -n -e '/^xxx-/p' $file` do comp=`echo $line | sed -e '/xxx-/,/[0-9]/p'` echo "comp - $comp" done I also tried sed -e

OpenCV - RobustMatcher using findHomography

瘦欲@ 提交于 2020-01-01 07:23:19
问题 I've implement a Robust matcher found on the internet based on differents tests : symmetry test, Ratio Test and RANSAC test. It works well. I used then findHomography in order to have good matches. Here the code : RobustMatcher::RobustMatcher() : ratio(0.65f), refineF(true),confidence(0.99), distance(3.0) { detector = new cv::SurfFeatureDetector(400); //Better than ORB //detector = new cv::SiftFeatureDetector; //Better than ORB //extractor= new cv::OrbDescriptorExtractor(); //extractor= new

Rust matching and borrow checker

蓝咒 提交于 2019-12-31 06:37:15
问题 I keep stumbling on a pattern in my Rust programs that always puts me at odds with the borrow-checker. Consider the following toy example: use std::sync::{Arc,RwLock}; pub struct Test { thing: i32, } pub struct Test2 { pub test: Arc<RwLock<Test>>, pub those: i32, } impl Test { pub fn foo(&self) -> Option<i32> { Some(3) } } impl Test2 { pub fn bar(&mut self) { let mut test_writer = self.test.write().unwrap(); match test_writer.foo() { Some(thing) => { self.add(thing); }, None => {} } } pub fn

Rust matching and borrow checker

≯℡__Kan透↙ 提交于 2019-12-31 06:36:49
问题 I keep stumbling on a pattern in my Rust programs that always puts me at odds with the borrow-checker. Consider the following toy example: use std::sync::{Arc,RwLock}; pub struct Test { thing: i32, } pub struct Test2 { pub test: Arc<RwLock<Test>>, pub those: i32, } impl Test { pub fn foo(&self) -> Option<i32> { Some(3) } } impl Test2 { pub fn bar(&mut self) { let mut test_writer = self.test.write().unwrap(); match test_writer.foo() { Some(thing) => { self.add(thing); }, None => {} } } pub fn

Perl: Empty $1 regex value when matching?

风流意气都作罢 提交于 2019-12-31 04:10:10
问题 Readers, I have the following regex problem: code #!/usr/bin/perl -w use 5.010; use warnings; my $filename = 'input.txt'; open my $FILE, "<", $filename or die $!; while (my $row = <$FILE>) { # take one input line at a time chomp $row; if ($row =~ /\b\w*a\b/) { print "Matched: |$`<$&>$'|\n"; # the special match vars print "\$1 contains '$1' \n"; } else { #print "No match: |$row|\n"; } } input.txt I like wilma. this line does not match output Matched: |I like <wilma>| Use of uninitialized value

Populate a new column if a value is found in any column

核能气质少年 提交于 2019-12-31 04:02:52
问题 I want to check every row in data frame. I need to check all columns in that row to see if it contains a 1, if it does I want to populate another column that summarizes if any of the columns had a 1 or not. So far I have tried using grepl to return a logical index by matching the '1', and then with ifelse, change the logical vector to 'yes' or 'no' dat1$imputed_data <- ifelse(grepl("1", imputed_columns), "yes", "no") I have also tried for(i in nrow(imputed_columns)){ if (any(imputed_columns[i