I copied and pasted tensorflow's official Basic classification: Classify images of clothing code https://www.tensorflow.org/tutorials/keras/classification
import tensorflow as... moreI copied and pasted tensorflow's official Basic classification: Classify images of clothing code https://www.tensorflow.org/tutorials/keras/classification
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
fashion_mnist = tf.keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
and ran it. Upon running it printed a load of gibberish and wouldn't stop (almost like when you accidentally put a print in a while loop):
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz
so I terminated it. The above is just a VERY small portion of what printed. I ran it again, only to get an error straight away.
line 7, in <module>
(train_images, train_labels), (test_images,... less
I have two question:
(1) The question about importing some subpackages inside tensorflow.keras.
(2) How to differentiate between the packages installed by 'pip install' and 'conda... moreI have two question:
(1) The question about importing some subpackages inside tensorflow.keras.
(2) How to differentiate between the packages installed by 'pip install' and 'conda install'.(under windows)
I am using anaconda with tensorflow 2.0.0. I am trying to import package like:
import tensorflow.keras.utils.np_utils
However, the error shown that:
---------------------------------------------------------------------------
> ModuleNotFoundError Traceback (most recent call
> last) <ipython-input-2-ee1bc59a14ab> in <module>
> ----> 1 import tensorflow.keras.utils.np_utils
>
> ModuleNotFoundError: No module named 'tensorflow.keras.utils.np_utils'
I am confused about why this is happening, I install the tensorflow with command:
conda install tensorflow==2.0.0
from Anaconda prompt.
Yes, I know the anaconda should have already had all the data science package inside it, the reason that I uninstall tensorflow provided by anaconda and reinstall it was before using... less
I'm trying to train a word embedding classifier using TF2.4 with Keras and using the tf.nn.sampled_softmax_loss. However, when calling the fit method of the model, "Cannot convert... moreI'm trying to train a word embedding classifier using TF2.4 with Keras and using the tf.nn.sampled_softmax_loss. However, when calling the fit method of the model, "Cannot convert a symbolic Keras input/output to a numpy array" TypeError occurs. Please help me to fix the error or with an alternative approach to do candidate sampling.
import tensorflow as tf
import numpy as np
I am training on 970 samples and validating on 243 samples.
How big should batch size and number of epochs be when fitting a model in Keras to optimize the val_acc? Is there any... moreI am training on 970 samples and validating on 243 samples.
How big should batch size and number of epochs be when fitting a model in Keras to optimize the val_acc? Is there any sort of rule of thumb to use based on data input size?
I have trained a binary classification model with CNN, and here is my code
model = Sequential()
model.add(Convolution2D(nb_filters, kernel_size, kernel_size,
... moreI have trained a binary classification model with CNN, and here is my code
model = Sequential()
model.add(Convolution2D(nb_filters, kernel_size, kernel_size,
border_mode='valid',
input_shape=input_shape))
model.add(Activation('relu'))
model.add(Convolution2D(nb_filters, kernel_size, kernel_size))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=pool_size))
# (16, 16, 32)
model.add(Convolution2D(nb_filters*2, kernel_size, kernel_size))
model.add(Activation('relu'))
model.add(Convolution2D(nb_filters*2, kernel_size, kernel_size))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=pool_size))
# (8, 8, 64) = (2048)
model.add(Flatten())
model.add(Dense(1024))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(2)) # define a binary classification problem
model.add(Activation('softmax'))
model.compile(loss='categorical_crossentropy',
optimizer='adadelta',
metrics=)
model.fit(x_train,... less
I'm currently trying to visualize the learned filters of my CNN with tensorflow in python. I found many versions working with the mnist dataset while training a new network,... more
I'm currently trying to visualize the learned filters of my CNN with tensorflow in python. I found many versions working with the mnist dataset while training a new network, but wasn't able to apply it to my application. I trained an Estimator object, which is stored on my disk, with a custom dataset. The model contains layers such as
<span class="pln">conv1 </span><span class="pun">=</span><span class="pln"> tf</span><span class="pun">.</span><span class="pln">layers</span><span class="pun">.</span><span class="pln">conv2d</span><span class="pun">(</span><span class="pln">inputs</span><span class="pun">=</span><span class="pln">input_layer</span><span class="pun">,</span><span class="pln"> filters</span><span class="pun">=</span><span class="lit">32</span><span class="pun">,</span><span class="pln"> kernel_size</span><span class="pun">=,</span><span class="pln"> padding</span><span class="pun">=</span><span class="str">"same"</span><span class="pun">,</span><span class="pln">... less
I really need help implementing a continuous tanh-sigmoid activation function in a very basic neural network. If you could give a basic example that would be great, but if you... moreI really need help implementing a continuous tanh-sigmoid activation function in a very basic neural network. If you could give a basic example that would be great, but if you could change it in my source code I would be extremely grateful! Also, what range should the random weights be initiated with (i.e. what range)?
When it comes to installing Tensorflow, I've tried each of the installation suggestions on this page.
https://www.tensorflow.org/install/install_mac
-Pip +... moreWhen it comes to installing Tensorflow, I've tried each of the installation suggestions on this page.
https://www.tensorflow.org/install/install_mac
-Pip + Pip3
-virtualenv
-With Docker
The only installation method that I was unable to apply was Conda. My default environment for Data Science is Spyder launched from Anaconda_Navigator. However, I am unable to get the Conda command to work, in any form, from the command line.
My goal is to get tensor flow working from the iPython console from with in Spyder.
I am trying to run the suggested validation code:
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Here is the information on my iPython installation:
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
Type "copyright", "credits" or "license" for more information.
IPython 5.3.0 -- An enhanced Interactive Python.
The first line of code throws the following error.
ModuleNotFoundError: No module named... less
As someone who just got into data science (no prior coding history) I am new to using terminals, Python, and coding in general. While I do have some basic Python knowledge now,... moreAs someone who just got into data science (no prior coding history) I am new to using terminals, Python, and coding in general. While I do have some basic Python knowledge now, and I want to work on my first machine learning project, I am looking to use some packages that are not standard to python or jupyter lab, namely: TensorFlow.
After much struggle I was able to download TensorFlow in my terminal (i'm on Mac). Yet when I try to import to module I come to the following problem:
when I create a new file in jupyterlab (accessed via Anaconda) I have the option to create a python file using python 3 or python 3.7.2. When using python 3, I have access to packages to sklearn, SciPy, yet no TensorFlow. Then when I create a 3.7.2. file I can import the TensorFlow package, yet I cannot import the sklearn and SciPy packages anymore....
Did someone experience similar problems? Are there ways to solve this?
P.s. Using the 'pip install ...' command in terminal only sees to work rarely. Or I must be something... less
Hi I just installed Tensorflow on my Mac and I want to use tf.contrib.slim but when I use it I get this
import tensorflow as tf
slim =... moreHi I just installed Tensorflow on my Mac and I want to use tf.contrib.slim but when I use it I get this
import tensorflow as tf
slim = tf.contrib.slim
Error:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/export/export_lib.py", line 25, in from tensorflow.python.saved_model.model_utils import build_all_signature_defs ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils'
I don't know what to do, I use Tensorflow.13.1 and python 3.7 less
def fib(max): n, a, b = 0, 0, 1 while n < max: yield b a, b = b, a + b n = n + 1 return 'done' print(next(fib(6))) print(next(fib(6))) print(next(fib(6)))
the result... moredef fib(max): n, a, b = 0, 0, 1 while n < max: yield b a, b = b, a + b n = n + 1 return 'done' print(next(fib(6))) print(next(fib(6))) print(next(fib(6)))
the result is 1,1,1. However, if I change the content in print() as below:
f = fib(6) print(next(f)) print(next(f)) print(next(f))
the result will be 1, 1, 2. Why does this happen?
*I try to install tensorflow and kerasI installed tensorflow and I imported it with no errorsKeras is installed but I can't import it *
(base) C:\Windows\system32>pip uninstall... more*I try to install tensorflow and kerasI installed tensorflow and I imported it with no errorsKeras is installed but I can't import it *
(base) C:\Windows\system32>pip uninstall keras
Found existing installation: Keras 2.3.1
Uninstalling Keras-2.3.1:
Would remove:
c:\users\asus\anaconda3\anaconda\lib\site-packages\docs\*
c:\users\asus\anaconda3\anaconda\lib\site-packages\keras-2.3.1.dist-info\*
c:\users\asus\anaconda3\anaconda\lib\site-packages\keras\*
Proceed (y/n)? y
Successfully uninstalled Keras-2.3.1
(base) C:\Windows\system32>pip install keras
Collecting keras
Using cached Keras-2.3.1-py2.py3-none-any.whl (377 kB)
Requirement already satisfied: six>=1.9.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from keras) (1.14.0)
Requirement already satisfied: numpy>=1.9.1 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from keras) (1.18.4)
Requirement already satisfied: keras-applications>=1.0.6 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from keras)... less
In MNIST LSTM examples, I don't understand what "hidden layer" means. Is it the imaginary-layer formed when you represent an unrolled RNN over time?
Why is the num_units =... moreIn MNIST LSTM examples, I don't understand what "hidden layer" means. Is it the imaginary-layer formed when you represent an unrolled RNN over time?
Why is the num_units = 128 in most cases ?
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?In my opinion, 'VALID' means there will be no zero padding outside the edges when we do... moreWhat is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?In my opinion, 'VALID' means there will be no zero padding outside the edges when we do max pool.According to A guide to convolution arithmetic for deep learning, it says that there will be no padding in pool operator, i.e. just use 'VALID' of tensorflow. But what is 'SAME' padding of max pool in tensorflow?