Posts

Showing posts with the label neural-network

ValueError: Error when checking input: expected gru_5_input to have shape (None, None, 10) but got array with shape (1, 4, 1)

Image
Clash Royale CLAN TAG #URR8PPP ValueError: Error when checking input: expected gru_5_input to have shape (None, None, 10) but got array with shape (1, 4, 1) I am trying to make hourly predictions using a recurrent neural network using TensorFlow and Keras in Python.I have assigned my inputs of the neural network to be (None, None, 5) shown in my . However, I am getting the errorː ValueError: Error when checking input: expected gru_3_input to have shape (None, None, 10) but got array with shape (1, 4, 1) My MVCE code isː ValueError: Error when checking input: expected gru_3_input to have shape (None, None, 10) but got array with shape (1, 4, 1) %matplotlib inline #!pip uninstall keras #!pip install keras==2.1.2 import tensorflow as tf import pandas as pd from pandas import DataFrame import math import numpy from sklearn.preprocessing import MinMaxScaler from keras.models import Sequential import datetime from keras.layers import Input, Dense, GRU, Embedding from keras.optimizers import...

How to let a chatbot use a model already trained

Image
Clash Royale CLAN TAG #URR8PPP How to let a chatbot use a model already trained I am trying for the first time to build a chatbot. Following this tutorial, I already have a jupyter notebook solution that is working with a model already trained. import nltk from nltk.stem.lancaster import LancasterStemmer import numpy as np import tflearn import tensorflow as tf import random import json from ._conv import register_converters as _register_converters stemmer = LancasterStemmer() with open('intents.json') as json_data: intents = json.load(json_data) words = classes = documents = ignore_words = ['?'] # loop through each sentence in our intents patterns for intent in intents['intents']: for pattern in intent['patterns']: # tokenize each word in the sentence w = nltk.word_tokenize(pattern) # add to our words list words.extend(w) # add to documents in our corpus documents.append((w, intent['tag']...

Can TensorFlow support spiking neurons?

Image
Clash Royale CLAN TAG #URR8PPP Can TensorFlow support spiking neurons? I looked around for tutorials/articles/examples/... to use spiking neurons (e.g. of the SRM/Spike Response Model type) in TensorFlow, but I could not find anything. Is it possible to simulate these models in TensorFlow at all? Can TensorFlow simulate models which explicitely depend on time? Are there any plug-ins/extensions/data files which can add this capability? Is the GPU supported? 3 Answers 3 I was also interested in this problem and have done exactly what Pietro mentioned. i.e. Took a matlab implementation of a simplified Hodgkin-Huxley model and converted it to Tensorflow. Have a look at https://github.com/jotia1/spiking-net-tensorflow https://joshuaarnold.com.au/simulating-spiking-nets-in-tensorflow/ for the blog post with some of my thoughts on the whole process. broken link Interested in hearing your thoughts on i...

Scaling back the output of neural network (ANN) for multivariate regression?

Image
Clash Royale CLAN TAG #URR8PPP Scaling back the output of neural network (ANN) for multivariate regression? I do not have any background in machine learning and neural network. I have a panda dataframe in python where one variable is an unknown function of other independent variables: output = func(input1, input2, ...). So when I plot the output vs any of the output I get a scatter plot without any clear relation between the output and input. So I use ANN to try to find the relation. I have this code: from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, MinMaxScaler, Normalizer, RobustScaler from sklearn.neural_network import MLPRegressor X = Data[['input1','input2','input3','input4','input5','input6']].values y = Data[['output']].values X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.15) scaler = StandardScaler() scaler.fit(X_train) X_train_scaled = sca...