Skip to content

Instantly share code, notes, and snippets.

@dniku
dniku / lenet_solver_modified.prototxt
Created March 22, 2015 20:34
official example modified for image size 12x12
# The train/test net protocol buffer definition
net: "lenet_train_test_modified.prototxt"
# test_iter specifies how many forward passes the test should carry out.
# In the case of MNIST, we have test batch size 100 and 100 test iterations,
# covering the full 10,000 testing images.
test_iter: 100
# Carry out testing every 500 training iterations.
test_interval: 500
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.01
@dniku
dniku / lenet_train_test_modified.prototxt
Created March 22, 2015 20:34
official example modified for image size 12x12
name: "LeNet"
layers {
name: "mnist"
type: IMAGE_DATA
top: "data"
top: "label"
image_data_param {
source: "mnist_train_index.txt"
batch_size: 64
is_color: false
I0322 23:04:55.893093 32722 caffe.cpp:117] Use CPU.
I0322 23:04:55.894064 32722 caffe.cpp:121] Starting Optimization
I0322 23:04:55.894438 32722 solver.cpp:32] Initializing solver from parameters:
test_iter: 100
test_interval: 500
base_lr: 0.01
display: 100
max_iter: 10000
lr_policy: "inv"
gamma: 0.0001
require 'matrix'
class Vector
public :"[]="#, :set_element, :set_component
def norm_inf
return (self.map {|x| x.abs}).max
end
def clone
@dniku
dniku / h.pi
Last active August 29, 2015 14:17
Problem H from VK wild-card round #1. The language is Picat.
import cp.
main =>
N = read_int(),
X = new_array(N),
Y = new_array(N),
foreach(I in 1..N)
X[I] := read_int(),
Y[I] := read_int()
end,
@dniku
dniku / i.pi
Last active August 29, 2015 14:17
Problem I from VK wild-card round #1. The language is Picat. This solution fails with WA #18.
import cp.
read_list=List =>
L=[],
Len=read_int(),
foreach(I in 1..Len)
V := read_int(),
L := [V|L]
end,
List=L.
double svm_predict_probability(
const svm_model *model, const svm_node *x, double *prob_estimates)
{
if ((model->param.svm_type == C_SVC || model->param.svm_type == NU_SVC) &&
model->probA!=NULL && model->probB!=NULL)
{
int i;
int nr_class = model->nr_class;
double *dec_values = Malloc(double, nr_class*(nr_class-1)/2);
svm_predict_values(model, x, dec_values);
@dniku
dniku / owncloud-cron-crash.log
Created April 6, 2015 11:08
php -f cron.php
PHP Warning: flock() expects parameter 1 to be resource, boolean given in /var/www/localhost/htdocs/owncloud/lib/private/config.php on line 178
PHP Fatal error: Call to a member function getValue() on a non-object in /var/www/localhost/htdocs/owncloud/lib/private/legacy/config.php on line 46
@dniku
dniku / mnist_loader_sklearn.py
Last active August 29, 2015 14:19
Dumping MNIST digits as images in a separate folder
from __future__ import division, print_function
import os
import cv2
import numpy as np
from sklearn.datasets import fetch_mldata
from sklearn.cross_validation import train_test_split
@dniku
dniku / solver.prototxt
Created April 13, 2015 17:46
Lenet solver which reports more often
# The train/test net protocol buffer definition
net: "lenet_train_test.prototxt"
# test_iter specifies how many forward passes the test should carry out.
# In the case of MNIST, we have test batch size 100 and 100 test iterations,
# covering the full 10,000 testing images.
test_iter: 100
# Carry out testing every 20 training iterations.
test_interval: 20
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.01