neural-network

What is the difference between these two ways of saving keras machine learning model weights?

你说的曾经没有我的故事 提交于 2020-03-18 04:48:13
问题 I saw two ways of saving the weights of a keras model. First way; checkpointer = ModelCheckpoint(filepath="weights.hdf5", verbose=1, save_best_only=True) model.fit(x_train, y_train, nb_epoch=number_of_epoch, batch_size=128, verbose=1, validation_data=(x_test, y_test), callbacks=[reduce_lr, checkpointer], shuffle=True) Second way; model.save_weights("model_weights.h5") What is the difference between the two ways? Any difference in prediction performance between loading weights.hdf5 and model

How does one have parameters in a pytorch model not be leafs and be in the computation graph?

爷,独闯天下 提交于 2020-03-18 04:06:23
问题 I am trying to update/change the parameters of a neural net model and then having the forward pass of the updated neural net be in the computation graph (no matter how many changes/updates we do). I tried this idea but whenever I do it pytorch sets my updated tensors (inside the model) to be leafs, which kills the flow of gradients to the networks I want to receive gradients. It kills the flow of gradients because leaf nodes are not part of the computation graph the way I want them to be

Should I normalize my features before throwing them into RNN?

烂漫一生 提交于 2020-03-17 12:06:30
问题 I am playing some demos about recurrent neural network. I noticed that the scale of my data in each column differs a lot. So I am considering to do some preprocess work before I throw data batches into my RNN. The close column is the target I want to predict in the future. open high low volume price_change p_change ma5 ma10 \ 0 20.64 20.64 20.37 163623.62 -0.08 -0.39 20.772 20.721 1 20.92 20.92 20.60 218505.95 -0.30 -1.43 20.780 20.718 2 21.00 21.15 20.72 269101.41 -0.08 -0.38 20.812 20.755 3

Keras Tokenizer num_words doesn't seem to work

北城以北 提交于 2020-03-17 08:31:28
问题 >>> t = Tokenizer(num_words=3) >>> l = ["Hello, World! This is so&#$ fantastic!", "There is no other world like this one"] >>> t.fit_on_texts(l) >>> t.word_index {'fantastic': 6, 'like': 10, 'no': 8, 'this': 2, 'is': 3, 'there': 7, 'one': 11, 'other': 9, 'so': 5, 'world': 1, 'hello': 4} I'd have expected t.word_index to have just the top 3 words. What am I doing wrong? 回答1: There is nothing wrong in what you are doing. word_index is computed the same way no matter how many most frequent words

Is tf.layers.dense a single layer?

三世轮回 提交于 2020-03-17 08:30:14
问题 If I just use a single layer like this: layer = tf.layers.dense(tf_x, 1, tf.nn.relu) Is this just a single layer with a single node? Or is it actually a set of layers (input, hidden, output) with 1 node? My network seemed to work properly with just 1 layer, so I was curious about the setup. Consequently, does this setup below have 2 hidden layers (are layer1 and layer2 here both hidden layers)? Or actually just 1 (just layer 1 )? layer1 = tf.layers.dense(tf_x, 10, tf.nn.relu) layer2 = tf

Convert string categorical data in data frame to Numeric data

倖福魔咒の 提交于 2020-03-05 05:32:06
问题 I have the following values (800) in my data frame cat1 <- c("bi", "bt", "ch", "fs", "hc", "lh", "mo", "ms", "nn", "ro", "sc", "si", "so", "ti", "ww", "dt", "3et", "a", "a", "a", "a", "a", "a", "aam", "aao", "ac", "acs", "aeo", "aeq", "afm", "aic", "aio", "akq", "am", "am", "am", "am", "amc", "amc", "aoq", "aoq", "aot", "apm", "apo", "apo", "aqf", "ass", "ata", "ata", "atc", "atf", "atq", "atr", "aun", "bae", "baf", "bai", "bcm", "bcs", "bea", "bee", "bef", "bem", "bem", "bem", "bem", "bem",

Keras Neural Network Accuracy is always 0 While Training

社会主义新天地 提交于 2020-03-05 05:05:35
问题 I'm making a simple classification algo with a keras neural network. The goal is to take 3 data points on weather and decide whether or not there's a wildfire. Here's an image of the .csv dataset that I'm using to train the model(this image is only the top few lines and isn't the entire thing ): wildfire weather dataset As you can see, there are 4 columns with the fourth being either a "1" which means "fire", or a "0" which means "no fire". I want the algo to predict either a 1 or a 0. This

Keras Neural Network Accuracy is always 0 While Training

你。 提交于 2020-03-05 05:05:22
问题 I'm making a simple classification algo with a keras neural network. The goal is to take 3 data points on weather and decide whether or not there's a wildfire. Here's an image of the .csv dataset that I'm using to train the model(this image is only the top few lines and isn't the entire thing ): wildfire weather dataset As you can see, there are 4 columns with the fourth being either a "1" which means "fire", or a "0" which means "no fire". I want the algo to predict either a 1 or a 0. This

What can I do to change dot in comma?

北慕城南 提交于 2020-03-04 23:16:22
问题 Good morning! I'm new of python, I use Spyder 4.0 to build neural network. In the script below I use the random forest in order to do feature importances. So the values importances are the ones that tell me what is the importance of each features. Unfortunatly I can't upload the dataset, but I can tell you that there are 18 features and 1 label, both are phisical quantyties and it's a regression problem. I want to export in a excel file the variable importances , but when I do it (simply

What can I do to change dot in comma?

和自甴很熟 提交于 2020-03-04 23:15:59
问题 Good morning! I'm new of python, I use Spyder 4.0 to build neural network. In the script below I use the random forest in order to do feature importances. So the values importances are the ones that tell me what is the importance of each features. Unfortunatly I can't upload the dataset, but I can tell you that there are 18 features and 1 label, both are phisical quantyties and it's a regression problem. I want to export in a excel file the variable importances , but when I do it (simply