Skip to content

Instantly share code, notes, and snippets.

View Tachyon5's full-sized avatar

Frank Taylor Tachyon5

  • TensorAI
  • San Francisco
View GitHub Profile
import sys
from pyspark.context import SparkContext
from numpy import array, random as np_random
from sklearn import linear_model as lm
from sklearn.base import copy
N = 10000 # Number of data points
D = 10 # Numer of dimensions
ITERATIONS = 5
"""
Bayesian Generative Classifier
------------------------------
"""
# Author: Jake Vanderplas <[email protected]>
import numpy as np
from sklearn.neighbors.kde import KernelDensity
from sklearn.mixture import GMM
from sklearn.base import BaseEstimator, clone
@Tachyon5
Tachyon5 / StackedAutoEncoderMnistExample.javaStackedAutoEncoderMnistExample.java
Created February 18, 2016 19:42
I want to add a HistogramIterationListener to the following but can't seem to get the UI running.
package org.deeplearning4j.examples.autoencoder;
import org.deeplearning4j.datasets.iterator.DataSetIterator;
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.deeplearning4j.eval.Evaluation;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.GradientNormalization;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.layers.AutoEncoder;
@Tachyon5
Tachyon5 / mnnlConfig
Created February 24, 2016 18:02
Explanation of Hidden and Visible in a layer.
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(seed)
.gradientNormalization(GradientNormalization.ClipElementWiseAbsoluteValue)
.gradientNormalizationThreshold(1.0)
.iterations(iterations)
.momentum(0.5)
.momentumAfter(Collections.singletonMap(3, 0.9))
.optimizationAlgo(OptimizationAlgorithm.CONJUGATE_GRADIENT)
.list(4)
.layer(0, new RBM.Builder().nIn(numRows*numColumns).nOut(500)
@Tachyon5
Tachyon5 / DBNMnistFullExample.java
Last active February 24, 2016 18:05
Can you explain the .hiddenUnit and .visibleUnit attributes?
package org.deeplearning4j.examples.deepbelief;
import org.deeplearning4j.datasets.iterator.DataSetIterator;
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator;
import org.deeplearning4j.eval.Evaluation;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.GradientNormalization;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.layers.OutputLayer;
@Tachyon5
Tachyon5 / LSTMService.java
Created February 9, 2018 14:47
EMA example: it's only called LSTM for the moment
package ch.algotrader.strategy;
import java.math.BigDecimal;
import org.springframework.stereotype.Component;
import org.apache.log4j.LogManager;
import org.joda.time.DateTime;
import org.joda.time.Period;
import ch.algotrader.entity.marketData.BarVO;