Skip to content

Instantly share code, notes, and snippets.

View nvinayvarma189's full-sized avatar

Vinay Varma nvinayvarma189

View GitHub Profile
@nvinayvarma189
nvinayvarma189 / Custom_Conv.py
Last active June 27, 2019 16:24
Custom Layer for deep learning model in python
def Custom_Conv(bottom):
import tensorflow as tf
#bottom is the previous layer. Her it is UpSampling2D layer
input_channels = int(bottom.get_shape()[-1])
# initialize weights and biases using xavier
weights = tf.Variable(tf.truncated_normal(shape=[1, 1, input_channels, 1], dtype=tf.float32, stddev=tf.sqrt(1.0 / (1 * 1 * input_channels))))
biases = tf.Variable(tf.constant(0, dtype=tf.float32, shape=[1]))
@nvinayvarma189
nvinayvarma189 / POM.xml
Created June 24, 2019 13:31
POM.xml latest
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>dl4j-quickstart</artifactId>
<groupId>org.deeplearning4j</groupId>
<version>1.0.0-beta4</version>
<packaging>jar</packaging>
@nvinayvarma189
nvinayvarma189 / POM.xml
Created June 24, 2019 12:48
POM.xml file I used for Keras model import
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>dl4j-quickstart</artifactId>
<groupId>org.deeplearning4j</groupId>
<version>1.0.0-beta2</version>
<packaging>jar</packaging>
# Simulated Annealing for Clustering Problems
import math
import random
num_objects = 10 # numbers of objects to be clustered
num_cost_increases = 100
avg_cost_increase = 200
acc_ratio = 0.75 # acceptance ratio should e between 0 and 1
prob_e = 0.00000000001 # probability factor
beta = 0.125
max_iter = 4 * num_objects # maximum number of iterations