theano

Neural Network Ordinal Classification for Age

妖精的绣舞 提交于 2020-01-12 07:22:13
问题 I have created a simple neural network (Python, Theano) to estimate a persons age based on their spending history from a selection of different stores. Unfortunately, it is not particularly accurate. The accuracy might be hurt by the fact that the network has no knowledge of ordinality. For the network there is no relationship between the age classifications. It is currently selecting the age with the highest probability from the softmax output layer. I have considered changing the output

Keras, how do I predict after I trained a model?

China☆狼群 提交于 2020-01-11 14:57:12
问题 I'm playing with the reuters-example dataset and it runs fine (my model is trained). I read about how to save a model, so I could load it later to use again. But how do I use this saved model to predict a new text? Do I use models.predict() ? Do I have to prepare this text in a special way? I tried it with import keras.preprocessing.text text = np.array(['this is just some random, stupid text']) print(text.shape) tk = keras.preprocessing.text.Tokenizer( nb_words=2000, filters=keras

Theano.function equivalent in Tensorflow

两盒软妹~` 提交于 2020-01-11 11:51:48
问题 I am wondering if there is any equivalent to theano.function(inputs=[x,y], # list of input variables outputs=..., # what values to be returned updates=..., # “state” values to be modified givens=..., # substitutions to the graph) in TensorFlow 回答1: The run method on the tf.Session class is quite close to theano.function . Its fetches and feed_dict arguments are moral equivalents of outputs and givens . 回答2: Theano's function returns an object that acts like a Python function and executes the

Import theano gives the AttributeError: module 'theano' has no attribute 'gof'

夙愿已清 提交于 2020-01-10 19:36:08
问题 I have python 3. I installed "Theano" bleeding edge and "Keras" using pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git and also pip install --upgrade git+git://github.com/Theano/Theano.git and pip install git+git://github.com/fchollet/keras.git But when I try to import Theano, I receive the following error: AttributeError: module 'theano' has no attribute 'gof' I looked for a solution online and reached nothing... This is the piece of code I receive an error on (the last

CNN with keras, accuracy not improving

不羁的心 提交于 2020-01-10 10:44:05
问题 I have started with Machine Learning recently, I am learning CNN, I planned to write an application for Car Damage severity detection, with the help of this Keras blog and this github repo. This is how car data-set looks like: F:\WORKSPACE\ML\CAR_DAMAGE_DETECTOR\DATASET\DATA3A ├───training (979 Images for all 3 categories of training set) │ ├───01-minor │ ├───02-moderate │ └───03-severe └───validation (171 Images for all 3 categories of validation set) ├───01-minor ├───02-moderate └───03

How to make Theano operate on Mac Lion?

天大地大妈咪最大 提交于 2020-01-07 04:37:07
问题 I need to have Theano operate on my Mac for a school project. I downloaded sources from here (first line of the table) and put the untared file in the repertory of my school project. I didn't know if this was sufficient, so I also used pip install Theano . Everything seems fine since I got this : You are using pip version 6.1.1, however version 7.0.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Requirement already satisfied (use --upgrade to upgrade

broadcasting linalg.pinv on a 3D theano tensor

空扰寡人 提交于 2020-01-06 19:38:24
问题 in the example below, there is a 3d numpy matrix of size (4, 3, 3)+ a solution about how to calculate pinv of each of 4 of those 3*3 matrices in numpy. I also tried to use the same function worked in numpy, in theano hoping that it is implemented the same, but it failed. Any idea how to do it in theano? dt = np.dtype(np.float32) a=[[[12,3,1], [2,4,1], [2,4,2],], [[12,3,3], [2,4,4], [2,4,5],], [[12,3,6], [2,4,5], [2,4,4],], [[12,3,3], [2,4,5], [2,4,6]]] a=np.asarray(a,dtype=dt) print(a.shape)

How do I set many elements in parallel in theano

笑着哭i 提交于 2020-01-06 18:31:09
问题 Lets say I create a theano function, how do I run operations in parallel elementwise on theano tensors like on matrices? # This is in theano function. Instead of for loop, I'd like to run this in parallel c = np.asarray(shape=(2,200)) for n in range(0,20): # some example in looping this is arbitrary and doesn't matter c[0][n] = n % 20 c[1][n] = n / 20 # in cuda, we normally use an if statement # if (threadIdx.x === some_index) { c[0][n] = some_value; } The question should be reformed, how do

how to calculate log posterior of a GP over a trace in pymc3

眉间皱痕 提交于 2020-01-06 05:56:07
问题 Use case Suppose I have an observation y_0 at X_0 which I'd like to model with a Gaussian process with hyper params theta . Suppose I then determine a distribution in the hyper params theta by hierarchically sampling the posterior. Now, I'd like to evaluate the log posterior probability of another observation say y_1 at X_1 , averaged over the hyper param distribution, E_theta [ log P(y_1 | y_0, X_0, X_1, theta) ] Ideally, I'd draw from the posterior in theta and calculate log P(y_1 | y_0, X

Getting ImportError while importing keras

扶醉桌前 提交于 2020-01-05 07:15:20
问题 I have followed every step for installing keras but whenever I am trying to import keras it gives me an error No module named tensorflow. But I have already installed tensorflow. I have two questions- 1. How can I solve this particular ImportError? 2. If possible can anyone give me a detailed step by step instruction on installing theano, tensorflow and keras? Please don't give any links to install keras because i have tried them all but they keep giving some kind of error or problem. If