Skip to content

Instantly share code, notes, and snippets.

View Millsky's full-sized avatar
🌮
🌮

Kyle Mills Millsky

🌮
🌮
  • Vibrent Health
  • Fairfax VA
View GitHub Profile
var curryAdd = (x) => (y) => return x + y;
@Millsky
Millsky / perceptron.py
Last active April 3, 2016 16:09
A Implementation of a single perceptron that predicts the output of a linear function
import numpy as np
inputs = np.array([[1],[100],[3],[30],[40]])
testSet = np.array([[10],[13],[19],[33],[1]])
outputs = np.array([[5],[203],[9],[63],[83]])
bias = 1
biasWeight = 1
#initWeights
weights = np.random.random()
function convertToIntArray(hex){
var bytes = [],
str;
for(var i=0; i<hex.length-1;i+=2){
bytes.push(parseInt(hex.substr(i, 2), 16))
}
import tensorflow as tf
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
x_learn = np.array([[1.000,2.000],
[10.000,2.0000],
[9.000,3.0000],
[5.000,8.000],
'use strict';
class example_component extends HTMLElement {
/* THIS RETURNS THE NAME OF OUR WEB COMPONENT */
static get is() {
return 'v-graph'
}
/* WE CAN SET UP GETS TO RETRIEVE THE ELEMENT NAMES BAM, EASY ! */
@Millsky
Millsky / binarySearchTree
Created March 22, 2017 00:55
A binary search tree with insert - non self balancing
class node {
value: any
left: any
right: any
height: number
balanceFactor(){
var bf = (this.right.height) - (this.left.height);
}
constructor(v,h) {
function sortTable(table,col){
if(table.nodeName != "TABLE"){
throw new Error("Node is not of type TABLE");
return;
}
/* DEEP CLONE WILL BREAK THE REF */
//table = table.cloneNode(true);
var rows = [].slice.call(table.tBodies[0].rows,1);
var tBody = table.tBodies[0];
/* SORT MAP AND REPLACE */
function observer() {
const data = {};
const callbacksObj = {};
const set = (property, value) => {
data[property] = value;
notify(property);
};
const notify = (property) => {
if(!property) {
throw new TypeError('Property "property" is not type string')
@Millsky
Millsky / functionalDataPipeline.js
Last active January 11, 2019 15:13
Clean Functional Service -> Transform -> Dispatch, with handling for cancellation, failure and success
import R from 'ramda';
import { task, of } from 'folktale/concurrency/task';
import hash from 'object-hash';
function processService(p) {
return p.data;
}
const getDataFailure = data => ({
type: 'FAILURE_TYPE',
/* Build an adjacency matrix for a super simple tree a -> b,c */
const m = [
[0, 1, 0, 0, 0],
[0, 0, 1, 1, 0],
[0, 0, 0, 0, 1],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
];
/* Data at each node */