Skip to content

Instantly share code, notes, and snippets.

View fredericlam's full-sized avatar

LAM Frédéric fredericlam

  • International Agency for Research on Cancer
  • Lyon
View GitHub Profile
@primaryobjects
primaryobjects / perceptron.js
Last active October 5, 2022 00:37
Perceptron in JavaScript, a simple example. Neural network. See https://jsfiddle.net/qu960cc2/1/
function Perceptron(opts) {
if (!opts) opts = {}
var debug = 'debug' in opts ? opts.debug : false;
var weights = 'weights' in opts
? opts.weights.slice()
: []
var threshold = 'threshold' in opts
@matt-west
matt-west / pearson-correlation.js
Created September 9, 2013 20:24
Pearson Correlation (JavaScript)
/**
* @fileoverview Pearson correlation score algorithm.
* @author matt.west@kojilabs.com (Matt West)
* @license Copyright 2013 Matt West.
* Licensed under MIT (http://opensource.org/licenses/MIT).
*/
/**
* Calculate the person correlation score between two items in a dataset.
@chrisle
chrisle / simple_google_analytics.rb
Last active February 16, 2023 07:30
My simple Google Analytics API export API. Exports GA data as an array of flattened hashes with a SHA1 signature. No DSL, no sugar.
require 'digest'
# = simple_google_analytics.rb
#
# Chris Le <chris at iamchrisle dot com>
#
# This module is an wrapper to export data from Google Analytics as a flattened
# hash suitable for database storage. It does not require any other gems other
# than 'oauth'. I used this simply to get metrics and directly store them in
# a database.