Skip to content

Instantly share code, notes, and snippets.

View jennyonjourney's full-sized avatar

Kyungeun, Jeon (Jenny) jennyonjourney

View GitHub Profile
@jennyonjourney
jennyonjourney / gist:eb51f1d02a6606b30a8faa4a6922e4ee
Created April 3, 2018 15:26
NN back propagation practice (ted viewer prediction) - 1layer
import tensorflow as tf
import numpy as np
tf.set_random_seed(777) # for reproducibility
# Predicting animal type based on various features
xy = np.loadtxt('ted_main_ranking_viewer.csv', delimiter=',', dtype=np.float32)
X_data = xy[:, 0:-1]
def MinMaxScaler(x_data):
numerator = x_data - np.min(x_data, 0)
denominator = np.max(x_data, 0) - np.min(x_data, 0)
@jennyonjourney
jennyonjourney / gist:0c32836a4632c6cce72e9fd5de43100d
Created April 5, 2018 01:00
ML (NN multi layers' backpropagation)
import tensorflow as tf
import numpy as np
tf.set_random_seed(777) # for reproducibility
learning_rate = 0.0001
xy = np.loadtxt('multiTimeline_bitcoin_2_normalized.csv', delimiter=',', dtype=np.float32)
X_data = xy[:, 0:-1]
def MinMaxScaler(x_data):
numerator = x_data - np.min(x_data, 0)
denominator = np.max(x_data, 0) - np.min(x_data, 0)
return numerator / (denominator + 1e-10)
@jennyonjourney
jennyonjourney / gist:f71a36dfa36849378a1be9f7708e5e01
Last active October 16, 2022 12:38
Python Data Structures (Coursera) Assignement 10.2
# 10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon.
#From [email protected] Sat Jan 5 09:14:16 2008
# Once you have accumulated the counts for each hour, print out the counts, sorted by hour as shown below.
name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
counts = dict()
@jennyonjourney
jennyonjourney / bike-sharing-demand (kaggle competition)
Created May 23, 2018 12:40
bike-sharing-demand (kaggle competition)
import numpy as np
import pandas as pd
train = pd.read_csv("data/train (bike).csv")
print(train.shape)
train.head()
train = pd.read_csv("data/train (bike).csv", parse_dates=["datetime"])
print(train.shape)
## Data processing
train["year"] = train["datetime"].dt.year