Instantly share code, notes, and snippets.

# Sergey Bartunov sbos

Last active October 19, 2022 04:06
Simple linear SVM using quadratic programming
This file contains 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 numpy as np from cvxopt import matrix, spmatrix from cvxopt.solvers import qp from cvxopt import solvers class LinearSVM(): def __init__(self, C): self.C = C def fit(self, data, labels):
Created July 1, 2018 14:28
This file contains 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
 Снова учитель что-то Пытается нам объяснять Мне случать его неохота Мне хочется погулять Я после звонка наплевала На следующий урок Сломала окно и сьежала Слушать тюменский панк-рок
Created November 1, 2013 11:25
Hidden Markov Model in Julia
This file contains 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
 module HMM using Distributions import Distributions.rand import Distributions.fit immutable HiddenMarkovModel{TP, K} theta::Vector{TP} A::Matrix{Float64}
Last active October 22, 2016 18:04
This file contains 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
 function write_word2vec(path::AbstractString, vm::VectorModel, dict::Dictionary) fout = open(path, "w") sense_prob = zeros(T(vm)) write(fout, "\$(V(vm)) \$(T(vm)) \$(M(vm))\n") for v in 1:V(vm) write(fout, "\$(dict.id2word[v])\n") expected_pi!(sense_prob, vm, v) for k in 1:T(vm) if sense_prob[k] < 1e-3 continue end write(fout, "\$k \$(sense_prob[k]) ")
Created June 25, 2013 15:18
build-error.log
This file contains 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
 ==> Using Homebrew-provided fortran compiler. This may be changed by setting the FC environment variable. ==> Cloning https://github.com/JuliaLang/julia.git git --git-dir /Library/Caches/Homebrew/julia--git/.git status -s Updating /Library/Caches/Homebrew/julia--git git config remote.origin.url https://github.com/JuliaLang/julia.git git config remote.origin.fetch +refs/heads/master:refs/remotes/origin/master git fetch origin git checkout -f master Already on 'master'
Created December 15, 2015 04:03
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created November 26, 2015 13:30
This file contains 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 theano as th import theano.tensor as T import lasagne import numpy as np from theano.tensor.shared_randomstreams import RandomStreams from lasagne.nonlinearities import tanh import matplotlib.pyplot as plt import sys # change to True and see what happens
Created October 24, 2015 05:01
This file contains 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 cgt import cgt.nn as nn import numpy as np batch = 5000 mean = 0. for i in xrange(batch): mean += (cgt.randn() - mean) / (i+1)
Last active October 21, 2015 21:27
This file contains 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 cgt import cgt.nn as nn import numpy as np from scipy.stats import norm def gaussian_density(x, mu, sigma): return cgt.exp(-cgt.square(x - mu) / 2 / cgt.square(sigma)) \ / cgt.sqrt(2 * np.pi) / sigma var_mu = nn.parameter(np.array(0.5))
Created October 20, 2015 19:36
This file contains 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 cgt import cgt.nn as nn import numpy as np from scipy.stats import norm def gaussian_density(x, mu, sigma): return cgt.exp(-cgt.square(x - mu) / 2 / cgt.square(sigma)) \ / cgt.sqrt(2 * np.pi) / sigma var_mu = nn.parameter(np.array(0.5))