Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Tran Vu Le ktl014

  • University of California, San Diego
  • La Jolla, CA
View GitHub Profile
View alexnet_urban.prototxt
# AlexNet
name: "AlexNet"
layer {
name: "train-data"
type: "Data"
top: "data"
top: "label"
transform_param {
mirror: false
crop_size: 227
@ktl014
ktl014 / kernel.py
Created Aug 7, 2018
kernel approximation using svm
View kernel.py
from sklearn.kernel_approximation import RBFSampler
from sklearn.decomposition import PCA
kernel_svm = svm.SVC(gamma=.2)
linear_svm = svm.LinearSVC()
feature_map_fourier = RBFSampler(gamma=.2, random_state=SEED)
feature_map_nystroem = Nystroem(gamma=.2, random_state=SEED)
fourier_approx_svm = pipeline.Pipeline([("feature_map", feature_map_fourier),
("svm", svm.LinearSVC())])
View dataset.py
# Importing data from csv file
csv_filename = './tweets.csv'
dataset = tf.contrib.data.make_csv_dataset(csv_filename, batch_size=32)
dataset = dataset.shuffle(buffer_size=100)
iter = dataset.make_one_shot_iterator()
next = iter.get_next()
features, labels = next['text'], next['sentiment']
with tf.Session() as sess:
sess.run([features, labels])
View eager.py
#! /usr/bin/env python
from __future__ import absolute_import, division, print_function
import os
import matplotlib.pyplot as plt
import tensorflow as tf
import keras
import tensorflow.contrib.eager as tfe
@ktl014
ktl014 / urllib.py
Created May 25, 2018
how to open urls with urllib
View urllib.py
from urllib.request import urlopen
html = urlopen("http://www.google.com/")
print(html)
View train_val-resnet50.prototxt
name: "ResNet-50"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
View train_val_exp2.prototxt
name: "AlexNet"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
# transform_param {
View vgg16.prototxt
name: "VGG_ILSVRC_16_layers"
layer {
name: "data"
type: "Data"
include {
phase: TRAIN
}
transform_param {
crop_size: 224
mean_value: 104
View vgg19.prototxt
name: "VGG_ILSVRC_19_layers"
input: "data"
input_dim: 10
input_dim: 3
input_dim: 224
input_dim: 224
layers {
bottom: "data"
top: "conv1_1"
name: "conv1_1"
View python_getitemclassEx
>>> class Library(object):
... def __init__(self):
... self.books = { 'title' : object, 'title2' : object, 'title3' : object, }
... def __getitem__(self, i):
... return self.books[i]
... def __iter__(self):
... return self.books.itervalues()
...
>>> library = Library()
>>> library['title']