Skip to content

Instantly share code, notes, and snippets.

View adrianseeley's full-sized avatar

Adrian Seeley adrianseeley

View GitHub Profile
@adrianseeley
adrianseeley / LTTBD.cs
Created May 3, 2015 13:22
Largest-Triangle-Three Bucket Downsampling Graphs in C# (For an Array of Floats) http://i.imgur.com/UwhvV45.png
public float[] Downsample(float[] array, int Length)
{
int insert = 0;
float[] window = new float[Length];
float[] window_x = new float[Length];
int bucket_size_less_start_and_end = Length - 2;
float bucket_size = (float)(array.Length - 2) / bucket_size_less_start_and_end;
int a = 0;
int next_a = 0;
@adrianseeley
adrianseeley / Program.cs
Last active August 29, 2015 14:16
Kaggle OCR KNN K=10 From Scratch (http://www.kaggle.com/c/digit-recognizer) Score: 0.89843
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Kaggle_OCR_KNN
{
class Program
@adrianseeley
adrianseeley / oryql.cs
Last active August 29, 2015 14:16
oryql rg
List<KeyValuePair<float, string>> train_documents =
csv.read_train_documents(
new Dictionary<string, float>() {
{"A", 0f},
{"T", 0f},
{"Y", 1f},
{"N", -1f},
{"U", 0f},
{"L", 0f},
}, @"C:\Users\Admin\Desktop\stash\document_train.csv",
@adrianseeley
adrianseeley / EaseManagerScript.cs
Created January 2, 2015 12:52
EaseManagerScript.cs For Unity
using UnityEngine;
using System.Collections;
public class EaseManagerScript : MonoBehaviour {
public float LINEAR (float current_step, float total_steps, float start_value, float value_change) {
return value_change * (current_step / total_steps) + start_value;
}
public float SIN_IN (float current_step, float total_steps, float start_value, float value_change) {
return -value_change * Mathf.Cos(current_step / total_steps * (Mathf.PI / 2)) + value_change + start_value;
}
@adrianseeley
adrianseeley / msago.js
Last active August 29, 2015 14:05
MS to Time Ago
function msago (ms) {
function suffix (number) { return ((number > 1) ? 's' : '') + ' ago'; }
ms = new Date().getTime() - ms.getTime();
var temp = ms / 1000;
var years = Math.floor(temp / 31536000);
if (years) return years + ' year' + suffix(years);
var days = Math.floor((temp %= 31536000) / 86400);
if (days) return days + ' day' + suffix(days);
var hours = Math.floor((temp %= 86400) / 3600);
if (hours) return hours + ' hour' + suffix(hours);
@adrianseeley
adrianseeley / 7 4 Shoreline
Last active November 18, 2018 14:39
Guitar
[Intro]
E
E C#m (8x)
[Chorus]
E C#m
It's a shoreline
E C#m
And it's high speed
E C#m
@adrianseeley
adrianseeley / Honey.cs
Last active August 29, 2015 14:01
“Sway” Trained Sinus Activated Neural Networks - Monte Carlo Exploration of Optimization Volumes (C#, IRIS, GATO2014)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;
@adrianseeley
adrianseeley / knn.js
Created May 13, 2014 12:43
KNN RE:FERNANDO
var fs = require('fs');
function raw_to_json () {
var raw_txt = fs.readFileSync('raw.txt', 'utf8');
raw_txt = raw_txt.split('\r\n');
for (var line = 0; line < raw_txt.length; line++) {
raw_txt[line] = raw_txt[line].split(' ');
for (var component = 0; component < raw_txt[line].length; component++)
raw_txt[line][component] = parseFloat(raw_txt[line][component]);
}
@adrianseeley
adrianseeley / GPU_MSDA_FF_ANN.html
Last active April 27, 2021 18:18
A Sinus Activated Multi-Stochastic-Descending/Ascending (MSD/A) Feed Forward Artificial Neural Network (ANN) Computed by GPU via JavaScript and WebGL GLSL (GATO 2014) :: Fiddle: http://jsfiddle.net/Hnv8H/
<!DOCTYPE html>
<html>
<pre id="page" style="font-family: monospace; white-space: pre-wrap;">
<h3>A Sinus Activated Multi-Stochastic-Descending/Ascending (MSD/A) Feed Forward Artificial Neural Network (ANN) Computed by GPU via JavaScript and WebGL GLSL (GATO 2014)</h3>This web page attempts to outline an implementation for solving non-linearly-separable (NLS) classification and function approximation problems using a sinus activated feed forward neural network, trained via multi-stochastic-descension/ascension (MSD/A), and evaluated using the GPU via JavaScript and WebGL GLSL source code.
In order to overcome NLS using MSD/A, a sinus activation function: <b>sin(x)</b>, has been used in place of sigmoid: <b>1 / (1 + exp(-x))</b>, hyper-tangent: <b>htan(x)</b>, and/or averaging: <b>sum / count</b>, activation functions.
Although ANNs capable of overcoming NLS problems are said to be capable of entering any computationally complete state, actually finding and entering a specific state required to solve a real
@adrianseeley
adrianseeley / glutil.js
Last active March 22, 2023 06:10
QP GPU (queue-pee gee-pee-you, or just Q-P for short) Quantum Particles via Graphics Processing Unit
window.onerror = function (msg, url, lineno) {
alert(url + '(' + lineno + '): ' + msg);
}
function createShader (str, type) {
var shader = gl.createShader(type);
gl.shaderSource(shader, str);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
throw gl.getShaderInfoLog(shader);