Skip to content

Instantly share code, notes, and snippets.

View siddadel's full-sized avatar

Siddharth Adelkar siddadel

View GitHub Profile
import pandas as pd
import json
df = pd.read_csv("hierarchies.csv", header=None)
def get_hierarchy(jsonobject, value):
level3 = df[df[2]==value]
if(len(level3)==0):
#2 level
@siddadel
siddadel / a test of sorts, a sort of test
Created October 24, 2021 23:33
a test of sorts, a sort of test
from datetime import datetime
def get_date(s):
return datetime.strptime(s, '%b %d %Y %I:%M%p')
class A:
def __init__(self, a):
self.a = a
def get_a(self):
return self.a
@siddadel
siddadel / pari_trans.sql
Created June 23, 2021 14:33
PARI translation report
select ENGLISH.orig_eng_ref, ENGLISH.title, ENGLISH.slug, HINDI.slug,
ENGLISH.first_published_at as "English Date",
HINDI.first_published_at as "Hindi Date",
MARATHI.first_published_at as "Marathi Date",
URDU.first_published_at as "Urdu Date",
BENGALI.first_published_at as "Bengali Date"
from
(select SPLIT_PART(substring(url_path, length('///categories')),'/',1) as orig_eng_ref, title, wagtailcore_page.slug, first_published_at, language, page_ptr_id from article_article, wagtailcore_page
@siddadel
siddadel / challenges
Last active May 29, 2020 11:50
Challenges
[
{
"question":"Which candlestick forms a Bullish Engulfing pattern?",
"correct":1,
"options":[
{
"id":1,
"path":"file:///android_asset/Bullish Engulfing.png"
},
{
@siddadel
siddadel / ImageClassifier2.java
Last active July 20, 2019 12:27
A custom graph model with data augmentation. Does transform affect CSVRecord order?
package deep.learning.cnn;
import static java.lang.Math.toIntExact;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
@siddadel
siddadel / ImageClassifier2.java
Created July 18, 2019 11:59
For image height 300 x 400 an access violation erro relating to minidumps is thrown
package deep.learning.cnn;
import static java.lang.Math.toIntExact;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
@siddadel
siddadel / gist:f2bdb5fd5445b97b00da8d5e87ad97e6
Created July 14, 2019 04:44
CSVRecordReader returns null on getLabels
RecordReader csvRecordReader = new CSVRecordReader(0, ',');
csvRecordReader.initialize(new FileSplit(new File("temp.csv")));
DataSetIterator csvIterator = new RecordReaderDataSetIterator(csvRecordReader, batchSize, 1, numLabels);
System.out.println(csvRecordReader.getLabels());
@siddadel
siddadel / gist:af805e3c7f140011f90d8ccd0c9c0ca1
Created July 13, 2019 18:26
Say your 8 arrays have been stored in a list the I'd use Nd4j.create to create the tensor that you want.
List<INDArray> list = new ArrayList<>();
for(int i=0;i<8;i++) {
list.add(Nd4j.ones(10, 10, 3));
}
INDArray out = Nd4j.create(list, new int[] {8,10,10,3}, 'c');
long[] shape = out.shape();
for(long s: shape) {
System.out.println(s);
@siddadel
siddadel / gist:9f75297c445aa4bc0232c72e43ab6921
Created July 13, 2019 05:00
Hi All - I am new to this group and DL4J. I have been working on DL4J for the past couple of months and I have plenty of questions. Hope this is the right forum to bring them up. All of these questions come off of hands-on work on DL4J and its application to real world commercial problems, so rest assured I don't intend to waste anyone's time. T…
'Error at [D:/jenkins/ws/dl4j-latest_release-windows-x86_64-cpu/libnd4j/include/ops/declarable/generic/transforms/concat.cpp:133:0]:
CONCAT op: all input arrays must have the same rank !
Exception in thread "AMDSI prefetch thread" java.lang.RuntimeException: java.lang.RuntimeException: Op validation failed
at org.deeplearning4j.datasets.iterator.AsyncMultiDataSetIterator$AsyncPrefetchThread.run(AsyncMultiDataSetIterator.java:396)
Caused by: java.lang.RuntimeException: Op validation failed
at org.nd4j.nativeblas.Nd4jCpu$NativeOps.concatFloat(Native Method)'