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
(ns types.datahike-unify | |
(:require [datahike.api :as d])) | |
;; Schema Definition | |
(def schema | |
[{:db/ident :type/const | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one} | |
{:db/ident :type/type-app | |
:db/valueType :db.type/ref |
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
(ns openai.example | |
(:require [clojure.java.io :as io] | |
[libpython-clj2.require :refer [require-python]] | |
[libpython-clj2.python :refer [py. py.. py.-] :as py] | |
[taoensso.timbre :as log])) | |
(require-python '[openai :refer [OpenAI]]) | |
(def client (OpenAI :api_key "...")) |
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 DifferentialEquations | |
using Distributions | |
using Flux, DiffEqFlux | |
using Flux.Tracker | |
function f(z, p) | |
α, β = p | |
tanh.(α.*z .+ β) | |
end |
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
(ns autodiff.forward | |
"Experiments for forward differentiation.") | |
;; Alternative idea: encode tabular SSA structure of Griewank chapter 3.1 | |
;; Questions: | |
;; what SSA representation is good to implement compiler optimizations? | |
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
(ns anglican.runtime$macros | |
"Runtime library" | |
(:require [clojure.string :as str] | |
[clojure.core.matrix :as m] | |
[clojure.core.matrix.linear :as ml] | |
[anglican.runtime :refer [distribution]] | |
#?(:cljs [goog.string.format])) | |
) |
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
(def accounts | |
(into {} (for [i (range 1000001)] | |
[i (ref 1000)]))) | |
(time | |
(let [fs (dotimes [offset 10] | |
(future | |
(doseq [i (shuffle (range (* offset 100000) | |
(* (inc offset) 100000)))] | |
(dosync |
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 torch | |
import torch.nn.functional as F | |
import torch.autograd as autograd | |
import torch.optim as optim | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.gridspec as gridspec | |
import os | |
import math | |
from torch.autograd import Variable |
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
(let [f (fn [args] | |
(let [w1 (nth args 0) | |
w2 (nth args 1) | |
x (nth args 2) | |
y (nth args 3) | |
h1 (mmul w1 x) | |
h2 (mmul w2 h1) | |
;; TODO dot with vector of ones yields sum | |
;; this is euclidian distance or squared error | |
error (** (- (dot [1 1] h2) y) 2)] |
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
(ns clj-antidote.core | |
(:import [eu.antidotedb.client AntidoteClient Host | |
BatchRead BatchReadResult Bucket CounterRef | |
InteractiveTransaction SetRef])) | |
(def client (AntidoteClient. [(Host. "localhost" 8087)])) | |
(def bucket (Bucket/create "testbucket")) |
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
(ns datanaive.core) | |
;; https://courses.cs.washington.edu/courses/cse544/16au/lectures/lecture05-datalog.pdf | |
;; slide 7 | |
;; Actor(344759,‘Douglas’, ‘ Fowley ’). | |
;; Casts(344759, 29851). | |
;; Casts(355713, 29000). | |
;; Movie(7909, ‘A Night in Armour ’, 1910). |
NewerOlder