This file contains hidden or 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
from copy import deepcopy | |
IDENTIFIER_BASE = 3 | |
def get_identifier(state): | |
identifier = 0 | |
for line in state: | |
for x in line: | |
identifier *= IDENTIFIER_BASE |
This file contains hidden or 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 | |
import numpy as np | |
def calculate_pagerank(data, d=0.85): | |
matrix_m = np.matrix(data) | |
assert matrix_m.shape[0] == matrix_m.shape[1] | |
n = matrix_m.shape[0] | |
matrix_i = np.zeros((n, n)) | |
for pos in range(n): |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -ex | |
##################################### | |
# Please run this script with ROOT! # | |
##################################### | |
### CONFIGS ### |
This file contains hidden or 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
#!/usr/bin/env python3 | |
from pathlib import Path | |
import pymongo | |
DB_URL = 'mongodb://localhost:12345/' # Use your MongoDB URL | |
DATA_BASE_PATH = Path("../data/") # Your csv file should look like: ../data/2019/phs_2019_stage.csv |
This file contains hidden or 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
private Tuple<double, double, double> RgbToHsl(Tuple<int, int, int> rgb) | |
{ | |
int r = rgb.Item1; | |
int g = rgb.Item2; | |
int b = rgb.Item3; | |
double h, s, l; | |
int max = Math.Max(r, Math.Max(g, b)); | |
int min = Math.Min(r, Math.Min(g, b)); |
This file contains hidden or 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
private Tuple<int, int, int> HslToRgb(Tuple<double, double, double> hsl) | |
{ | |
double h = hsl.Item1; | |
double s = hsl.Item2; | |
double l = hsl.Item3; | |
int r = 0, g = 0, b = 0; | |
double q, p, hk, t, c; | |
// set q |