Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
from contextlib import closing | |
""" | |
Demonstrate that contextmanagers for closing and committing don't play well together without autocommit | |
Only the noclosing function can run without error | |
""" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Upsert gist | |
Requires at least postgres 9.5 and sqlalchemy 1.1 | |
Initial state: | |
[] | |
Initial upsert: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Implementation of the example from https://inst.eecs.berkeley.edu/~cs61c/fa14/projs/02/ | |
""" | |
import operator | |
class Puzzle(object): | |
"""General game representation""" | |
def solution(self): | |
return Position(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Demo of using Hogwild algorthim for parallel learning with shared memory | |
Uses sklearn's LogisticRegression for accuracy comparison | |
Output | |
('initial accuracy:', 0.45333333333333331) | |
worker 25974 score 0.93 | |
worker 25975 score 0.92 | |
worker 25976 score 0.88 | |
worker 25974 score 0.94 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create materialized view ladder as ( | |
with | |
match_points as ( | |
select | |
case ... end as aff_points, | |
case ... end as neg_points, | |
aff_id, | |
neg_id | |
), |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder