Skip to content

Instantly share code, notes, and snippets.

View terasakisatoshi's full-sized avatar

Satoshi Terasaki terasakisatoshi

View GitHub Profile
@terasakisatoshi
terasakisatoshi / multiple_dispatch.jl
Last active August 13, 2018 05:33
multiple dispatch (Julia v.0.7 compatible)
# Multiple dispatch
#https://www.juliabox.com/notebook/notebooks/tutorials/intro-to-julia/10.%20Multiple%20dispatch.ipynb
using InteractiveUtils
versioninfo()
#=
In this script we'll explore multiple dispatch, which is as key
feature of Julia.
@terasakisatoshi
terasakisatoshi / auto_diff.jl
Created August 13, 2018 08:21
auto_diff (Julia v0.7 compatible)
# https://www.juliabox.com/notebook/notebooks/tutorials/intro-to-julia/AutoDiff.ipynb
# Auto Diff
using InteractiveUtils
versioninfo()
# The example is the Babylonian algorithm, known to man for millenia, to compute sqrt(x)
function Babylonian(x; N = 10)
t = (1+x)/2
for i = 2:N # For illustration purposes, 10 iterations suffice.
@terasakisatoshi
terasakisatoshi / dual_number.jl
Created August 13, 2018 08:49
auto diff with Dual Number(Julia v0.7 compatible)
# https://www.juliabox.com/notebook/notebooks/tutorials/intro-to-julia/AutoDiff.ipynb
# Dual Number
using InteractiveUtils
versioninfo()
struct D <: Number
f::Tuple{Float64,Float64}
end
@terasakisatoshi
terasakisatoshi / auto_diff.py
Last active August 13, 2018 11:16
auto_diff (Python)
# auto diff from scratch
"""
Reference:
https://www.juliabox.com/notebook/notebooks/tutorials/intro-to-julia/AutoDiff.ipynb
http://hplgit.github.io/primer.html/doc/pub/class/._class-readable005.html
https://docs.python.jp/3/reference/datamodel.html#object.__radd__
https://docs.python.org/3/whatsnew/3.5.html#pep-485-a-function-for-testing-approximate-equality
https://docs.python.jp/3/library/operator.html#module-operator
https://www.physicsforums.com/threads/derivative-of-f-x-to-the-power-of-g-x-and-algebra-problem.273333/
@terasakisatoshi
terasakisatoshi / Julia animation using PyPlot on Notebook.ipynb
Created August 19, 2018 04:32
Julia animation using PyPlot on Notebook(compatible with 0.7)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#=
Linear Regression using Flux.jl
pkg> add Flux#master
pkg> add Plots
Reference:
https://qiita.com/cometscome_phys/items/f58174c0dad7ecb811ed
=#
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / lagrange_multiplier_mind.ipynb
Last active November 25, 2018 10:55
Lagrange未定係数法のココロ
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / mind_of_regular.ipynb
Last active November 25, 2018 10:56
mind_of_regularizer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terasakisatoshi
terasakisatoshi / chainercv-transforms-sample.ipynb
Created November 30, 2018 08:49
sample code for chainercv.transforms of ChainerCV==0.11.0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.