-1

I have four sets of data (3 for training, 1 for testing) that include the hour of the day and temperatures in this format:
Time | Temperature
5, 60
6, 63
7,70
8,73
9,78
10,81.5
11,85.1
12,87
13,90
I need to train and test a perceptron and then predict what the temperatures will be on the next day at the same hours.
I am trying to use Matlab to do this and I know I am supposed to normalize the data and use time-series prediction. However I can't figure out how to start.
I don't understand what the inputs and outputs are, and what activations function to use to make the output linearly from -infinity to +infinity.

StefanM
  • 789
  • 1
  • 10
  • 17
Regza123
  • 23
  • 1
  • 8

1 Answers1

0

I'm pretty sure you won't have to use a perceptron for this task as you want to perform regression and not classification. (Perceptron is a binary classifier see Matlab documentation.)

To start with normalization: You need to adjust your data such that the mean is zero and the standard deviation equals 1. For example:

data = rand(1,100);
data = (data - mean(data))/sqrt(var(data));

You can interpret your input and output as follows: You have an underlying function which maps your time-values to the temperature values (f:time->temperature). Time is the independent variable and temperature the dependent variable (see for example Wikipedia). And you want to find an approximation for f based on your input data.

For time series regression you will find a detailed example here. If you are required to use a feedforward network you can also take a look at this.

StefanM
  • 789
  • 1
  • 10
  • 17
  • Thanks for your answer! Do I normalize both columns or just the temperature calumn? And also what activation function do I use? – Regza123 Nov 02 '16 at 17:47
  • You only normalize the dependent variable (temperature). – StefanM Nov 02 '16 at 17:53
  • For the Matlab functions above you don't have to specify an activation function. However common activation functions are sigmoid, tangens and ReLU functions. – StefanM Nov 02 '16 at 17:56
  • Sorry to keep asking questions. So I just train three times and test once and then predict? How do I see the training or testing error? Thanks again :) – Regza123 Nov 02 '16 at 18:24
  • The Matlab functions let you input your training data as one matrix so you will train only one time. – StefanM Nov 03 '16 at 10:30
  • @Regza123 Then you predict for your testing data to gauge the results of your training. And then you predict for the other days. – StefanM Nov 03 '16 at 10:40
  • I just need to make one prediction for the next day. And I have three separate training files for three days for the same hours, how do I train once? Should I combine the files? Thanks! – Regza123 Nov 03 '16 at 16:36
  • Depends which function you are using. In most cases of Matlab functions I am aware of you combine your training data as two vectors `ti` and `te` with `ti` being the vector of time points and `te` being the measured temperature. – StefanM Nov 03 '16 at 19:06
  • So in your case: `ti=[5 6 7...]`, `te=[60 63 70...]` then you initialize with `net = patternnet(...)` (for example) and execute 'net = train(net,ti,te)`. – StefanM Nov 03 '16 at 19:11