Skip to content

Instantly share code, notes, and snippets.

View kyledacones's full-sized avatar

Kyle Dacones kyledacones

  • Seattle, WA
View GitHub Profile
@kyledacones
kyledacones / linear_regression.sql
Last active December 29, 2021 05:54 — forked from patrickpissurno/linear_regression.sql
Linear Regression Functions for Gathering Inputs/ Implementing a Forecasting Model to PostgreSQL
-- This code is based on my other Gist "Simple linear regression in Javascript" (https://gist.github.com/patrickpissurno/ea0dc4039f075fbaf398619761bd9044)
-- There might be a more efficient way to do this in SQL
-- This function is resposible for computing the weights for the ax + b equation
CREATE OR REPLACE FUNCTION linear_regression(x_array decimal(15,2)[], y_array decimal(15,2)[]) RETURNS decimal(15,2)[] AS $$
DECLARE
slope decimal(15,2);
intercept decimal(15,2);
n integer;
@kyledacones
kyledacones / Requirements-Document-Draft-1-1.md
Created July 31, 2020 22:36
This is the first draft of the basic requirements for the application

Create the Requirements Document

Overview

Problem statement

Describe the problem you're trying to solve by doing this work.

Proposed work