Skip to content

Instantly share code, notes, and snippets.

View cawfree's full-sized avatar
😍

cawfree cawfree

😍
View GitHub Profile
@cawfree
cawfree / gist:2393c90223ab085fe92860759f23b88e
Created February 25, 2017 21:31
02-25 21:14:08.391 16707 16707 E AndroidRuntime: Caused by: org.deeplearning4j.exception.DL4JInvalidConfigException: ConvolutionLayer (index=2, name=(name not set)) nIn=0, nOut=50; nIn and nOut must be > 0
/* Neural Dependencies. */
private static final int IMAGE_WIDTH = 64;
private static final int IMAGE_HEIGHT = 80;
private static final int SEED = 123;
private static final int ITERATIONS = 1;
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(SEED)
.iterations(ITERATIONS) // Training iterations as above
.regularization(true).l2(0.0005)
/*
@cawfree
cawfree / gist:901c26f42233b7770935fe5bc8869d84
Last active March 17, 2017 23:35
`ModelSerializer` fails on Android. (0.8.0) invoke virtual method flush() on a null Object
/** GRADLE: (Any custom modifications I've made here were required to prevent duplicate file errors! */
// DL4J
provided ('org.deeplearning4j:deeplearning4j-core:0.8.0') {
}
provided ('org.nd4j:nd4j-native:0.8.0') {
//exclude group: 'org.bytedeco.javacpp-presets'
}
provided (group: 'org.nd4j', name: 'nd4j-native-platform', version: '0.8.0') {
//exclude group: 'org.bytedeco.javacpp-presets'
@cawfree
cawfree / gist.java
Created March 17, 2017 23:53
Some DL4j/ND4J specific console errors
03-17 23:47:45.321 9244-9381/io.github.cawfree.preflop W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
03-17 23:47:45.321 9244-9381/io.github.cawfree.preflop W/System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation
03-17 23:47:45.321 9244-9381/io.github.cawfree.preflop W/System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
03-17 23:47:46.181 9244-9381/io.github.cawfree.preflop W/linker: /data/app/io.github.cawfree.preflop-1/lib/arm/libnd4jcpu.so: unused DT entry: type 0xf arg 0xa683
03-17 23:47:46.201 9244-9381/io.github.cawfree.preflop W/linker: /data/app/io.github.cawfree.preflop-1/lib/arm/libjnind4jcpu.so: unused DT entry: type 0xf arg 0x15125
03-17 23:47:46.551 9244-9381/io.github.cawfree.preflop W/linker: /data/app/io.github.cawfree.preflop-1/lib/arm/libjniopenblas.so: unused DT entry: type 0xf arg 0xea58
@cawfree
cawfree / zipfile.java
Created March 18, 2017 00:14
zipfile prior to null (void method flush)
zipfile = {ZipOutputStream@6182}
archiveNeedsZip64EocdRecord = false
cDir = null
commentBytes = {byte[0]@6195}
compressionLevel = -1
crc = {CRC32@6196}
currentEntry = null
currentEntryNeedsZip64 = false
defaultCompressionMethod = 8
entries = {HashSet@6197} size = 2
@cawfree
cawfree / model.java
Created March 18, 2017 00:19
model null?
model = {MultiLayerNetwork@6104}
defaultConfiguration = {NeuralNetConfiguration@6111} "NeuralNetConfiguration(layer=DenseLayer(super=FeedForwardLayer(super=Layer(layerName=layer0, activationFn=tanh, weightInit=XAVIER, biasInit=0.0, dist=null, learningRate=0.1, biasLearningRate=0.1, learningRateSchedule=null, momentum=0.9, momentumSchedule={}, l1=0.0, l2=0.0, l1Bias=0.0, l2Bias=0.0, dropOut=0.0, updater=NESTEROVS, rho=NaN, epsilon=NaN, rmsDecay=NaN, adamMeanDecay=NaN, adamVarDecay=NaN, gradientNormalization=None, gradientNormalizationThreshold=1.0), nIn=4, nOut=3)), leakyreluAlpha=0.0, miniBatch=true, numIterations=1, maxNumLineSearchIterations=5, seed=1489796271540, optimizationAlgo=STOCHASTIC_GRADIENT_DESCENT, variables=[0_W, 0_b, 1_W, 1_b], stepFunction=null, useRegularization=false, useDropConnect=false, minimize=true, learningRateByParam={}, l1ByParam={}, l2ByParam={}, learningRatePolicy=None, lrPolicyDecayRate=NaN, lrPolicySteps=NaN, lrPolicyPower=NaN, pretrain=false, iterationCount=0)"
epsilon = null
@cawfree
cawfree / gist:9da3c378dd86975f187df92626fe684f
Created March 20, 2017 23:52
Security Exception; DL4J on the Google App Engine
Mar 20, 2017 11:51:21 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Nested in java.lang.ExceptionInInitializerError:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createSecurityManager")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:442)
at java.lang.SecurityManager.<init>(SecurityManager.java:299)
at org.slf4j.helpers.Util$ClassContextSecurityManager.<init>(Util.java:43)
at org.slf4j.helpers.Util$ClassContextSecurityManager.<init>(Util.java:43)
@cawfree
cawfree / gist:61a96b4ab5d863224beffb424f3f294b
Created April 11, 2017 00:20
Basic JavaScript I/O for FlowHub
// TheGraph.App
<polymer-element name="the-graph-editor"
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor')));
Polymer('the-graph-editor', {
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor').grid));
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor').grid));
javascript:alert(JSON.stringify(document.querySelector('the-graph-editor').menus));
@cawfree
cawfree / HeterogeneousAdapter.java
Last active March 19, 2018 10:21
Heterogeneous Recycler Adapter; a simple way to define diverse RecyclerView content.
/**
* Created by Alexander Thomas (@Cawfree) on 03/07/2017.
*/
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
/**
* Created by Alexander Thomas (@Cawfree) on 06/03/2017.
* This class is used to benchmark base functionality with the connected device we'll be using for testing.
*/
// Run using JUnit4.
@RunWith(AndroidJUnit4.class)
public class InitializeTest {
/** Test whether we have access to the base application context. */
@cawfree
cawfree / jovo_google_action_permission.js
Last active November 18, 2017 19:30
An example permissions request for Jovo.
import { SpeechBuilder } from 'jovo-framework/lib/platforms/speechBuilder';
import { jovo } from 'jovo-framework/lib/jovo';
/**
* agent: /intGetNamePermission
* inputContext: <none>
* userStateIn: <none>
* action: ask for the user's name.
* userStateOut: <none>
* outputContext: <none>
*/