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
worker.webrtc().onAddRemoteStream = (uuid, video, dataChannel) -> | |
id = $scope.peers.length+1; | |
dataChannelList.push(dataChannel) | |
$scope.peers.push({ | |
uuid:uuid | |
local: false | |
username: '' | |
id: id | |
}) | |
jidToPeerId[uuid] = id |
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
def centerAroundEntry(data): | |
# extract the price at 20 min after entry | |
labels = data[:,-1] | |
# remove the last 20 min of history from our data.. | |
data = data[:,0:-20] | |
# normalise data to the ENTRY point | |
for i in range(data.shape[0]): | |
labels[i] = (labels[i]/data[i,-1]) - 1.0 | |
data[i,] = (data[i,]/data[i,-1]) - 1.0 | |
return (data, labels) |
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
def loadData(path, subset = -1): | |
allFiles = glob.glob(os.path.join(path, "data_*.csv")) | |
if(subset > 0): | |
allFiles = allFiles[0:subset] | |
data = [] | |
for file in allFiles: | |
print(file) | |
with open(file, 'r') as f: | |
data.append( [float(x[1]) for x in list(csv.reader(f))] ) | |
return np.array(data) |
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 numpy as np | |
import os | |
import dtdata as dt | |
from sklearn.neighbors import NearestNeighbors | |
from sklearn.decomposition import PCA | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set(color_codes=True) |
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 import preprocessing | |
def scale(data): | |
return preprocessing.scale(data) |
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
def toClasses(labels, num_classes): | |
sorted = np.sort(np.array(labels, copy=True)) | |
bsize = math.floor( len(sorted) / num_classes ) | |
buckets = [] | |
for i in range(num_classes): | |
buckets.append(sorted[i*bsize]) | |
print("buckets: " + str(buckets)) | |
targets = np.digitize(labels, buckets) - 1 | |
one_hot_targets = np.eye(num_classes)[targets] | |
print(one_hot_targets) |
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 numpy as np | |
import os | |
import dtdata as dt | |
from sklearn.model_selection import train_test_split | |
from sklearn.decomposition import PCA | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation, Dropout | |
from keras.optimizers import RMSprop, Adam | |
from keras.callbacks import ModelCheckpoint |
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
def plotTrainingExample(te): | |
plt.plot(range(len(te)),te) | |
plt.show() | |
plotTrainingExample(data[INDEX_OF_EXAMPLE,:]) |
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 numpy as np | |
import os | |
import dtdata as dt | |
from sklearn.model_selection import train_test_split | |
from sklearn.decomposition import PCA | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation, Dropout | |
from keras.optimizers import RMSprop, Adam | |
from keras.callbacks import ModelCheckpoint | |
from keras import regularizers |
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 numpy as np | |
import os | |
import dtdata as dt | |
import matplotlib.pyplot as plt | |
import math | |
import random | |
import pprint as pp | |
from sklearn.model_selection import train_test_split | |
from sklearn.preprocessing import MinMaxScaler, StandardScaler |
OlderNewer