Skip to content

Instantly share code, notes, and snippets.

View kumar-abhishek's full-sized avatar

Kumar Abhishek kumar-abhishek

View GitHub Profile
@kumar-abhishek
kumar-abhishek / part-2.py
Last active January 12, 2020 05:22
Part-2
n_steps = None
# convert into input/output
i=1
n=1
x_input = np.array([dataXScaler[0]])
x_input = x_input.reshape((1, len(x_input), n_features))
while i<len(dataXScaler):
# demonstrate prediction
print('Input: ')
x_input = dataXScaler[2:30]
x_input = x_input.reshape((1, len(x_input), 4))
print(scaler.inverse_transform(dataXScaler)[2:30])
yhat = model.predict(x_input, verbose=0)
print('\nPredicted output: \n', scaler.inverse_transform(yhat))
print('\nExpected: \n', scaler.inverse_transform(dataYScaler)[30])
>>>
[[72.33333333 70.22222222 67. 58.23529412]
[72.33333333 70.22222222 67. 58.23529412]
[73.66666667 70.22222222 60. 55.58823529]
@kumar-abhishek
kumar-abhishek / random_length_input.py
Created January 12, 2020 05:18
Random length input
x_input = dataXScaler[2:30]
x_input = x_input.reshape((1, len(x_input), 4))
print(scaler.inverse_transform(dataXScaler)[2:30])
yhat = model.predict(x_input, verbose=0)
print(scaler.inverse_transform(yhat))
print('expected: ', scaler.inverse_transform(dataYScaler)[30])
>>>
[[72.33333333 70.22222222 67. 58.23529412]
[72.33333333 70.22222222 67. 58.23529412]
[73.66666667 70.22222222 60. 55.58823529]
@kumar-abhishek
kumar-abhishek / lstm.py
Created January 12, 2020 05:16
Using LSTM to train model
from keras.models import Sequential
from keras import optimizers
from keras.layers import LSTM
from keras.layers import Dense, Dropout, BatchNormalization, TimeDistributed
n_features = 4
# choose a number of time steps
n_steps = None
model = Sequential()
@kumar-abhishek
kumar-abhishek / standardize.py
Created January 12, 2020 05:10
Standardizing the data set
scaler = MinMaxScaler(feature_range=(0, 1))
dataXScaler = scaler.fit_transform(dataX)
dataYScaler = scaler.fit_transform(dataY)
print(dataXScaler[0:5])
print(dataYScaler[0:5])
>>>
[[0.44444444 0.77777778 1. 0.88235294]
[0.44444444 0.77777778 1. 0.88235294]
[0.44444444 0.77777778 1. 0.88235294]
[0.44444444 0.77777778 1. 0.88235294]
@kumar-abhishek
kumar-abhishek / input.py
Last active January 12, 2020 05:24
Analyze Input
X_train_000 = pd.read_csv('chorale_000.csv')
print(X_train_000.head())
>>>
note0 note1 note2 note3
0 74 70 65 58
1 74 70 65 58
2 74 70 65 58
3 74 70 65 58
4 75 70 58 55
@kumar-abhishek
kumar-abhishek / app.js
Created March 17, 2019 00:10 — forked from daffl/app.js
Basic service layer
class ChatApplication {
login (username, password) {},
logout (user) {},
joinChatRoom(roomId, user) {}
sendMessage(message, roomId, user) {}
sendPrivateMessage(message, receiverId, user) {}
@kumar-abhishek
kumar-abhishek / System Design.md
Created April 18, 2018 21:04 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@kumar-abhishek
kumar-abhishek / about.md
Created July 6, 2017 18:12 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer