Skip to content

Instantly share code, notes, and snippets.

View phimachine's full-sized avatar
🎯
Focusing

Jason phimachine

🎯
Focusing
View GitHub Profile
#################SkipGram##################
Copied from elsewhere.
Initialized
Average loss at step 0 : 8.58149623871
Nearest to been: unfavourably, marmara, ancestral, legal, bogart, glossaries, worst, rooms,
Nearest to time: conformist, strawberries, sindhi, waterfall, xia, nominates, psp, sensitivity,
Nearest to over: overlord, panda, golden, semigroup, rawlings, involved, shreveport, handling,
Nearest to not: hymenoptera, reintroducing, lamiaceae, because, davao, omnipotent, combustion, debilitating,
Nearest to three: catalog, koza, gn, braque, holstein, postgresql, luddite, justine,
@phimachine
phimachine / gist:699c0253d96dfa7ab406a5befe53171d
Created January 24, 2018 20:02
Selenium 2017 enrollment scrapping tool
{
"CreationDate": "2018-1-24",
"Commands": [
{
"Command": "open",
"Target": "https://www.luther.edu/directory/",
"Value": ""
},
{
"Command": "click",
@phimachine
phimachine / train_valid_split.py
Last active April 10, 2020 12:29
This is a pytorch generic function that takes a data.Dataset object and splits it to validation and training efficiently.
import np
from torch.utils.data import Dataset
class GenHelper(Dataset):
def __init__(self, mother, length, mapping):
# here is a mapping from this index to the mother ds index
self.mapping=mapping
self.length=length
self.mother=mother
from collections import deque
initial_state = (3,3,0,0,0,0,0)
goal_state = (0,0, 3,3, 0, 0, 1)
def give_me_the_actions(state):
action_set=[]
a,b,c,d,e,f,g=state
"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\lib\idea_rt.jar=9951:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\plugins\junit\lib\junit5-rt.jar;C:\Users\JasonHu\.m2\repository\org\junit\platform\junit-platform-launcher\1.4.2\junit-platform-launcher-1.4.2.jar;C:\Users\JasonHu\.m2\repository\org\apiguardian\apiguardian-api\1.0.0\apiguardian-api-1.0.0.jar;C:\Users\JasonHu\.m2\repository\org\junit\platform\junit-platform-engine\1.4.2\junit-platform-engine-1.4.2.jar;C:\Users\JasonHu\.m2\repository\org\opentest4j\opentest4j\1.1.1\opentest4j-1.1.1.jar;C:\Users\JasonHu\.m2\repository\org\junit\platform\junit-platform-commons\1.4.2\junit-platform-commons-1.4.2.jar;C:\Users\J
I cannot generate termDocumentMatrix, JVM out of memory. I will try to compute MinHash still by accessing files directly.
Near Duplicate Constructed
Original file: baseball0.txt
Positive File:
baseball584.txt, baseball999.txt.copy7, baseball999.txt.copy6, baseball999.txt.copy5, baseball999.txt.copy4, baseball999.txt.copy3, baseball999.txt.copy2, baseball999.txt.copy1, baseball2.txt, hockey928.txt.copy4, hockey928.txt.copy3, hockey928.txt.copy2, hockey928.txt.copy1, hockey928.txt.copy7, hockey928.txt.copy6, hockey928.txt.copy5, baseball157.txt, baseball31.txt, baseball0.txt, hockey928.txt, baseball157.txt.copy6, baseball157.txt.copy7, baseball157.txt.copy4, baseball157.txt.copy5, baseball157.txt.copy2, baseball157.txt.copy3, baseball157.txt.copy1, baseball31.txt.copy2, baseball31.txt.copy1, baseball31.txt.copy7, baseball31.txt.copy6, baseball31.txt.copy5, baseball31.txt.copy4, baseball31.txt.copy3, baseball584.txt.copy1, baseball584.txt.copy3, baseball584.txt.copy2, baseball584.txt.copy5, baseball584.txt.copy4
C:\Users\JasonHu\Anaconda3\envs\alphazero-checker\python.exe "C:\Users\JasonHu\AppData\Local\JetBrains\PyCharm 2018.3\helpers\pydev\pydevconsole.py" --mode=client --port=13753
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['D:\\Git\\alphazero-checker', 'D:/Git/alphazero-checker'])
PyDev console: starting.
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 18:50:55) [MSC v.1915 64 bit (AMD64)] on win32
runfile('D:/Git/alphazero-checker/zero.py', wdir='D:/Git/alphazero-checker')
loading model at D:\Git\alphazero-checker\saves\lowpuct_7_0.pkl
Loaded model at epoch 7 iteration 0
Generating a new game with MCTS
Generating a new game with MCTS
C:\Users\JasonHu\Anaconda3\envs\alphazero-checker\python.exe "C:\Users\JasonHu\AppData\Local\JetBrains\PyCharm 2018.3\helpers\pydev\pydevconsole.py" --mode=client --port=3466
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['D:\\Git\\alphazero-checker', 'D:/Git/alphazero-checker'])
PyDev console: starting.
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 18:50:55) [MSC v.1915 64 bit (AMD64)] on win32
runfile('D:/Git/alphazero-checker/zero.py', wdir='D:/Git/alphazero-checker')
nothing to load
value10 train epoch 0, resampling 0. running value loss: 0.91723. running policy loss: 2.12922. running p diff: 0.18429
value10 valid epoch 0, resampling 0. validation value loss: 0.95271. validation policy loss: 2.04300 validation p diff: 0.19218
saved model value10 at D:\Git\alphazero-checker\saves\value10_0_0.pkl
@phimachine
phimachine / gist:d8ebc5ec608c524b9431b55a6f5d8eb9
Created December 5, 2019 13:47
some games to be included in the paper
Terminated due to peaceful activity
Terminated at step 251
Second player won
7[[ 2 ]
6 [ 1 -1 ]
5 [ -1]
4 [ 1 ]
3 [ 1 -1 ]
2 [ -1 ]
1 [ -2 1]
@phimachine
phimachine / parse_nvidia_smi.py
Created August 7, 2020 06:15 — forked from telegraphic/parse_nvidia_smi.py
Parse nvidia-smi from python
"""
Parse output of nvidia-smi into a python dictionary.
This is very basic!
"""
import subprocess
import pprint
sp = subprocess.Popen(['nvidia-smi', '-q'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)