Skip to content

Instantly share code, notes, and snippets.

@vulcan25
vulcan25 / run.py
Last active January 11, 2023 13:52
psycopg2 flask implementation with connection pooling support
from flask import Flask, g, jsonify
import werkzeug, os
from werkzeug.utils import secure_filename
import psycopg2
from psycopg2 import pool
def get_db():
print ('GETTING CONN')
if 'db' not in g:
@WillKoehrsen
WillKoehrsen / submit_assignment.py
Created March 10, 2018 20:26
Automation of Assignment Submisison
# selenium for web driving
import selenium
from selenium import webdriver
# time for pausing between navigation
import time
# Datetime for recording time of submission
import datetime
@dyerrington
dyerrington / overfitting_decision_trees.md
Created May 12, 2017 19:10
Re: Why are decision trees prone to overfitting, I’ll do my best --

Overfitting in decision trees

Overfitting can be one problem that describes if your model no longer generalizes well.

Overfitting happens when any learning processing overly optimizes training set error at the cost test error. While it’s possible for training and testing to perform equality well in cross validation, it could be as the result of the data being very close in characteristics, which may not be a huge problem. In the case of decision tree’s they can learn a training set to a point of high granularity that makes them easily overfit. Allowing a decision tree to split to a granular degree, is the behavior of this model that makes it prone to learning every point extremely well — to the point of perfect classification — ie: overfitting.

I recommend the following steps to avoid overfitting:

  • Use a test set that is not exactly like the training set, or different enough that error rates are going to be easy to see.
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active April 2, 2024 15:19
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@mbbx6spp
mbbx6spp / ALTERNATIVES.adoc
Last active April 25, 2024 15:14
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@victorb
victorb / app.js
Created September 24, 2013 16:37
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
@vgoklani
vgoklani / app.py
Last active December 19, 2022 09:13
Using Flask to output Python data to High Charts
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
@vincentarelbundock
vincentarelbundock / example_ols.ipynb
Created August 26, 2012 23:28
Statsmodels example: Ordinary least squares regression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@greezybacon
greezybacon / overloaded.py
Created June 21, 2012 20:51
Python overloaded method decorator
class overloaded(object):
"""
Simple (well, simple is relative) tool to allow for overloaded methods
in Python. Overloaded methods are methods with the same name that
receive different types of arguments. Statically typed languages such as
C++ support overloaded methods at compile time; however, dynamically
typed languages such as Python cannot support such methods, because no
type hints can be specified in the function definition.
This class operates as a decorator and allows for a cascaded design of