Skip to content

Instantly share code, notes, and snippets.

View AdityaSoni19031997's full-sized avatar
🎯
Focusing

Aditya Soni AdityaSoni19031997

🎯
Focusing
View GitHub Profile
@AdityaSoni19031997
AdityaSoni19031997 / xor_in_Keras.py
Last active August 8, 2017 12:16
Comparing Keras And Tensorflow(XOR Function Implementation)
import numpy as np
from keras.models import Sequential
from keras.layers.core import Activation, Dense
training_data = np.array([[0,0],[0,1],[1,0],[1,1]], "float32")
target_data = np.array([[0],[1],[1],[0]], "float32")
model = Sequential()
model.add(Dense(32, input_dim=2, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
@AdityaSoni19031997
AdityaSoni19031997 / undirected_graph.py
Created August 14, 2017 06:05
Implementing Graph Algorithms (Basic Level in Python)
import Queue
class UndirectedGraph(object):
"""
Undirected Graph, with graph represented as an adjacency matrix
"""
def __init__(self, vertices):
self.adjacency_matrix = []
for i in range(vertices):
@AdityaSoni19031997
AdityaSoni19031997 / directed_graph.py
Last active August 14, 2017 06:36
Directed_Graph_Implementation_In_Python_Using_Adjacency_List
import Queue
class DirectedGraph(object):
"""
Directed Graph, with graph represented as an adjacency list
"""
def __init__(self):
self.adjacency_list = {}
@AdityaSoni19031997
AdityaSoni19031997 / nn_simplest.py
Created August 28, 2017 14:38
simplest Neural Net Possible
import numpy as np
X = np.array([ [0,0,1], [0,1,1], [1,0,1], [1,1,1] ])
y = np.array([ [0, 1, 1, 0] ])
w1 = np.random.random((3, 4)) - 0.5
w2 = np.random.random((4, 1)) - 0.5
for i in range(45000):
l1 = 1/(1+ np.exp(-(np.dot(X, w1))))
l2 = 1/(1+ np.exp(-(np.dot(l1,w2))))
delta_l2 = (y - l2) * (l2*(1-l2))
delta_l1 = delta_l2.dot(w2.T) * (l1*(1-l1))
@AdityaSoni19031997
AdityaSoni19031997 / shortcuts_in_C++_competitive_programming.cpp
Created September 6, 2017 11:17
Found IT Somewhere on the internet and added few lines which i use...
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
bool debug = false;
#else
bool debug = true;
#endif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# This way we have randomness and are able to reproduce the behaviour within this cell.
np.random.seed(13)
def impact_coding(data, feature, target='y'):
'''
In this implementation we get the values and the dictionary as two different steps.
This is just because initially we were ignoring the dictionary as a result variable.
In this implementation the KFolds use shuffling. If you want reproducibility the cv
could be moved to a parameter.
# Importing dataset
dataset <- read.csv('ASD.csv')
# Taking care of missing data
# Fixing ethnicity
dataset[dataset == "?"] <- NA
summary(dataset)
#install.packages('DescTools')
library(DescTools)
@AdityaSoni19031997
AdityaSoni19031997 / license.txt
Last active September 19, 2018 03:31
sublime_text_build_3143_license_keys
## Sublime Text 3 Serial key build is 3176
The license key
----- BEGIN LICENSE -----
sgbteam
Single User License
EA7E-1153259
8891CBB9 F1513E4F 1A3405C1 A865D53F
115F202E 7B91AB2D 0D2A40ED 352B269B
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.