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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
#--------------------------------------------------------------------- | |
# SDL2で正弦波を出力する。引数でバッファサイズを指定 | |
# | |
# コールバック方式。PythonのGILがどう影響するかの検証 | |
# スレッド間のやりとりにはとりあえず標準の queue を使用 | |
#--------------------------------------------------------------------- |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Just a handmade algorithm. NOT AI. | |
import gym | |
### MAP ### | |
# SFFF | |
# FHFH |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Just a handmade algorithm. NOT AI. | |
import sys | |
import gym | |
### 4x4 MAP ### |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import gym | |
def get_action(): | |
while True: | |
try: | |
act = int(input("--- direction(0:L, 1:D, 2:R, 3:U) > ")) | |
return act |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Just a handmade algorithm. NOT AI. | |
import sys | |
import gym | |
### 4x4 MAP ### |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import sys | |
import json | |
import numpy as np | |
def error(msg): |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import sys | |
import gym | |
DEBUG = False | |
#DEBUG = True |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Q学習 | |
# 探索時ランダムプレイ | |
import sys | |
import os.path | |
import pprint |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Q学習 | |
# 探索時e-greedy | |
import sys | |
import random | |
import os.path | |
import pprint |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# 単純パーセプトロン(Single Layer Perceptron) | |
# 入力ユニット数2(bias除く), 出力1 | |
# AND, OR, XOR でテスト | |
# AND, OR は正しく学習できるが、XOR は学習できないはず | |
# 勾配降下法により学習 | |
# 参考: http://hokuts.com/2015/11/25/ml2_perceptron/ |
OlderNewer