Categories
Mastering Development

How to apply the ConvLSTM layers

I was doing a classification machine learning with an input of (700,50,34) (batch, step,features) def convLSTM_model(X_train, y_train, X_test, y_test, num_classes,loss, batch_size=68, units=128, learning_rate=0.005, epochs=20, dropout=0.2, recurrent_dropout=0.2): class myCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs={}): if (logs.get(‘acc’) > 0.9): print("\nReached 90% accuracy so cancelling training!") self.model.stop_training = True callbacks = myCallback() model = tf.keras.models.Sequential() model.add(Masking(mask_value=0.0, input_shape=(None,X_train.shape[0],X_train.shape[1], X_train.shape[2]))) model.add(ConvLSTM2D(filters=40, […]

Categories
Mastering Development

Tensorflow with batch size and wrong dimesion

Here are my code: # Model parameters: W and b # tf.reset_default_graph() W = tf.get_variable("weight",shape = [784, 10], dtype=tf.float32) b = tf.get_variable("b", shape=(784,10), dtype= tf.float32) input_X = tf.placeholder(‘float32’, shape = (None,10)) input_y = tf.placeholder(‘float32’, [784, 10]) ogits = W*input_X + b probas = tf.nn.softmax(logits) classes = tf.argmax(probas) loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels = input_y, logits = logits)) […]

Categories
Mastering Development

InvalidArgumentError: You must feed a value for placeholder tensor ‘edsr_target’ with dtype float and shape [?,?,?,?]

For training my one model, I am using predictions from another trained model. The predictions from pretrained model are predicted using the function "learning_based", whose code is given below. The model which is to be trained is a general CNN model. The training size is 256,256. The pretrained model was also trained on 256,256 This […]

Categories
Game Creation Mastering Development

extend glicko2 for multiplayer [closed]

I want to have a commercial rating system for a multiplayer card game (not just 1:1) but n:n. There is trueskill from microsoft – but it is restricted for non-commercial only and has some known problems. For this reason I thought about extending glicko2. Most simple approach would be to take the average of all […]

Categories
Mastering Development

Different results of custom loss function binary_crossentropy and ‘binary_crossentropy’

QUESTION 1: Why does calling binary_crossentropy by its name with a string ‘binary_crossentropy’ gives different (better) results than calling, the same(?), tf.keras.losses.binary_crossentropy function inside a custom loss function? QUESTION 2: What am I doing wrong? PROBLEM: I’m trying to solve a mystery of different results I get when I use: def bc_custom(y_true, y_pred): return tf.keras.losses.binary_crossentropy(y_true, […]

Categories
Mastering Development

Keras CNN prediction output is only predicting within a range of numbers

I am trying to predict 3D medical brain images based on their assessment score using CNN, however the accuracy scores I have received were within a range of numbers (ex: there are 7 possible test scores: 1, 1.5, 2, 2.5, 3, 4, 5 and the output only gives predictions within 1-1.5 range) I have resized, […]

Categories
Cryptocurrency Ethereum Mastering Development

Please look over my script for re-entrancy

I know the random number generator isn’t secure and is susceptible to manipulation from miners and any advice on the method to generate random numbers will be appreciated. However, the reason I’m posting my code is to ask if you (the community) could take a look and see if it’s safe from re-entrancy. I’ve done […]

Categories
Mastering Development

ValueError: Variable

I’m trying to implement a prediction of low birth rate using nengo and tensorflow with a SNN model.\ But, I got the following Value error (in Anaconda): Traceback (most recent call last): File "C:\Users\USER\NengoPRJ\nengo_lowbirth.py", line 95, in <module> sim.fit(train_data, {out_p: train_labels}, epochs=epochs) File "C:\ProgramData\Anaconda3\envs\tf210\lib\site-packages\nengo\utils\magic.py", line 181, in __call__ return self.wrapper(self.__wrapped__, self.instance, args, kwargs) File "C:\ProgramData\Anaconda3\envs\tf210\lib\site-packages\nengo_dl\simulator.py", […]

Categories
Mastering Development

aggregate dataframe horizontally

I have the following data: inputdata = [[1,’long’,30.2,’Win’],[1,’long’,-12.4,’Loss’], [2,’short’,-12.3,’Loss’],[1,’long’,3.2,’Win’], [3,’short’,0.0,’B/E’],[3,’short’,23.2,’Win’], [3,’long’,3.2,’Win’],[4,’short’,-4.2,’Loss’]] datadf = DataFrame(columns=[‘AssetId’,’Direction’,’PnL’,’W_L’], data = inputdata) datadf AssetId Direction PnL W_L 0 1 long 30.2 Win 1 1 long -12.4 Loss 2 2 short -12.3 Loss 3 1 long 3.2 Win 4 3 short 0.0 B/E 5 3 short 23.2 Win 6 3 long […]

Categories
Mastering Development

How to add variables into graph margins using R?

I’d like to add variable information (for instance “Case” from the data) in the margin (horitzontal or vertical) that changes with each year – preferably more than one variable actually – similar concept to what ggMarginal would produce but the output to be numerical view of what was in the data instead of a graphical […]