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 xlrd | |
def getDataFromFile(fileName): | |
with xlrd.open_workbook(fileName) as wb: | |
# we are using the first sheet here | |
worksheet = wb.sheet_by_index(0) | |
# getting number or rows and setting current row as 0 -e.g first | |
num_rows, curr_row = worksheet.nrows - 1, 0 | |
# retrieving keys values(first row values) |
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> | |
<meta charset="utf-8" /> | |
<meta http-equiv="x-ua-compatible" content="ie=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" /> | |
<link rel="shortcut icon" href="{{ STATIC_URL }}img/favicon.ico" type="image/x-icon" /> | |
<title>Genomika Labs</title> | |
<!--[if lt IE 9]> |
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
from __future__ import absolute_import | |
from celery import shared_task | |
# import the logging library | |
import logging | |
# Get an instance of a logger | |
logger = logging.getLogger(__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
#-*- coding: utf-8 -*- | |
import celery | |
import hashlib | |
import datetime | |
from django.db import models | |
from django.conf import settings | |
from django.utils.html import escape | |
from django.utils.translation import ugettext_lazy as _ |
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
""" | |
Sequence | |
-------- | |
String object representing biological sequences with alphabets. | |
""" |
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
$("#send").click(function(e) { | |
// convert canvas to data url | |
var img = canvas.toDataURL(); | |
// make request to server | |
$.post("/", {img: img, n: n}, function() { | |
// when request is finished, redirect to homepage | |
window.location.replace("/"); | |
}) | |
return false; | |
}); |
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 PIL import Image | |
import numpy as np | |
files = [f for f in os.listdir("handwriting/numbers/")] | |
files = ["handwriting/numbers/" + f for f in files] | |
STANDARD_SIZE = (50, 50) | |
def get_image_data(filename): | |
img = Image.open(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
from sklearn.decomposition import RandomizedPCA | |
from sklearn.preprocessing import StandardScaler | |
pca = RandomizedPCA(n_components=10) | |
std_scaler = StandardScaler() | |
X_train, X_test, y_train, y_test = train_test_split(data, labels, test_size=0.1) | |
X_train = pca.fit_transform(X_train) | |
X_test = pca.transform(X_test) |
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
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.metrics import confusion_matrix | |
clf = KNeighborsClassifier(n_neighbors=13) | |
clf.fit(X_train, y_train) | |
print "done" | |
print "="*20 | |
print clf | |
print "Confusion Matrix" |
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
from yhat import BaseModel, Yhat | |
class DigitModel(BaseModel): | |
def require(self): | |
from PIL import Image | |
from StringIO import StringIO | |
import base64 | |
OlderNewer