Keybase proof
I hereby claim:
- I am tpgmartin on github.
- I am tpgmartin (https://keybase.io/tpgmartin) on keybase.
- I have a public key whose fingerprint is CF18 67A4 E835 30AE B77E A373 02C9 9A77 4754 85B0
To claim this, I am signing this object:
import nltk | |
import ssl | |
def download_dependencies(package_name=None): | |
try: | |
_create_unverified_https_context = ssl._create_unverified_context | |
except AttributeError: | |
pass | |
else: |
I hereby claim:
To claim this, I am signing this object:
# main.py | |
from scipy.spatial import distance | |
from collections import Counter | |
class KNN(): | |
def __init__(self, n_neighbors=1): | |
self.n_neighbors = n_neighbors | |
def fit(self, X_train, y_train): |
import org.saddle._ | |
object Main { | |
def main(args: Array[String]) { | |
// Requires *.sbt file including saddle dependency to run. Run from command line with `sbt run frame.scala` | |
val height: Series[String, Double] = Series("Male" -> 6.0, "Male" -> 5.92, "Male" -> 5.58, "Male" -> 5.92, | |
"Female" -> 5.0, "Female" -> 5.5, "Female" -> 5.42, "Female" -> 5.75) | |
val weight: Series[String, Double] = Series("Male" -> 180.0, "Male" -> 190.0, "Male" -> 170.0, "Male" -> 165.0, | |
"Female" -> 100.0, "Female" -> 150.0, "Female" -> 130.0, "Female" -> 150.0) |
const crypto = require('crypto') | |
class Block { | |
constructor(index, timestamp, data, previousHash) { | |
this.index = index | |
this.timestamp = timestamp | |
this.data = data | |
this.previousHash = previousHash | |
this.hash = this.hashBlock() |
const nj = require('numjs') | |
// The activation function of choice, for a given input x, the function will return either 0, if x < 0, or x. | |
// This is used to find the activation of the hidden layer nodes during forward propagation. | |
function relu(x) { | |
return iterator(x, x => ((x > 0) * x)) | |
} | |
// The derivative of the activation function above, this is used during the backward propagation and gradient descent process to find | |
// the updated for weights between the input and hidden layer nodes. | |
function reluDeriv(x) { |
class Network { | |
constructor(neuronsPerLayer = []) { | |
this.layers = neuronsPerLayer.length | |
this.neuronsPerLayer = neuronsPerLayer | |
this.biases = [] // call initialiseValues() | |
this.weights = [] // call initialiseValues() | |
} | |
// Train network with SGD |
function flatten(arr, flat) { | |
let output = !!flat ? flat : [] | |
arr.forEach((el) => { | |
if (typeof el === 'number') { | |
output.push(el) | |
} else { | |
flatten(el, output) | |
} |
function getElementsByClassName2(className) { | |
const nodes = [] | |
function crawl(node) { | |
if (node.classList && node.classList.value.indexOf(className) > -1) { | |
nodes.push(node) | |
} | |
node.childNodes.forEach((child) => | |
crawl(child) | |
) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.