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 |
A warning occurred (42 apples) | |
An error occurred |
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'} |
var myApp = angular.module('myApp', []); | |
myApp.directive('googleplace', function() { | |
return { | |
require: 'ngModel', | |
link: function(scope, element, attrs, model) { | |
var options = { | |
types: [], | |
componentRestrictions: {} | |
}; |
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.
# 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 |
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: |