This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
R Markdown, Population Sampling, & Confidence Intervals | |
======================================================== | |
Topics: | |
* Introduce R Markdown | |
* **Gain an intuitive understanding of the errors we introduce when we look at subsets of an entire population through:** | |
* population sampling | |
* linear models (coefficients, residuals, fitted.values) | |
* smoothScatter (example) | |
* confidence intervals |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timeit | |
def func(x, y): | |
return x**2 + y**2 | |
def wrapper(func, *args, **kwargs): | |
"""This enables using a function with arguments with timeit""" | |
def wrapped(): | |
return func(*args, **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### poly | |
How does poly work? | |
```{r} | |
a <- 1:10 | |
# Let's start easy | |
p <- poly(a, 3, raw=TRUE) | |
p | |
# This is easy to reproduce |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "IS 609 Homework 4" | |
author: "Aaron Palumbo" | |
date: "Saturday, September 20, 2014" | |
output: pdf_document | |
--- | |
Homework 4: | |
## Page 191: #3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# silly utility to launch a qtconsole if one doesn't exist | |
consoleFlag = True | |
consoleFlag = False # Turn on/off by commenting/uncommenting this line | |
import psutil | |
def returnPyIDs(): | |
pyids = set() | |
for pid in psutil.pids(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Entire R script | |
'''{r code=capture.output(cat(readLines('clustering_library.R'), sep='\n'))} | |
''' | |
A single function | |
'''{r code=capture.output(dump('initBuckets', ''))} | |
''' | |
note: replaced back ticks with forward ticks so the options would show up instead of being hidden. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pyprint(myfile, lexer_override=""): | |
from pygments import highlight | |
from pygments.lexers import PythonLexer, guess_lexer, get_lexer_by_name | |
from pygments.util import ClassNotFound | |
from pygments.formatters import HtmlFormatter | |
import IPython | |
try: | |
with open(myfile) as f: | |
code = f.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<button onclick="evaluateTags(this.parentElement)" | |
style="background-color:lightgreen">Run cells with tag</button> | |
<!-- SET TAG NAME BELOW: value="tagName" --> | |
<input type=text value="tagName"> | |
</div> | |
<script> | |
function evaluateTags(divElement) { | |
d3.select(divElement).select("button").attr("style", "background-color:indianred") | |
d3.select(divElement).selectAll("p").remove() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = np.array([[1, 2, 3]]) | |
np.mat(a) * np.mat(a).T # this can continue ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decorator_generator(**kw_dict): | |
def decorator(fun): | |
def decorated(*args, **kwargs): | |
kwargs.update(kw_dict) | |
return fun(*args, **kwargs) | |
return decorated | |
return decorator | |
@decorator_generator(c=3) | |
def foo(a, c): |
OlderNewer