blog.inferentialist.com
[C] Dynamic Programming 101: Change for a Dollar
https://blog.inferentialist.com/2016/10/06/change-for-a-dollar.html
C] Dynamic Programming 101: Change for a Dollar. Oct 6, 2016. We describe an efficient dynamic programming algorithm to compute the number of ways that one might make change for a dollar. The answer, assuming pennies, nickles, dimes, quarters, and half-dollars? Two hundred ninety two. Change for a Dollar. This defines the auxiliary variables and computes increasingly larger-value solutions. Why write in C? Created on: Oct 6, 2016. Include coin vec.h. Cv tree node to soln. Cv tree node t. Cv tree node t.
blog.inferentialist.com
[R] Adaptive Rejection Sampling
https://blog.inferentialist.com/2016/09/26/adaptive-sampling.html
R] Adaptive Rejection Sampling. Sep 26, 2016. Adaptive rejection sampling is a statistical algorithm for generating samples from a univariate, log-concave density. Because of the adaptive nature of the algorithm, rejection rates are often very low. The exposition of this algorithm follows the example given in Davison’s 2008 text, Statistical Models. The algorithm is fairly simple to describe:. Let Because of the piecewise-linear construction of , is piecewise-exponential, sampling is straightforward.
blog.inferentialist.com
Knitr & Jekyll: A Stats Blog Pipeline
https://blog.inferentialist.com/2015/10/01/knitr-and-jekyll-enabling-stats-blog-pipeline.html
Knitr and Jekyll: A Stats Blog Pipeline. Oct 1, 2015. Combining Knitr and Jekyll took some effort. This post describes how to get it all working as part of a statistical blogging pipeline. If you’re reading this, you know that I write a blog about statistics for Inferentialist Consulting. You may also be aware of the knitr. Package, useful for reproducible research. knitr is a dramatic improvement over its predecessor, Sweave. I’d love a similarly easy way to transform R Markdown to jekyll Markdown.
blog.inferentialist.com
Multivariate Normal: Conditional Density Derivation
https://blog.inferentialist.com/2016/09/19/mvn-conditional-distribution.html
Multivariate Normal: Conditional Density Derivation. Sep 19, 2016. We derive the classical result: what is the density of a multivariate normal conditioned on some proper subset of its components? That is, if. Then we want to characterize. We’ll want a couple of preliminary results before establishing the primary result. Using the moment generating function, it is easy to show that the marginal distribution of is. Then the quadratic term in is. In particular, we can write the conditional density as.
blog.inferentialist.com
[Python] Pandas.DataFrame, PostgreSQL, and Autoincrementing Columns
https://blog.inferentialist.com/2016/12/04/serialized-sql-pandas.html
Python] Pandas.DataFrame, PostgreSQL, and Autoincrementing Columns. Dec 4, 2016. Pandas.DataFrame has a. Convenience method for pumping dataframes to SQL tables. However, there is no parameterization of. That will create an autoincrementing column index. This post details a simple workaround. Create an Autoincrementing Column. The key observation is that sqlalchemy supports the creation of a SERIAL type and that this functionality is exposed through pandas, just not via the. Set up the database connection.
blog.inferentialist.com
Namecheap, Dynamic IPs, ddclient, and Hosting Multiple Sites on a Single Server
https://blog.inferentialist.com/2015/08/16/namecheap-and-ddclient.html
Namecheap, Dynamic IPs, ddclient, and Hosting Multiple Sites on a Single Server. Aug 16, 2015. How to run a single Ubuntu server with a dynamic IP address that hosts several different sites: this post will show you how using the Namecheap domain name registrar. Last week, I went looking for a solution to the following problem: I have a single Linux server with a dynamically assigned IP address and I want to host several sites on this server. My registrar is Namecheap.com. Run ddclient on secondary hosts.
blog.inferentialist.com
[R] Uber Interview Challenge
https://blog.inferentialist.com/2015/10/03/uber-challenge.html
R] Uber Interview Challenge. Oct 3, 2015. An analysis done as part of a recent Uber interview, this post showcases a regularized logistic regression model used to assess customer retention. This is the Uber Interview Challenge, a screening test for potential data science interview candidates. Supposedly, this should take three hours. However, in my professional career, I’ve never met anyone that could produce something like this in only three hours. Part 1 - SQL. Integer (fk: users.usersid). The above qu...
blog.inferentialist.com
Deploying a New Rails App On a Subdomain
https://blog.inferentialist.com/2015/11/18/deploy-new-site.html
Deploying a New Rails App On a Subdomain. Nov 18, 2015. This post: a step-by-step recipe for deploying a new Rails app on a subdomain. Our Ubuntu server runs Apache / Passenger / Rails / Capistrano; our domain registrar is namecheap. Inferentialist LLC runs multiple sites from a single, dynamic IP address. When deploying a new Rails app, this requires several configuration steps. Set up a Git Repository. Register a New Subdomain. Set up a Git Repository. Mkdir -p /home/ $USER. Mkdir -p /home/ $USER.
blog.inferentialist.com
[Python] Random Access Priority Queue
https://blog.inferentialist.com/2016/10/05/random-access-priority-queue.html
Python] Random Access Priority Queue. Oct 5, 2016. We describe a priority queue data structure that allows item removal via key or removal via (lowest) priority. As a bonus, there is code that shows how to implement a wrapper for a decorator class that enables per-method parameters and has access to class variables. Random Access Priority Queue. The RandomAccessPriorityQueue class pairs a heap with a dictionary and provides O(log(n) insertion and removal. Must be a subclass of PriorityItem. Invariant: mo...
blog.inferentialist.com
Rmarkdown, A Simple Example
https://blog.inferentialist.com/2015/10/01/r-markdown-example.html
Rmarkdown, A Simple Example. Oct 1, 2015. This post is an example showing how to write a post in R markdown. In particular, there is an Rmd block that generates a figure and a second Rmd block that generates a nicely formatted table. Start with the usual YAML header:. Layout: post title: "R Markdown Example" date: 2015-10-01 19:00:00 tags: knitr authoring markdown R CRAN example - -. Next add the Rmd to generate a plot:. And the Rmd for a table:. Xtable.html.table.attributes =.