sample

Reproducing a population. Should I `deepcopy` each individual?

你离开我真会死。 提交于 2019-12-08 02:01:34
问题 I simulate an evolving population in Julia. Somewhere in my code I randomly sample (sample weighted by the fitnesses of the individuals) individuals in order to form the next generation. Because the same individual can be sampled several times (sampling with replacement), I have to make that I copy the individuals and not only create a new pointer to the same data. Here is what the code looks like for the moment: ##### Reproduction ###### NewPopulation = Array(Individuals, nb_individuals_in

How to create a loop for generate a list of random samples in R?

时间秒杀一切 提交于 2019-12-07 12:56:38
问题 I'm trying to create a loop that creates a series of objects that contains a random sample, like this: sample <- ceiling(runif(9, min=0, max=20)) (This is an example for a rounded uniform, but it can be replaced by a normal, poisson or whatever you want). So, I built a loop for generate automatically various of those generators, with the objective of include them in a data frame. Then, the loop I designed was this: N=50 dep=as.vector(N) count=1 for (i in 1:N){ dep[count] <- ceiling(runif(9,

Generating samples from a two-Gaussian mixture in r (code given in MATLAB)

自闭症网瘾萝莉.ら 提交于 2019-12-07 05:45:16
问题 I'm trying to create (in r) the equivalent to the following MATLAB function that will generate n samples from a mixture of N(m1,(s1)^2) and N(m2, (s2)^2) with a fraction, alpha, from the first Gaussian. I have a start, but the results are notably different between MATLAB and R (i.e., the MATLAB results give occasional values of +-8 but the R version never even gives a value of +-5). Please help me sort out what is wrong here. Thanks :-) For Example: Plot 1000 samples from a mix of N(0,1) and

Opening and Displaying an Image in C++?

妖精的绣舞 提交于 2019-12-07 02:26:45
问题 Basically I am teaching myself C++ and part of the program function will be to open and close an image specified. How would I go about doing this? Or what resource would I use? Thanks! 回答1: In c++ (without any extra library) you may open an image. But there will be nothing particularly useful except a bunch of binary data. then you have to use your own decoder If you use opencv you can write to open an image and display it: Mat m("fileName"); imshow("windowName",m); To do the same with a

Negative sample image dimensions for training cascaded classifier in OpenCV?

狂风中的少年 提交于 2019-12-06 12:21:43
问题 So following up from here, I now need to collect negative samples, for cascaded classification using OpenCV. With positive samples, I know that all samples should have the same aspect ratio. What about negative samples? Should they all be larger than positive samples (since OpenCV is going to paste positives on top of negatives to create the test images). Should all be the same size? Can they be arbitrary sizes? Should they too have the same aspect ratio among themselves? 回答1: From OpenCV doc

Randomly select groups (and all cases per group) in R?

时光怂恿深爱的人放手 提交于 2019-12-06 11:24:00
I have an R dataframe with two levels of data: id and year . Within groups defined by id , the years increase (entire dataset has the same (number of) years per group, like so: id year var1 var2 11A 2001 ... ... 11A 2002 ... ... 11A 2003 ... ... 11A 2004 ... ... 13B 2001 ... ... 13B 2002 ... ... 13B 2003 ... ... 13B 2004 ... ... 22Z 2001 ... ... I have about 20.000 groups in my data, of couse way too many to make nice plots of growth curves. How do I randomly select about 20 of my id's? (so: also select all 4 rows of years corresponding to that id?) This is pretty straight forward if you use

ASP.NET Themes samples/starter kits

北慕城南 提交于 2019-12-06 08:28:39
I was wondering if there was somewhere I could get some starter kit / theme sample for ASP.NET. I am not a designer, but I need to build a prototype for a project, and if I do it myself it'll certainly be awful Do you know where I could find that (ASP.NET specific)? Check http://asp.net . There are quite a few starter kits and sample projects there. ( http://www.asp.net/community/projects/ ) Do you mean templates for a website? If so, that is nothing to do with ASP.NET, There are loads of places to get decent free website templates including: http://www.templateworld.com/free_templates.html

Google GCM XMPP code samples

隐身守侯 提交于 2019-12-06 07:09:15
问题 So, Google used to have a nice page where they gave code sample on how to implement a GCM Xmpp server on this page: https://developers.google.com/cloud-messaging/ccs I had bookmarked this answer anytime I wanted to view the implementation Confused about Google GCM XMPP But everything linked from in that answer is gone. Google deleted them. But now, they have removed everything, and added a page that just explains what it does. Sure, but the sample java code would be nice. I tried to go to the

run three.js on server with a help of node.js, export model to json and load to end user through ajax

◇◆丶佛笑我妖孽 提交于 2019-12-06 06:45:20
问题 I have a JavaScript app with a requirement to protect the drawing interface of the model so that it is not to public. I want to use three.js on a server, save the model in JSON format and deliver it the client side. Three.js on the client will display it. But I don't know how to implement it on a server. Are there any Node.js examples that run three.js apps? If so, how do I save a mesh into JSON format from three.js? 回答1: But I don't know how to implement it on a server. three module Are

Native OpenCV Samples for Android throws UnsatisfiedLinkError

杀马特。学长 韩版系。学妹 提交于 2019-12-06 05:40:00
问题 I try to run the opencv android samples on the emulator. The samples with native code e.g. sample "Tutorial 2 Advanced - 1. Add Native OpenCV" fails. I have a Win7 x86 System. I can build the native libs but i always get the following exception if i run the sample: 10-04 08:08:19.179: WARN/dalvikvm(696): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/samples/tutorial3/Sample3View; 10-04 08:08:19.190: DEBUG/AndroidRuntime(696): Shutting down VM 10-04 08:08:19