There's one in here that says "with zsh"
https://askubuntu.com/questions/704160/list-all-recently-changed-files-recursive
I wanted something like this in order to find on my iMac what research files I'd recently modified so I could transfer them quickly off from my iMac and onto my Macbook Pro.
There's one in here that says "with zsh" https://askubuntu.com/questions/704160/list-all-recently-changed-files-recursive
0 Comments
To profile R code, Hadley Wickham's package profvis is pretty good, and easy to use. See the vignette for details.
I don't know where you're supposed to add this #define, but anyway here's what my note was:
To enable Rcpp debugging, as part of an answer on old Rcpp listserv Romain suggested: "Maybe you can enable some rcpp debugging by adding #define RCPP_DEBUG_LEVEL 1 Before you include Rcpp.h, this will give you verbose output, maybe this will help locating the issue. " I wasn't able to compile an Rcpp file with sourceCpp() on the DSCR cluster. The reason was that some kind of compiler flags needed to be set to use C++11. So I followed the suggestion here:
http://stackoverflow.com/questions/18453182/g-errors-when-trying-to-compile-c11-with-rcpp i.e. all I did (it appears so far to work) is to create ~/.R/Makevars (the directory had to be created too) and place the following line in it: PKG_CXXFLAGS = -std=c++11 Then the Rcpp file compiled.
But because I spent time on it, here is how to get Pycharm working with jupyter notebooks:
Great article in here by Hadley Wickham on the reshape package. Excellent short read for understanding HOW to think about the format of data. Has the additional benefit of sort of teaching you how to use melt etc.
Is this really a causal relationship? Here's an example of questionable statistical language in the news. Brazil breast-feeding study.
Another one (definitely no link to the actual study in here) http://www.mirror.co.uk/news/uk-news/breastfed-children-earn-more-money-5358181 "Breastfeeding generally was found to increase adult intelligence, length of schooling and adult earnings." Non-blind data collection leads to more frequent and possibly spurious "significant" results12/17/2016 How to allow a script to set the working directory to the location of that script file. Richie Cotton's answer here:
(REQUIRES use of Rstudio!) Use the commmand: setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) Only display a single app at once:
defaults write com.apple.dock single-app -bool true; killall Dock Disable the Desktop icons being shown. defaults write com.apple.finder CreateDesktop -bool false; killall Finder defaults write com.apple.finder CreateDesktop -bool true; killall Finder This is for the case where each data frame in the original list is formatted with the same columns (like it was produced in a loop...)
Sample Headline¶
Another headline (H2)¶This is a normal paragraph. Now for some Lorem Ipsum. Lorem ipsum dolor sit amet. Basic formatting of italics and bold is supported. This can be nested like so. What this notebook shows¶
In [18]:
'Hello World'
Out[18]:
'Hello World'
In [20]:
print('Hello World')
Hello World
In [23]:
%lsmagic
Out[23]:
Available line magics: %alias %alias_magic %autocall %automagic %autosave %bookmark %cat %cd %clear %colors %config %connect_info %cp %debug %dhist %dirs %doctest_mode %ed %edit %env %gui %hist %history %install_default_config %install_ext %install_profiles %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %popd %pprint %precision %profile %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %set_env %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode Available cell magics: %%! %%HTML %%SVG %%bash %%capture %%debug %%file %%html %%javascript %%latex %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefile Automagic is ON, % prefix IS NOT needed for line magics.
In [27]:
%pwd
Out[27]:
'/Users/garylarson/foo'
In [31]:
%ls -la
total 16 drwxr-xr-x 4 garylarson staff 136 Nov 21 09:01 ./ drwxr-xr-x+ 150 garylarson staff 5100 Nov 21 08:34 ../ drwxr-xr-x 3 garylarson staff 102 Nov 21 08:51 .ipynb_checkpoints/ -rw-r--r-- 1 garylarson staff 7788 Nov 21 09:01 Testing Jupyter.ipynb
In [40]:
%matplotlib inline
In [41]:
import numpy as np
import matplotlib.pyplot as plt
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses
plt.scatter(x,y, s = area, c = colors, alpha=0.5)
plt.show
Out[41]:
<function matplotlib.pyplot.show>
In [45]:
%%timeit
square_evens = [n*n for n in range(1000)]
The slowest run took 4.50 times longer than the fastest. This could mean that an intermediate result is being cached. 1000 loops, best of 3: 264 µs per loop
In [48]:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(10,5))
df.head()
Out[48]:
In [ ]:
After installing Anaconda python in hopes to learn some python via iPython notebooks, I found that the most basic commands (like starting the navigator / new notebook / etc) did not work from the Terminal. I was getting all sorts of confused about what was going on. The problem was simple:
Anaconda's installation does set all the paths properly, but the problem is using fish as the default shell. Because I'm not using bash as the default shell, I don't get access to any of the PATHs that are set by ~/.bash_profile! One option would be to try manually setting all those environment variables in fish.config (or whatever it's called) but that seems like a pain. Another option, from here, it to try this: "Keep your default shell as Bash and simply add the line exec fish to the appropriate Bash#Configuration files," I did that - adding exec fish to the end of ~/.bash_profile, and changed back to bash as the default shell. Now, when opening a new terminal window, fish opens and running which python finally gives me /Users/garylarson/anaconda/bin/python. Here's a summary video (~17:00 long) explaining what I learned.
https://youtu.be/WIrBLJZBsLQ A couple notes I took before I started following along with the actual work.
From Andrew Gelman, some "important methods and concepts related to statistics that are not as well known as they should be."
I have what is essentially a Metropolis-within-Gibbs sampler. One or two of the parameters have unconventional steps in their sampling. (I'm talking about my expansion to Challis Schmidler 2012 which used a library of proposals to improve mixing on a couple of the parameters). I suspect I'm seeing poor mixing in some of the other parameters, so I wondered if I could use Stan for those parameters and keep the library-based sampler as well.
Quick Google search reveals ... I'm not sure what. From this post on the Stan Google group, the following quotes are pertinent in answer to a question about (I thought) using HMC together with another type of sampler for one of the parameters. It seems the questioner has either a hierarchical or discrete model (both bad for Stan) and that in the later quotes it appears I could alternate Stan with RWMetropolis. Read on... This page discusses use of the commands saveRDS() and readRDS() as replacements for save() and load()
I found a few decent-looking and highly-upvoted responses, but I ended up going with one on this page. A screenshot of the described solution is below. I had slightly different navigation than described below, but this gets me there.
See these slides. (Reproduced below). Slide 11/68 explains how to include RcppArmadillo. Just install the package 'RcppArmadillo' like a normal package in RStudio. Then New-->C++ file will pull up the C++ file template in RStudio. Replace #include <Rcpp.h> with #include <RcppArmadillo.h> and add in // [[Rcpp::depends(RcppArmadillo)]] and you're all set. I was looking into the use of Stan for Hamiltonian Monte Carlo. On page 23 of the Stan reference (stan-reference-2.9.0.pdf), I found this excellent and brief summary of HMC: HMC accelerates both convergence to the stationary distribution and subsequent parameter exploration by using the gradient of the log probability function. The un- known quantity vector θ is interpreted as the position of a fictional particle. Each iteration generates a random momentum and simulates the path of the particle with potential energy determined [by] the (negative) log probability function. Hamilton’s decom- position shows that the gradient of this potential determines change in momentum and the momentum determines the change in position. These continuous changes over time are approximated using the leapfrog algorithm, which breaks the time into discrete steps which are easily simulated. A Metropolis reject step is then applied to correct for any simulation error and ensure detailed balance of the resulting Markov chain transitions (Metropolis et al., 1953; Hastings, 1970). Immediately after that, the tuning parameters are discussed: Basic Euclidean Hamiltonian Monte Carlo involves three “tuning” parameters to which its behavior is quite sensitive. Stan’s samplers allow these parameters to be set by hand or set automatically without user intervention. To change equation numbering between the right and left side, I found a solution which just modifies a simple argument in the \documentclass:
e.g. \documentclass[reqno]{article} for "right equation numbers" or \documentclass[leqno]{article} for "left equation numbers" link here [WARNING] This actually ended up causing problems for my Intellij / github working together.
You type in various characteristics of your project and it produces a .gitignore file. e.g. Java OSX Intellij https://www.gitignore.io/
From http://stackoverflow.com/questions/28761323/how-to-include-external-library-boost-into-clion-c-project-with-cmake
Essentially I modified the default CMakeLists.txt file to be: |
Categories
All
Archives
December 2016
AboutThis blog is mainly for statistics, R, or Duke-related stuff that is not directly relating to research activity. |