How to generate Fibonacci faster
nth fibonacci number in sublinear time
We've drastically simplified the user deletion process! What does "$$" mean in the shell? XGBoost Loss function Approximation With Taylor Expansion As an example, take the objective function of the XGBoost model on the $t$'th iteration:  $$\mathcal{L}^{(t)}=\sum_{i=1}^n\ell(y_i,\hat{y}_i^{(t-1)}+f_t(\mathbf{x}_i))+\Omega(f_t)$$  where $\ell$ is the loss function, $f_t$ is the $t$'th tree output and $\Omega$ is the regularization. One of the (many) key steps for fast calculation is the approximation:  $$\mathcal{L}^{(t)}\approx \sum_{i=1}^n\ell(y_i,\hat{y}_i^{(t-1)})+g_tf_t(\mathbf{x}_i)+\frac{1}{2}h_if_t^2(\mathbf{x}_i)+\Omega(f_t),$$  where $g_i$ and $h_i$ are the first and second derivatives of the loss function.   What I'm asking for is convincing arguments to demystify why the above approximation works:  1) How does XGBoost with the above approximation compare to XGBoost with the full objective function? What potentially interesting, higher-order behavior is lost in the approximation?  2) It's a bit hard to visualize (and depends on the loss function) but, if the loss function has a large cubic component, then the approximation will likely fail. How is it that this doesn't cause problems for XGBoost? counting number of specific string in each row I have a SNP table looks like this  A N N N N N N N N N N N N C N N N C N N N N N N N N N N N N N N N N N N N C N N N C N N N N N N N N N N N N N N N N N N C C N N N N N N N N N N C C N N N C C N N N N N N N N N N N N N N N N N   I want to count total number of N in each row? any idea how to do that Programmatical Setting of 'Store Relative Pathways' for multiple MXDs ArcGIS 10.1 I am looking to move large number of mxds to a different location on the same drive. Many mxds haven't got 'Store relative pathways' option checked therefore this operation will result in broken links to data. I've only started using ArcGIS 10.1 and it is now possible to programmatically update relative pathways for all mxds by using arcPy and setting relativePaths to be "True". I had a go at writing Python script which (in theory) loops through a top folder and searches for all mxds and then updates "Store relative pathways" setting to be on. When I run this script in PyScripter, it fails to complete, I get the following error:  "exceptions.NameError: name 'mxd' is not defined  Can anyone help ?!? Thanks in advance, Magda      import arcpy, os  folderPath = r"C:\My Folder Path\...\...\..."  for filename in os.listdir(folderPath):     fullpath = os.path.join(folderPath, filename)     if os.path.isfile(fullpath):         basename, extension = os.path.splitext(fullpath)         if extension.lower() == ".mxd":             mxd = arcpy.mapping.MapDocument(fullpath)             mxd.relativePaths = 'True'         mxd.save() del mxd How to properly hook up various maps types in Cycles? I created some texture maps in MindTex to use in Blender, but I can't figure out how to properly hook them up. The maps I have:  - Diffuse  - Normal  - Height   - Specular   - Gloss   - Self Illumination  - Reflection  - Ambient Occlusion   MindTex (left) vs. Blender (right)  As you can clearly see it's a pretty big difference.  is my material node setup in Blender. In the examples I don't actually use self illumination or reflection images, but including this in the answer would be helpful. Glossaries: Make a glossary entry recognizable in printing How do you make it visible to the reader that the printed word/term is an entry in the glossary? In my PDF on the computer, I just see it because I use the hyperref package and there's a red box around it. But when printing it, there's just nothing that makes it visible to the user.  Is there a typographically good and common way of doing this? I’m looking for an alien movie I watched years ago, mid to late 2000’s about the Earth being cooked or heated up by aliens. The poster is a reflection of the Earth heating up with an orange glow on an aliens eye. It was a low budget movie and I think the one I watched was pirated from China. Again low budget, bad quality and the name could’ve been something worthy he word scorch or something like that. The alien in the movie had legs with knees that went inwards and it had red eyes. Creating fillable PDFs How to compute $\prod\limits^{\infty}_{n=2} \frac{n^3-1}{n^3+1}$ How to query MongoDB with "like"? JavaScript: client-side vs. server-side validation Which is better to do client side or server side validation?  In our situation we are using    jQuery and MVC.   JSON data to pass between our View and Controller.     A lot of the validation I do is validating data as users enter it. For example I use the the keypress event to prevent letters in a text box, set a max number of characters and that a number is with in a range.   I guess the better question would be, Are there any benefits to doing server side validation over client side?    Awesome answers everyone. The website that we have is password protected and for a small user base(&lt;50). If they are not running JavaScript we will send ninjas. But if we were designing a site for everyone one I'd agree to do validation on both sides. Why is the last digit of $n^5$ equal to the last digit of $n$? I was wondering why the last digit of $n^5$ is that of $n$? What's the proof and logic behind the statement? I have no idea where to start. Can someone please provide a simple proof or some general ideas about how I can figure out the proof myself? Thanks. Similar to , what's the best way to stay up to date with the latest stable releases of Thunderbird? When, if ever, should voting override answer acceptance for answer sorting? The accepted answer always appears at the top of the list, regardless of sort order. This can be misleading if the question author accepted an invalid solution and a better solution was proposed later, and eventually got more votes. I have seen somewhat obscure questions where the accepted answer has a negative score and the next answer has 10 or more up-votes. What is the best way to share/distribute Excel macro? Converting a drupal/drupal site to Work With Composer Smaller parskip than half for KOMA-Script? I am using the documentclass scrbook. To mark paragraphs I need both vertical spacing and indentation.  I know that KOMA-Script supports the option parskip or halfparskip, however, this disables the indentation. In order to get it back I declared \setlength{\parindent}{1.5em} in the preamble.  Since I am using both vertical spacing and indentation, I would like to have even smaller spacing than halfparskip. Is it possible to get an even smaller parskip than half in KOMA-Script? some more examples:   "And she gave me that aren't-I-just-gorgeous smile." "The I-did-it-my-way approach." "A from-this-day-forward-I-have-no-son scene." Difference between a gerund acting as subject and an infinitive acting as a subject? I am wondering whether there is any difference between a gerund acting as subject and an infinitive acting as a subject.