theano

input dimensions to a one dimensional convolutional network in keras

喜夏-厌秋 提交于 2019-11-28 17:54:58
really finding it hard to understand the input dimensions to the convolutional 1d layer in keras: Input shape 3D tensor with shape: (samples, steps, input_dim). Output shape 3D tensor with shape: (samples, new_steps, nb_filter). steps value might have changed due to padding. I want my network to take in a time series of prices (101, in order) and output 4 probabilities. My current non-convolutional network which does this fairly well (with a training set of 28000) looks like this: standardModel = Sequential() standardModel.add(Dense(input_dim=101, output_dim=100, W_regularizer=l2(0.5),

Keras accuracy does not change

非 Y 不嫁゛ 提交于 2019-11-28 16:48:37
问题 I have a few thousand audio files and I want to classify them using Keras and Theano. So far, I generated a 28x28 spectrograms (bigger is probably better, but I am just trying to get the algorithm work at this point) of each audio file and read the image into a matrix. So in the end I get this big image matrix to feed into the network for image classification. In a tutorial I found this mnist classification code: import numpy as np from keras.datasets import mnist from keras.models import

How to add and remove new layers in keras after loading weights?

妖精的绣舞 提交于 2019-11-28 16:27:59
问题 I am trying to do a transfer learning; for that purpose I want to remove the last two layers of the neural network and add another two layers. This is an example code which also output the same error. from keras.models import Sequential from keras.layers import Input,Flatten from keras.layers.convolutional import Convolution2D, MaxPooling2D from keras.layers.core import Dropout, Activation from keras.layers.pooling import GlobalAveragePooling2D from keras.models import Model in_img = Input

机器学习的主要编程框架

ぃ、小莉子 提交于 2019-11-28 12:36:38
来源 :《暗知识-机器认知如何颠覆商业和社会》   TensorFlow是由谷歌大脑团队开发的,主要用于机器学习和深度神经网络的研究。2016年5月,谷歌从Torch(一种编程框架)转移到TensorFlow,这对其他编程框架造成了打击,特别是torch和theanoo许多人将TensorFlow描述成一个比theano更现代化的版本,吸取了这些年在新领域/技术的许多重要的经验教训。   TensorFlow以智能、灵活的方式而闻名,是一种高度可扩展的机器学习系统,使其更容易适应不同的新旧产品和研究,并且比较容易安装,还针对初学者提供了教程,涵盖神经网络的理论基础和实际应用。TensorFlow比theano和torch慢,但谷歌和开源社区正在解决这个问题。TensorBoard是TensorFlow的可视化模块,它提供了一个计算路径的直观视图。深度学习库Keras被移植到TensorFlow上运行,这意味着任何用Keras编写的模型现在都可以运行在TensorFlow上。最后,值得一提的是TensorFlow可以在各种硬件上运行,其特点如下: (1)GPU加速:支持 (2)语言/界面:Python、Numpy、C++ (3)平台:跨平台 (4)维护者:谷歌   theano起源于2007年在蒙特利尔大学的知名MILA(学习算法研究所),是用Python编写的CPU

theano - use tensordot compute dot product of two tensor

醉酒当歌 提交于 2019-11-28 11:35:33
I want to use tensordot to compute the dot product of a specific dim of two tensors. Like: A is a tensor, whose shape is (3, 4, 5) B is a tensor, whose shape is (3, 5) I want to do a dot use A's third dim and B's second dim, and get a output whose dims is (3, 4) Like below: for i in range(3): C[i] = dot(A[i], B[i]) How to do it by tensordot? Well, do you want this in numpy or in Theano? In the case, where, as you state, you would like to contract axis 3 of A against axis 2 of B, both are straightforward: import numpy as np a = np.arange(3 * 4 * 5).reshape(3, 4, 5).astype('float32') b = np

Installing Theano on EPD (Windows x64)

我的未来我决定 提交于 2019-11-28 09:41:38
问题 I'm trying to install Theano on Enthought Python Distribution (EPD), but I am getting a weird error. Here is what my installation looks like: I have installed EPD to C:\Python27 . After that, I have installed pip by using easy_install pip I installed Theano by using pip install Theano To test, I start ipython and type import theano . I get the following error: Problem occurred during compilation with the command line below: g++ -shared -g -IC:\Python27\lib\site-packages\numpy\core\include -IC

Keras-learn-note(1)

巧了我就是萌 提交于 2019-11-28 08:17:04
越努力,越幸运。 欢迎访问我的博客 Sky’s blog 一些基本概念 在开始学习Keras之前,一些基础知识是必备的,关于深度学习的基本概念和技术,在使用Keras之前大体了解一下基础知识,这将减少你学习中的困惑。 1.符号计算 Keras的底层库使用Theano或TensorFlow,这两个库也称为Keras的后端。无论是Theano还是TensorFlow,都是一个“符号式”的库。 因此,这也使得Keras的编程与传统的Python代码有所差别。笼统的说,符号主义的计算首先定义各种变量,然后建立一个“计算图”,计算图规定了各个变量之间的计算关系。建立好的计算图需要编译以确定其内部细节,然而,此时的计算图还是一个“空壳子”,里面没有任何实际的数据,只有当你把需要运算的输入放进去后,才能在整个模型中形成数据流,从而形成输出值。 就像用管道搭建供水系统,当你在拼水管的时候,里面是没有水的。只有所有的管子都接完了,才能送水。 Keras的模型搭建形式就是这种方法,在你搭建Keras模型完毕后,你的模型就是一个空壳子,只有实际生成可调用的函数后(K.function),输入数据,才会形成真正的数据流。 2.张量 张量是什么,一上来我也一脸懵逼,看了解释之后,嗯嗯。 张量可以看作是向量、矩阵的自然推广,用张量来表示广泛的数据类型。 规模最小的张量是0阶张量,即标量,也就是一个数。

Keras: “RuntimeError: Failed to import pydot.” after installing graphviz and pydot

独自空忆成欢 提交于 2019-11-28 08:11:32
I'm using Anaconda Python 2.7 on windows 10 I was planning on doing Keras visualization so (whilst spyder was open) I opened the Anaconda command prompt and pip installed graphviz and pydot. Now when I try run the following: from keras.models import Sequential or any sort of "from keras." , I get the error: ImportError: cannot import name gof I have uninstalled and reinstalled Keras, Graphviz and pydot. i am using the development version of theano. I cannot find a fix. P.S If I uninstall graphviz and pydot, keras works again EDIT After uninstalling anaconda and reinstalling it including theano

Installing theano

﹥>﹥吖頭↗ 提交于 2019-11-28 02:05:01
I installed theano with Spyder 2.3.8 on Windows 7 64-bit by running "pip install theano". It worked well. But then, when I tried to run "import theano", I got the following error: Traceback (most recent call last): File "", line 1, in import theano File "D:\Anaconda3\lib\site-packages\theano\__init__.py", line 55, in from theano.compile import \ File "D:\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 9, in from theano.compile.function_module import * File "D:\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 18, in import theano.compile.mode File "D:\Anaconda3

How to install Theano on Anaconda Python 2.7 x64 on Windows?

自闭症网瘾萝莉.ら 提交于 2019-11-27 19:03:35
I wonder how to install Theano on Anaconda Python 2.7 x64 on Windows 7 x64. The Theano website provides some instructions but is not clear as to what is specific to Anaconda. I'm not 100% certain but this may be a minimal set of instructions, but only if you don't want to use a GPU. Getting Theano to use a GPU on Windows is quite a bit more difficult. Install TDM GCC x64. Install Anaconda x64. run conda update conda . run conda update --all . run conda install mingw libpython . Install Theano (how you do this depends on whether you want to interact with the Theano source code or not, and