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
import java.util.Random; | |
public class DBN { | |
public int N; | |
public int n_ins; | |
public int[] hidden_layer_sizes; | |
public int n_outs; | |
public int n_layers; | |
public HiddenLayer[] sigmoid_layers; | |
public RBM[] rbm_layers; |
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
import java.util.Random; | |
public class RBM { | |
public int N; | |
public int n_visible; | |
public int n_hidden; | |
public double[][] W; | |
public double[] hbias; | |
public double[] vbias; | |
public Random rng; |
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
public class LogisticRegression { | |
public int N; | |
public int n_in; | |
public int n_out; | |
public double[][] W; | |
public double[] b; | |
public LogisticRegression(int N, int n_in, int n_out) { | |
this.N = N; |
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
import java.util.Random; | |
public class dA { | |
public int N; | |
public int n_visible; | |
public int n_hidden; | |
public double[][] W; | |
public double[] hbias; | |
public double[] vbias; | |
public Random rng; |
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
import java.util.Random; | |
public class SdA { | |
public int N; | |
public int n_ins; | |
public int[] hidden_layer_sizes; | |
public int n_outs; | |
public int n_layers; | |
public HiddenLayer[] sigmoid_layers; | |
public dA[] dA_layers; |
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
// Flashless animation with stop motion images | |
// html: <img id="img" /> | |
/* Preload */ | |
var preload = function(path){ | |
var dfd = $.Deferred(); | |
var img = document.createElement('img'); | |
img.src = path; |
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
var animate = function($img, imgs, i, refreshRate){ | |
if(i >= imgs.length) return; | |
setTimeout(function() { | |
$img.attr('src', imgs[i]); // 画像の切り替え | |
animate($img, imgs, i+1, refreshRate); // 次のコマ画像へ | |
}, refreshRate); // 画像の更新間隔 | |
}; | |
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
var imgs = ['img_0.png', 'img_1.png', 'img_2.png']; // プリロードさせたい複数の画像 | |
var dfds = []; | |
for(var i=0; i<imgs.length; i++) { | |
dfds.push( preload(imgs[i]) ); // dfds配列に dfd.promise() を格納 | |
} | |
$.when.apply(null, dfds).done(function(){ | |
/* 画像読み込み完了後の処理 */ |
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
var path = '/path/to/img/0.png'; // プリロードさせたい画像のパス | |
var dfd = preload(path); | |
dfd.then(function(){ | |
/* 画像読み込み完了後の処理 */ | |
}).fail(function(){ |