mean

grouping objects to achieve a similar mean property for all groups

随声附和 提交于 2019-12-03 03:41:38
I have a collection of objects, each of which has a numerical 'weight'. I would like to create groups of these objects such that each group has approximately the same arithmetic mean of object weights. The groups won't necessarily have the same number of members, but the size of groups will be within one of each other. In terms of numbers, there will be between 50 and 100 objects and the maximum group size will be about 5. Is this a well-known type of problem? It seems a bit like a knapsack or partition problem. Are efficient algorithms known to solve it? As a first step, I created a python

What does it mean when a .NET application crashes due to a System.AccessViolation exception?

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The application itself is 2000 lines long so it wouldn't make sense to paste the code here, especially since the exception that one of the users received does not give any hints as to what part of my code is causing the problem. The app, by the way, is just a Windows Form with a datagridview that typically displays no more than a few hundred rows of data, and some other controls. Before it crashed, it was loading the cells of each row of the datagridview extremely slowly. (But no other user has experienced the same problem.) The exception

What does &. (ampersand dot) mean in Ruby?

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I came across this line of ruby code. What does &. mean in this? @object &. method 回答1: It is called the Safe Navigation Operator. Introduced in Ruby 2.3.0, it lets you call methods on objects without worrying that the object may be nil (Avoiding an undefined method for nil:NilClass error), similar to the try method in Rails . So you can write @person &. spouse &. name instead of @person . spouse . name if @person && @person . spouse 回答2: Note: Even though @Santosh gave a clear and full answer, I would like add some more background

plyr package writing the same function over multiple columns

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to write the same function to multiple columns using ddply function, but I'm tried keep writing them in one line, want to see is there better way of doing this? Here's a simple version of the data: data<-data.frame(TYPE=as.integer(runif(20,1,3)),A_MEAN_WEIGHT=runif(20,1,100),B_MEAN_WEIGHT=runif(20,1,10)) and I want to find out the sum of columns A_MEAN_WEIGHT and B_MEAN_WEIGHT by doing this: ddply(data,.(TYPE),summarise,MEAN_A=sum(A_MEAN_WEIGHT),MEAN_B=sum(B_MEAN_WEIGHT)) but in my current data I have more than 8 "*_MEAN_WEIGHT", and

“Did you mean?” feature in Lucene.net

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can someone please let me know how do I implement "Did you mean" feature in Lucene.net? Thanks! 回答1: You should look into the SpellChecker module in the contrib dir. It's a port of Java lucene's SpellChecker module, so its documentation should be helpful. (From the javadocs:) Example Usage: import org.apache.lucene.search.spell.SpellChecker; SpellChecker spellchecker = new SpellChecker(spellIndexDirectory); // To index a field of a user index: spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field)); // To index a file

What does “Arg = Exploded” mean in Swift crash log? [duplicate]

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: What's Dead & Exploded in Swift's exception stack? 3 answers I get a crash log from Crashlytics/Fabric which reads like the following: function signature specialization <Arg[0] = Exploded, Arg[1] = Owned To Guaranteed> of MyClass.viewWillAppear (MyClass)(Swift.Bool) -> () what does exploded mean for Arg[0]? It's weird that there are two arguments because we're talking about viewWillAppear here - is the first argument the object itself? 回答1: I got this issue a week ago, and thankfully managed to fix

What does frame_dummy mean in the context of profiling?

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In the process of using gprof to profile a C++ program I've written, I've noticed that the vast majority of execution time is spent in the function "frame_dummy". More precisely, the first entry in the flat profile from the output of gprof shows 76.38% of sample time spent in and 24611191 calls to a function with name frame_dummy. In short, I am trying to understand both what frame_dummy refers to -- as I do not have any function named as such -- as well as what this means for my optimization efforts. Though it is unlikely to be relevant, I

How can I compile Programmer Dvorak?

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to compile the open source project Programmer Dvorak . The problem is that it's a bit old and doesn't build with the current versions of the build tools. You can see the full source code with modifications I made online at my project's Google Code page . Revision 2 is the unmodified source files from the original project. Revision 3 is where I made all the significant changes. You can see a diff between the two revisions here . The only obvious problems that are left are a few LINK warnings: LNK4254 (e.g. section '.edata'

Plotly: add_trace in a loop

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to add_trace ad each loop, but I get only one plot with multiplies lines on over each other. mean <- -0.0007200342 sd <- 0.3403711 N=10 T=1 Delta = T/N W = c(0,cumsum( sqrt(Delta) * rnorm(N, mean=mean, sd=sd))) t <- seq(0,T, length=N+1) p<-plot_ly(y=W, x=t) for(i in 1:5){ W <- c(0,cumsum( sqrt(Delta) * rnorm(N, mean=mean, sd=sd))) p<-add_trace(p, y=W) } print(p) 回答1: The plot_ly and add_trace functions have an evaluation = FALSE option that you can change to TRUE , which should fix the scope issues. 回答2: Use evaluate = TRUE in add

What does this TLS Alert mean?

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am looking at a Microsoft Network Monitor capture of an HTTPS "GET" request which mysteriously never completes if performed by .NET HttpWebRequest . I have found that the Server Hello contains an Alert entry which looks like this: I have these questions: Is this alert really encrypted? I read that alerts do come encrypted if sent after a key exchange, but as you can see, this occurs very early in the negotiation stage, at Server Hello. If not encrypted, is it malformed? The first byte, 01 , suggests it's a warning, but the 70 ("Protocol