This file contains hidden or 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 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) |
This file contains hidden or 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 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) |
This file contains hidden or 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
# 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() |
This file contains hidden or 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 | |
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 |
OlderNewer