Skip to content

Instantly share code, notes, and snippets.

diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt
index d728714..5ca1eae 100644
--- a/docs/ref/models/meta.txt
+++ b/docs/ref/models/meta.txt
@@ -165,7 +165,12 @@ These old APIs can be replicated by either:
``_with_model`` variants) the properties of the desired fields.
Assuming you have a model named ``MyModel``, the following substitutions
-can be made to convert your code to the new API:
+can be made to convert your code to the new API.
Benchmark Name Control Experiment Diff
url_resolve_flat_i18n_off 0.3300260305 0.3059779525 0.0240480781 (7.29% faster)
query_prefetch_related 0.0989829183 0.0927800298 0.0062028885 (6.27% faster)
query_select_related 0.0537939668 0.0502726555 0.0035213113 (6.55% faster)
query_raw 0.0156183600 0.0146648049 0.0009535551 (6.11% faster)
l10n_render 0.0068216324 0.0066468954 0.0001747370 (2.56% faster)
query_raw_deferred 0.0157507062 0.0155839086 0.0001667976 (1.06% faster)
query_exists 0.0012296319 0.0011273146 0.0001023173 (8.32% faster)
query_count 0.0003048658 0.0002639174 0.0000409484 (13.43% faster)
package main
import "fmt"
type Result struct {
Class string
Score float64
}
type ResultSet []*Result
from collections import defaultdict
import glob
import json
import unittest
import numpy as np
class Station(object):
def __init__(self, name, latitude, longitude):
import json
import re
from collections import defaultdict
FIRST_NUMBER = re.compile('\s\d')
def main(file, type_name):
connections = defaultdict(list)
with open(file) as f:
for line in f.readlines():
@PirosB3
PirosB3 / gist:22df07d31eca7799b2a1
Created December 17, 2014 23:38
k_nearest_neighbours
use std::collections::HashMap;
use std::num::Float;
struct KNNClassifier<'a> {
data: &'a [[f64, ..4]],
targets: &'a [int],
}
impl<'a> KNNClassifier<'a> {
use std::io;
use std::io::BufferedReader;
use std::collections::HashMap;
use std::io::File;
use std::rand::{task_rng, Rng};
struct MarkovModels<'a> {
data: HashMap<(&'a str, &'a str), Vec<&'a str>>,
words: &'a [&'a str]
}
use std::io::BufferedReader;
use std::collections::HashMap;
use std::io::File;
use std::rand::{task_rng, Rng};
struct MarkovModels<'a> {
data: HashMap<(&'a str, &'a str), Vec<&'a str>>,
words: &'a Vec<&'a str>
}
@PirosB3
PirosB3 / gist:81047a463d687034e5d1
Created December 4, 2014 17:11
SMO SVM Python implementation
def smoSimple(dataIn, classLabels, C, tolerance, maxIter):
dataMatrix = mat(dataIn)
labelMat = mat(classLabels).T
m, n = shape(dataMatrix)
alphas = mat(zeros((m,1)))
bias = 0
iter = 0
while (iter < maxIter):
copy(to_visit))