Skip to content

Instantly share code, notes, and snippets.

View trappmartin's full-sized avatar
🧗

Martin Trapp trappmartin

🧗
View GitHub Profile

THIS Guide is all you need - (Vienna ed.)

Some general remarks, the list below is a collection of suggestions where to go/what to do when visiting Vienna. Consider this list to be incomplete!

Money: Make sure to bring some cash with you. Vienna is increasingly more cash-free but it is still far away from that.

Safety: Vienna is generally safe. However, there are regular cases of pickpocketing in the city center, so be aware. Some districts further outside the city can be unsafe at night (e.g., Favoriten and Floridsdorf).

Commute: If you commute for a couple of days, make sure to check "Wiener Linien" for their options on tickets. The cheapest option for a longer stay is the "8-days climate ticket" (8-Tage-Klimakarte) which is essentially a collection of 8 independent one-day tickets that you can validate as you like, e.g., share with others or reuse during a second visit.

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
from sklearn.svm import SVC
classifier = SVC(gamma=2, C=1, random_state=42, probability=True)
dataset = make_moons(noise=0.3, random_state=0)
figure = plt.figure()
julia> function decToBin(n)
if n > 0
x = decToBin(n ÷ 2)
return x === nothing ? [n % 2] : append!(x, n % 2)
end
end
decToBin (generic function with 1 method)
julia> decToBin(4)
3-element Vector{Int64}:
### A Pluto.jl notebook ###
# v0.19.9
using Markdown
using InteractiveUtils
# ╔═╡ 07034ef4-037e-11ee-30e6-37d72cee1635
using Plots, Distances, Statistics, Random, LaTeXStrings
# ╔═╡ dd352de2-0119-4562-b22c-39c2575bf721
# Collect all sum nodes.
snodes = filter(n -> isa(n, SumNode), values(spn))
# option 1
# Create an initial values.
q1 = mapreduce(n -> n.logweights[:], vcat, snodes)
# Helper function used by ForwardDiff.
function f1(θ)
@trappmartin
trappmartin / imm.jl
Last active August 28, 2020 17:02
infinite mixture model in Turing
using Turing
using Turing.RandomMeasures
# Implementation of infinite mixture model
@model function imm(y, α, ::Type{T}=Vector{Float64}) where {T}
N = length(y)
nk = tzeros(Int, N)
z = tzeros(Int, N)
for i in 1:N
using Turing
# This is a crappy implementation of Isabel's model.
# For simplicity, I assume all data to be positiv-real valued.
# Isabel's paper: http://proceedings.mlr.press/v70/valera17a/valera17a.pdf
@model function adst(y, ::Type{TV}=Vector{Float64}) where {TV}
N,D = size(y)
using Turing
@model function ibp(y, α, kmax, ::Type{MV}=Vector{Float64}) where {MV}
N = length(y)
ks = tzeros(Int, N)
ks[1] ~ Poisson(α)
ks[1] = ks[1] <= kmax ? ks[1] : kmax
z = tzeros(Int, N, kmax)
using Turing
using Bijectors
using LinearAlgebra
Bijectors.bijector(d::LKJ) = PDBijector()
@model function correlation(y)
N,D = size(y)
mu ~ filldist(truncated(Normal(0, 100), -10, 10), D)
using DrWatson
@quickactivate "DynamicPPL_NeurIPS"
using Turing
using LinearAlgebra
using Random: seed!
seed!(1)
@model testmodel(p, O) = begin
x ~ Categorical(p)