View decision_tree.rs
//use serde::{Serialize, Deserialize}; | |
use std::collections::HashMap; | |
// If you have serde, serialization is available with this derive chain: | |
//#[derive(Clone, Debug, Default, Serialize, Deserialize)] | |
#[derive(Clone, Debug, Default)] | |
pub struct DecisionTree { | |
feature: usize, | |
threshold: f32, |
View basic_backprop.py
import numpy | |
import random | |
class Graph: | |
def __init__(self): | |
self.nodes = list() | |
self.last_tape = None | |
def forward(self, variables, output_node): | |
for n in self.nodes: | |
n.forward(variables) |
View owa.tracker-combined-latest.minified.js
(function(exports) { | |
if (!this.JSON) { | |
this.JSON = {}; | |
} | |
(function() { | |
"use strict"; | |
function f(n) { | |
return n < 10 ? "0" + n : n; | |
} | |
if (typeof Date.prototype.toJSON !== "function") { |
View gan.py
import numpy | |
from pathlib import Path | |
import sys | |
import torch | |
from torch import nn | |
import torchvision | |
from torchvision import datasets | |
from torchvision import transforms |
View CameraController.gd
extends Camera | |
export var follow_target_path:NodePath = "" | |
var follow_target:Node | |
export var follow_distance:float = 5.0 | |
export var follow_height:float = 1.0 | |
export var mouse_sensitivity_x:float = 0.005 | |
export var mouse_sensitivity_y:float = 0.005 | |
var last_mouse_delta:Vector2 = Vector2() |
View sketch_artist.py
import numpy | |
import picamera | |
import picamera.array | |
import random | |
import RPi.GPIO as GPIO | |
from time import sleep | |
camera_width = 320 | |
camera_height = 240 | |
arma_pin = 32 |
View lineseekablefile.py
class LineSeekableFile: | |
def __init__(self, seekable): | |
self.fin = seekable | |
self.line_map = list() # Map from line index -> file position. | |
self.line_map.append(0) | |
while seekable.readline(): | |
self.line_map.append(seekable.tell()) | |
def __getitem__(self, index): | |
# NOTE: This assumes that you're not reading the file sequentially. For that, just use 'for line in file'. |
View unionfind.rs
/* | |
UnionFind.rs | |
A simple single-file UnionFind/Disjoint-Set implementation. | |
AUTHOR: Joseph Catrambone <jo.jcat@gmail.com> (c) 2019 | |
LICENSE: MIT | |
/// Example Usage: | |
/// | |
/// ``` | |
/// let uf = UnionFind::<char>::new(); |
View 10958Search.py
# -*- coding: utf-8 -*- | |
""" | |
(c) 2019 Joseph Catrambone, Xoana LTD. Releasewd under MIT License. | |
""" | |
# Create 10958 using, in order, 1, 2, 3, 4, 5, 6, 7, 8, 9. | |
# Let's phrase this as a search problem. | |
# Concat only applies if the underlying operands are digits, not products. I.e, one could go concat(1, 2) -> 12, but not concat(1+2, 3) -> 33. |
View depth_guess.py
#!/usr/bin/env python | |
from PIL import Image | |
from glob import iglob | |
import h5py | |
import tensorflow as tf | |
import numpy | |
import logging | |
import itertools |
NewerOlder