Skip to content

Instantly share code, notes, and snippets.

View ZachWolpe's full-sized avatar

Zach Wolpe ZachWolpe

  • Medibio
View GitHub Profile
visualize <- function(data, c1='white', c2='#779ecb') {
data %>%
ggplot(aes(x=x, y=y, fill = factor(z))) +
geom_raster() +
scale_fill_manual(breaks = levels(factor(data$z)),
values = c(c1, c2)) +
theme(legend.position = 'none',
axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank(),
library(ggplot2)
library(tidyverse)
Rule30 <- function(half_len, iterations) {
# Functional Rules
half_len <- 2*half_len
a = c('111', '110', '101', '100', '011', '010', '001', '000')
library(ggplot2)
library(tidyverse)
Rule30 <- function(half_len, iterations) {
# Functional Rules
half_len <- 2*half_len
a = c('111', '110', '101', '100', '011', '010', '001', '000')
library(ggplot2)
library(tidyverse)
Rule30 <- function(half_len, iterations) {
colours = [['R','G','G','R','R'],
['R','R','G','R','R'],
['R','R','G','G','R'],
['R','R','R','R','R']]
measurements = ['G','G','G','G','G']
motions = [[0,0],[0,1],[1,0],[1,0],[0,1]]
localization = localization(colours=colours, measurements=measurements, motions=motions, sensor_right=0.7, p_move=0.8)
posterior = localization.compute_posterior()
localization.show(posterior)
class localization():
"""Performing Bayesian Updating to Produce a Distribution of Likely Positions in the Environment"""
def __init__(self, colours, measurements, motions, sensor_right, p_move):
self.world = colours
self.measurements = measurements
self.motions = motions
self.sensor_right = sensor_right
self.p_move = p_move
# generate random Gene sequence
def generateParent(length):
genes = list("")
for i in range(0,length):
geneIndex = np.random.randint(0, len(geneset) -1);
genes.append(geneset[geneIndex])
return(''.join(genes))
import numpy as np
import datetime
import time
# Encode Binary
# genotypical_phenotype_latent_representation = bin(int.from_bytes(target.encode(), 'big'))
geneset = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!."
def stochastic_decryption_oscillator():
#__________________________________ Required libraries ______________________________________
library(rtweet)
library(dplyr)
library(tidytext)
library(tidyr)
library(NLP)
library(syuzhet)
library(tm)
#__________________________________ Required libraries ______________________________________
library(rtweet)
library(dplyr)
library(tidytext)
library(tidyr)
library(NLP)
library(syuzhet)
library(tm)
library(SnowballC)
library(stringi)