Skip to content

Instantly share code, notes, and snippets.

Shivendra Agrawal ShivendraAgrawal

Block or report user

Report or block ShivendraAgrawal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ShivendraAgrawal /
Created Aug 16, 2016
A single layer neural network script using numpy performed on iris set from scikit-learn
import numpy as np
from sklearn import datasets
# sigmoid function
def activation(x,derivative=False):
return x*(1-x)
return 1/(1+np.exp(-x))
iris = datasets.load_iris()
ShivendraAgrawal /
Last active Dec 12, 2016
Scikit-Learn sample snippets for copy-paste
# Correlation
import numpy as np
from scipy.stats import pearsonr
size = 300
x = np.random.normal(0, 1, size)
print "Lower noise", pearsonr(x, x + np.random.normal(0, 1, size))
print "Higher noise", pearsonr(x, x + np.random.normal(0, 10, size))
ShivendraAgrawal / 0_reuse_code.js
Created Feb 15, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
convert "$1" \
-morphology Convolve DoG:15,100,0 \
-negate -normalize -blur 0x1 \
-channel RGB -level 60%,91%,0.1\ -colorspace Gray \
convert "$1" \
-morphology EdgeIn Octagon \
-negate -normalize -blur 0x2 \
-channel RGB -level 50%,81%,0.1 \ -colorspace Gray \
View automatic_select.m
function [] = automatic_select()
count = 0;
imageFiles = dir('*.jpg');
nFiles = length(imageFiles);
white_counts = zeros(nFiles);
for i = 1 : nFiles
count = count + 1;
currentFileName = imageFiles(i).name;
View shivendra.m
function [n2] = shivendra( image )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
rgb = imread(image) ;
gray = rgb2gray(rgb) ;
%filteredgray = medfilt2(gray,[7 7]);
import os
from os import listdir
from os.path import isfile, join
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
from werkzeug import secure_filename
View index2.html
{% for v in onlyfiles %}
<img src="{{ url_for('static', filename = v) }}" width="1050" height="300">
{% endfor %}
View index.html
<!DOCTYPE html>
<html lang="en">
<link href="//"
<div class="container">
<div class="header">
<h3 class="text-muted">How To Upload a File</h3>
You can’t perform that action at this time.