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
| #!BPY | |
| import bpy | |
| def clear_all(): | |
| for item in bpy.context.scene.objects: | |
| bpy.context.scene.objects.unlink(item) | |
| for item in bpy.data.objects: | |
| bpy.data.objects.remove(item) | |
| for item in bpy.data.meshes: | |
| bpy.data.meshes.remove(item) |
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
| # coding: utf-8 | |
| # In[26]: | |
| get_ipython().magic(u'matplotlib inline') | |
| import tensorflow as tf | |
| import numpy as np | |
| import matplotlib.pyplot as plt |
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 python | |
| import numpy as np | |
| import pandas as pd | |
| import chainer | |
| import chainer.functions as F | |
| import chainer.links as L | |
| from chainer import optimizers | |
| from chainer import serializers |
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
| dirlist = Dir::entries(".") | |
| # ファイルをフィルタリングする | |
| targets = dirlist.grep(/(.+)\.wav/) | |
| # 変更ルールを決める | |
| renametable = Array(targets.length) | |
| targets.each_with_index do |name, i| | |
| print i%19+1, "," | |
| print i/19+1, "\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
| # -*- coding:utf-8 -*- | |
| import matplotlib.pyplot as plt | |
| ## 定数達 | |
| # ギャンブラーの所持金 | |
| S = list(range(1, 100)) | |
| # 状態価値関数 | |
| V = 101*[0.0] | |
| # 勝利条件 | |
| V[100] = 1.0 |
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
| n = 10 | |
| x = Variable(x_test[n:n+1]) | |
| v = model.predictor(x) | |
| plt.imshow(x_test[n:n+1].reshape((28,28)), cmap = cm.Greys_r) | |
| print(np.argmax(v.data)) |
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
| # -*- coding: utf-8 -*- | |
| import numpy as np | |
| from sympy import * | |
| # az el roll [rad] | |
| degang = [0,45,0] | |
| [az, el, roll] = np.array(degang)*np.pi/180 | |
| q_az = np.array([0,0,np.sin(az/2),np.cos(az/2)]) | |
| q_el = np.array([0,np.sin(el/2),0,np.cos(el/2)]) |
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
| # coding utf-8 | |
| import copy | |
| import random | |
| from math import * | |
| import matplotlib.pyplot as plt | |
| class Agent(): | |
| def __init__(self, towns, roads, start, pheromone): | |
| # value |
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
| import numpy as np | |
| import chainer | |
| from chainer import Function, gradient_check, report, training, utils, Variable | |
| from chainer import datasets, iterators, optimizers, serializers | |
| from chainer import Link, Chain, ChainList | |
| import chainer.functions as F | |
| import chainer.links as L | |
| from chainer.training import extensions | |
| class MyModel(Chain): |
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
| require 'torch' | |
| torch.manualSeed(114514) | |
| -- choose a dimension | |
| N = 5 | |
| -- create a random NxN matrix | |
| A = torch.rand(N, N) |