This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn import datasets | |
# sigmoid function | |
def activation(x,derivative=False): | |
if(derivative==True): | |
return x*(1-x) | |
return 1/(1+np.exp(-x)) | |
iris = datasets.load_iris() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOURCE https://blog.datadive.net/selecting-good-features-part-ii-linear-models-and-regularization/ | |
# Correlation | |
import numpy as np | |
from scipy.stats import pearsonr | |
np.random.seed(0) | |
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
convert "$1" \ | |
-morphology Convolve DoG:15,100,0 \ | |
-negate -normalize -blur 0x1 \ | |
-channel RGB -level 60%,91%,0.1\ -colorspace Gray \ | |
"$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
convert "$1" \ | |
-morphology EdgeIn Octagon \ | |
-negate -normalize -blur 0x2 \ | |
-channel RGB -level 50%,81%,0.1 \ -colorspace Gray \ | |
"$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [n2] = shivendra( image ) | |
%UNTITLED2 Summary of this function goes here | |
% Detailed explanation goes here | |
rgb = imread(image) ; | |
gray = rgb2gray(rgb) ; | |
%(gray,'gray.jpg'); | |
%imwrite(gray>180,'undilated.jpg'); | |
%filteredgray = medfilt2(gray,[7 7]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!DOCTYPE HTML> | |
<html> | |
<body> | |
{% for v in onlyfiles %} | |
<img src="{{ url_for('static', filename = v) }}" width="1050" height="300"> | |
{% endfor %} | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" | |
rel="stylesheet"> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="header"> | |
<h3 class="text-muted">How To Upload a File</h3> |
NewerOlder