Skip to content

Instantly share code, notes, and snippets.

View dmarx's full-sized avatar

David Marx dmarx

View GitHub Profile
#@title Prompts
prompts = {
0:"unfortunate failed crayon drawing sketched while drunk looks awful, should have thrown it away, badly drawn crayon sketch of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five year old could've drawn this",
50:"unfortunate failed crayon drawing sketched while drunk looks awful, should have thrown it away, badly drawn crayon sketch CARICATURE of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five year old could've drawn this",
150:"crayon drawing sketched while drunk looks awful, should have thrown it away, badly drawn crayon sketch of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five year old could've drawn this",
200:"crayon drawing sketched while drunk, hastily drawn crayon sketch of bill murray scribbled by a child while having a stroke seizure, wouldnt even put this on my fridge, by five ye
"""
It looks like the Scene and Storyboard classes are intended to be used for creating animations by specifying keyframed curves for various parameters. The Scene class appears to allow users to specify the length of the scene and set keyframed curves for various attributes of the scene. The Storyboard class then allows users to create a sequence of Scene objects and specify default values for attributes that are not explicitly set in a given scene.
It looks like the KeyframedObject class is a subclass of the Keyframed class from the keyframed module, which provides some basic functionality for working with keyframed curves. The KeyframedObject class adds a weight attribute to the Keyframed class, which specifies the weight of the object when it is used in a storyboard.
The to_keyframed function provides a convenient way to convert various types of input into Keyframed objects, which can then be used as attributes in a Scene object. This function allows users to specify keyframed curves using strings, d
@dmarx
dmarx / perlin-noise.ipynb
Created February 14, 2022 08:06 — forked from adefossez/perlin-noise.ipynb
Perlin noise.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dmarx
dmarx / staged_classifiers_for_unknown_classes.r
Last active August 26, 2018 09:48
Demonstration of using a simple "two stage" strategy to handle classification that supports an "unknown" class that may contain arbitrarily many true subclasses.
library(MASS)
library(rpart)
random_pos_def_matrix = function(n){
# https://math.stackexchange.com/a/358092/109246
A = matrix(runif(n*n), n)
A = 0.5*(A+t(A))
A + n*diag(n)
}
library(tidyr) # just for gather()
simulate <- function(formulas
,obs_per_cell = 100
,n_cells_per_group = 3
,amp_mu = 50
,amp_sd = 1 # this is only thing that impacts sd
,true_effect = 3
,error_sd = 1
){
install.packages('doParallel')
library(igraph)
library(foreach)
library(doParallel)
stopCluster(cl)
cl <- makeCluster(8)
registerDoParallel(cl)
sj_alg <- function(G){
@dmarx
dmarx / find_best_cutoff.r
Created August 9, 2017 12:11
Demonstration of how to construct a bespoke regression to determine the optimal cutoff value for constructing a categorical variable for a logistic regression
# Finding best cut-off for constructing a categorical variable
# logistic regression
data(iris)
x0 = iris[iris$Species != 'setosa',]
plot(x0, col=x0$Species)
# Keep things simple for this demo
form = "is_virginica ~ Petal.Length + Petal.Width"
@dmarx
dmarx / mcglm.r
Last active July 3, 2017 19:27
Playing with `mcglm` for a multivariate poisson model. Not sure how to extract the inter-DV covariance.
# From the docs for mcglm::ahs
require(mcglm)
data(ahs, package="mcglm")
form1 <- Ndoc ~ income + age
form2 <- Nndoc ~ income + age
Z0 <- mc_id(ahs)
fit.ahs <- mcglm(linear_pred = c(form1, form2),
matrix_pred = list(Z0, Z0), link = c("log","log"),
@dmarx
dmarx / demo.r
Last active June 28, 2017 23:37
Demonstration of a method for evaluating the performance of a poisson regression by calculating the bootstrapped accuracy subject to a range of error thresholds
##########################################################
# Get data from the poisson demo at: #
# https://stats.idre.ucla.edu/r/dae/poisson-regression/ #
##########################################################
p <- read.csv("https://stats.idre.ucla.edu/stat/data/poisson_sim.csv")
p <- within(p, {
prog <- factor(prog, levels=1:3, labels=c("General", "Academic",
"Vocational"))
id <- factor(id)
@dmarx
dmarx / Makefile
Created June 21, 2017 20:31
Minimal working example for stackoverlfow question
DIRS := $(filter dir%, $(shell ls))
foo_sources := $(wildcard */source/foo.a)
foo_targets_prt := $(patsubst %.a, %.b, $(foo_sources))
foo_targets := $(subst source,target, $(foo_targets_prt))
bar_sources := $(wildcard */source/bar.a)
bar_x := $(patsubst %/bar.a, %/Y.a, $(bar_sources))
bar_y := $(patsubst %/bar.a, %/Z.a, $(bar_sources))
bar_targets := $(bar_x) $(bar_y)