This file contains hidden or 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
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); |
This file contains hidden or 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 cp. | |
read_list=List => | |
L=[], | |
Len=read_int(), | |
foreach(I in 1..Len) | |
V := read_int(), | |
L := [V|L] | |
end, | |
List=L. |
This file contains hidden or 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 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, |
This file contains hidden or 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
require 'matrix' | |
class Vector | |
public :"[]="#, :set_element, :set_component | |
def norm_inf | |
return (self.map {|x| x.abs}).max | |
end | |
def clone |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
from __future__ import division, print_function | |
from pprint import pprint | |
import glob | |
import caffe | |
MODEL_FILE = '../models/lenet.prototxt' | |
PRETRAINED_FILE = '../models/lenet_pretrained.caffemodel' | |
IMAGE_DIR = 'test' |
This file contains hidden or 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
def get_expansions(num, nterms): | |
result = [] | |
def run(cur_sum, cur_vals, remain): | |
if remain == 0: | |
if cur_sum == num: | |
result.append(tuple(cur_vals)) | |
return | |
elif remain == 1: | |
cur_vals.append(num - cur_sum) |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Sandbox</title> | |
</head> | |
<body> | |
<script src="sandbox.js"></script> | |
</body> |