package DeepLearning; import java.util.Random; public class MLP { public int N; public int n_in; public int n_hidden; public int n_out; public HiddenLayer hiddenLayer; public LogisticRegression logisticLayer; public Random rng; public MLP(int N, int n_in, int n_hidden, int n_out, Random rng) { this.N = N; this.n_in = n_in; this.n_hidden = n_hidden; this.n_out = n_out; if (rng == null)rng = new Random(1234); this.rng = rng; // construct hiddenLayer this.hiddenLayer = new HiddenLayer(N, n_in, n_hidden, null, null, rng, "tanh"); // construct logisticLayer this.logisticLayer = new LogisticRegression(N, n_hidden, n_out); } public void train(double[][] train_X, int[][] train_Y, double lr) { double[] hidden_layer_input; double[] logistic_layer_input; double[] dy; for(int n=0; n