Skip to content

Instantly share code, notes, and snippets.

View KestindotC's full-sized avatar

Kestin Chang KestindotC

View GitHub Profile
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten, Reshape
from keras.layers.convolutional import Convolution1D, Convolution2D, MaxPooling2D
from keras.utils import np_utils
def myGenerator():
(X_train, y_train), (X_test, y_test) = mnist.load_data()
y_train = np_utils.to_categorical(y_train,10)
import argparse
import os
import pandas as pd
import pyspark.sql.functions as F
from pyspark.sql import SparkSession
from pyspark.sql.types import StringType, IntegerType, ArrayType
from build_graph import *
from avg_response_time import *
@KestindotC
KestindotC / IsolationForest.py
Created November 28, 2017 06:28
Test script for isolation forest
import pandas as pd
from sklearn.ensemble import IsolationForest
ilf = IsolationForest(n_estimators=100,
contamination=0.02,
verbose=2)
# DataSet download from https://github.com/shngli/Machine-learning/blob/master/Anomaly%20Detection/ex8data1.mat
# Using scipy and numpy to transform .mat -> .csv
df = pd.read_csv('dataset.csv',header=None)
@KestindotC
KestindotC / rdsMySQL2df.py
Created November 24, 2017 03:00
RDS connection with python application
import pymysql
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('mysql+pymysql://kestin_chang:<password>@<RDS-endpointURL>:3306/<DBname>')
# Pandas read_sql function
df = pd.read_sql_query('SELECT * FROM <TABLE NAME> LIMIT 10',engine)
# Print result
@KestindotC
KestindotC / useful_pandas_snippets.py
Created August 16, 2017 04:20 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@KestindotC
KestindotC / DL_Lession3.ipynb
Last active June 6, 2017 01:13
2_fullyconnected.ipynb problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KestindotC
KestindotC / Tensorflow_BasicIntro.ipynb
Created June 6, 2017 00:21
Basic usage of tensorflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@KestindotC
KestindotC / Circle.java
Last active May 27, 2017 15:18
Java OOP Class Assignment#8 (MainClass: ShapeFactory.java)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
/**
*
* @author Kestin
*/
@KestindotC
KestindotC / SimpleArrayList.java
Created May 27, 2017 09:05
Java OOP Class Assignment#7
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
/**
* Implementation of ArrayList using array data structure
* Other implementation (e.g. LinkList) were record in other files
* @author Kestin
@KestindotC
KestindotC / GDC_Tutorial.md
Last active October 27, 2021 08:33
TCGA GDC Data Transfer Tool Install and Data Download Tutorial

TCGA Data Download Tutorial

TCGA GDC Client 的程式使用的是Python2.7以及提供Ubuntu 12.0以上的安裝套件
實驗室的工作站 Distro 是 Centos6.4
如果大家對鳥哥還有點印象的話應該可以知道是Redhat/CentOS/Fedora系列的Distributions
所以請使用Miniconda建立該下載工具需要的環境並且使用source code來安裝工具


conda config --add channels r