Skip to content

Instantly share code, notes, and snippets.

View doraneko94's full-sized avatar

Shuntaro Ohno doraneko94

View GitHub Profile
@doraneko94
doraneko94 / enigma.py
Last active July 4, 2018 07:48
The code of "Enigma".
import random
import sys
alpha = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
hand1 = 22 #Change
hand2 = 5 #Change
rot_state1 = 0 #Change
rot_state2 = 1 #Change
rot_state3 = 2 #Change
rot_state0 = 3 #Change
chr1 = 23 #Change
@doraneko94
doraneko94 / assess.py
Last active December 1, 2018 20:31
The code of "Brier Score", "ePCP", "the separation plot". Please import from this file to your project. The "actual_outcome" is a list of real labels (0 or 1), and the "fitted_value" is a list of probabilities that the data's label is 1. This code requires "numpy" and "pandas".
from matplotlib import pyplot as plt
from matplotlib import patches
import pandas as pd
import numpy as np
def BrierScores(actual_outcome, fitted_value):
X = np.array(actual_outcome)
p = np.array(fitted_value)
B = sum((p-X)**2)/len(X)
return B
@doraneko94
doraneko94 / ROC_PR.py
Created February 2, 2018 14:38
This code generates ROC curve and PR curve, and also prints AUCs individually.
import math, random
from matplotlib import pyplot as plt
def normal_cdf(x, mu=0, sigma=1):
return (1 + math.erf((x - mu) / math.sqrt(2) / sigma)) / 2
def inverse_normal_cdf(p, mu=0, sigma=1, tolerance=0.00001):
if mu != 0 or sigma != 1:
return mu + sigma * inverse_normal_cdf(p, tolerance=tolerance)
@doraneko94
doraneko94 / Osero.py
Last active January 27, 2018 23:58
The code of analyzing Osero (reversi). Prease import functions.py.
import functions as fn
from time import sleep
scale = 6
kifu = {}
now = []
end = 0
t = 0
while end == 0:
board = fn.board_set(kifu, now, scale)
randomize
shiai_num = 10000 ;shiai_numの数値と等しい回数の試合を行います。
;データ読み込み変数定義
dim b1,10
dim b2,10
dim b3,10
dim b4,10
dim st,10
dim std,10
dim bunt,10