search for: myweight

Displaying 12 results from an estimated 12 matches for "myweight".

2007 Jun 15
2
model.frame: how does one use it?
...ents, in particular 'weights'. A simple contrived example is ----------------------------------------------------------------------------- library(rpart) ## using data from help(rpart), set up simple example myformula <- formula(Kyphosis ~ Age + Number + Start) mydata <- kyphosis myweight <- abs(rnorm(nrow(mydata))) goodFunction <- function(mydata, myformula, myweight) { hyp <- rpart(myformula, data=mydata, weights=myweight, method="class") prev <- hyp } goodFunction(mydata, myformula, myweight) cat("Ok\n") ## now remove myweight and try to comp...
2013 Mar 05
1
Remote database & local database, and adding new weight found vtable error
...::open(host of DB1, port of DB1, 0, 0); Xapian::Database dbr2 = Xapian::Remote::open(host of DB2, port of DB2, 0, 0); db.add_database(dbr2); Here dictionary DT2 holds the docid and its document data. ============= Q2. I want add a weight scheme into Xapian-1.2.12; I have implemented it by add Myweight.cc in ./weight/ with weight.cc, etc. and I also added necessary declaration in ./include/xapian/weight.h for Myweight. by add Myweight.cc into ./weight/Makefile.am I have successfully compiled the source code and got the dynamic library. But when I call Myweight scheme in my own c++ program, the...
2011 Dec 27
0
Using minsplit and unequal weights in rpart
...epeated <- rbind(kyphosis, kyphosis, kyphosis) fitRepeated <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosisRepeated, control=rpart.control(minsplit=45)) plot(fitRepeated) text(fitRepeated, use.n=TRUE) # instead of repeating, use weights kyphosisWeighted <- kyphosis kyphosisWeighted$myWeights <- 3 fitWeighted <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosisWeighted, weights=myWeights, control=rpart.control(minsplit=15)) ## minsplit has to be adjusted for weights... plot(fitWeighted) text(fitWeighted, use.n=TRUE) # uneven weights don't works the same way kyp...
2010 Jun 03
1
mlogit and weights
...viduals. For example, library(mlogit) library(AER) data("TravelMode", package = "AER") TM <- mlogit.data(TravelMode, choice = "choice", shape = "long", alt.levels = c("air", "train", "bus", "car")) myweight = rep(floor(1000*runif(nrow(TravelMode)/4)), each = 4) summary(mlogit(choice ~ wait + vcost + travel + gcost, data=TM)) summary(mlogit(choice ~ wait + vcost + travel + gcost, weights=income, data=TM)) summary(mlogit(choice ~ wait + vcost + travel + gcost, weights=myweight, data=TM)) Each gives th...
2012 Jul 17
1
weighted mean by week
...a code that works, but it looks ugly to me - it's full of loops. I am sure there is a much more elegant and shorter way to do it. Thanks a lot for any hints! Dimitri # I have a data frame: x<-data.frame(group=c("group1","group2","group1","group2"), myweight=c(0.4,0.6,0.4,0.6), myweek=as.Date(c("2012-07-09","2012-07-09","2012-07-16","2012-07-16")), var1=c(1,10,2,20),var2=c(10,1,20,2)) (x) # For each week in "myweek", I'd like to build a weighted mean for var1 and var2 - using "myweight&q...
2010 Oct 22
1
lm looking for weights outside of the user-defined function
...ar R'ers, I am fighting with a problem that is driving me crazy. I use "lm" in my user-defined function, but it seems to be looking for weights outside of my function's environment: ### Generating example data: x<-data.frame(y=rnorm(100,0,1),a=rnorm(100,1,1),b=rnorm(100,2,1)) myweights<-runif(100) data.for.regression<-x[1:3] ### Creating function "weighted.reg": weighted.reg=function(formula, MyData, filename,WeightsVector) { print(dim(MyData)) print(filename) print(length(WeightsVector)) regr.f<-lm(formula,MyData,weights=WeightsVector,na.action=na.omit)...
2013 Mar 04
2
Need Beginner Guide for Matcher Optimisations Project
Hi, While searching for a project which matches my interest andskill level, I found this project named Matcher Optimization. This project is really challenging and excting from my view point and I would like to be a part of this project. Optimization techniques metioned in the reference links provided will take some time for me to have a good understanding about them. But I am trying to get my
2005 Dec 29
1
Repeating functions
Hi, I have a number of spatial weight files and using Roger Bivand's spdep, I would like to 1. Convert them into neighbor lists using 2. Convert the neighbor lists into spatial weights For a given file, the syntax would be mygal_nb1 <- read.gal("mygalfile1", override.id = TRUE) myweight1 <- nb2listw(mygal_nb1) I have mygalfile[i] with i from 1 through to 6 and would like to repeat the above two lines through 1 to 6. something like (the syntax below is not correct...just an illustration) for (i in 1:6) { mygal_nb[i] <- read.gal("mygalfile[i]", override.id = TRUE)...
2007 Apr 28
1
bootstrap: macro `AM_CXXFLAGS' not found in library
Folks, I get this when I try to run 'bootstrap' to rebuild Xapian from scratch. This is the current revision from the svn repository today (8400). Any suggestions on what other package may be needed (both gcc and g++ are installed). ken@mercury:~/sandbox/xapian/trunk$ ./bootstrap Bootstrapping `xapian-core' aclocal: configure.ac: 130: macro `AM_CXXFLAGS' not found in library
2008 Oct 07
2
weighted quantiles
I have a set of values and their corresponding weights. I can use the function weighted.mean to calculate the weighted mean, I would like to be able to similarly calculate the weighted median and quantiles? Is there a function in R that can do this? thanks, Spencer [[alternative HTML version deleted]]
2011 Mar 30
0
RWeka - adding weights to a dataset
Hello, I was wondering what would be the easiest way to append weights to a dataset in RWeka. Ideally, I'd like to have something like: m <- LogitBoost(Species ~ ., data=iris, weights = myweights) But that, as far as I understand, it is not implemented and I'd need to use a workaround. I know that when programming Weka in Java it is possible to assign weights to instances using the setWeight, but I don't know exactly what would be the easiest way to do it. I was thinking about...
2011 Mar 08
1
MSet order
Hello I defined a weighting scheme to simulate a king of "euclidean" distance. To test it, i used a database with 1000 documents. If I run : enquire.set_weighting_scheme(MyWeight()); Xapian::MSet matches = enquire.get_mset(0, 1000); I have a correct list of results. But if I run Xapian::MSet matches = enquire.get_mset(0, 10); I don't have the top-10 results. If I run Xapian::MSet matches = enquire.get_mset(0, 20); I d'ont have the top-20 results and it's even n...