[PYTHON] Zura predicting today's temperature with TensorFlow

Today's temperature forecast

I want to study TensorFlow, but I don't know what to make, so I consulted with my seniors.

Wai "Senior, I want to study machine learning using TensorFlow. Is there any good subject?" Senior "Noisy. I'm busy so I'll leave you later." Wai "..."

Let's predict the temperature in Tokyo. .. .. (´ ・ ω ・ `)

Input dataset

The Japan Meteorological Agency has released various past data, so download csv from here http://www.data.jma.go.jp/gmd/risk/obsdl/index.php

Teacher data shows average, highest and lowest temperatures for the 10 years from 2005 to 2015 in Osaka and Tokyo. Test data shows average, highest and lowest temperatures for the last year

11.7,16.8,7.1
13.5,18.5,8.6
12.7,18.3,9
9.2,14.5,6.5
12,18.4,4.4
16.2,23.2,9

10 years worth of like this

I tried to implement

This is the actual code

Input data is In the shape of [batch_size, 3, 9], prepare a Tensor with a length of 9 for one week in Osaka, two days before Tokyo, and the day before in the order of average temperature, maximum temperature, and minimum temperature.

Implemented with a simple 4-layer perceptron

Output by flatten → Full Connect → activation → (repeated) → (average temperature, maximum temperature, minimum temperature) I added Dropout and L2loss later

result

I plotted the actual temperature and forecast results with matplotlib

average.png max.png min.png

It's not a big network, so CPU is enough for learning. The number of units was small enough, so learning was completed in an instant.

Hmm, it's quite difficult to predict the maximum temperature. .. Well, I wonder if this is the limit because the dimension of the input data is quite small. Since the performance did not improve even if the parameters were increased, it was judged that no more accuracy could be expected unless other meteorological data was added to the input, and the process ended.

Impressions

tf.layers API Easy to use Ask Google about tomorrow's temperature If you come up with it, try to improve it

Anyone who is kind, I would be grateful if you could give me some advice! !! !!

Recommended Posts

Zura predicting today's temperature with TensorFlow
Zundokokiyoshi with TensorFlow
Breakout with Tensorflow
Reading data with TensorFlow
Kyotei forecast with TensorFlow
Try regression with TensorFlow
Translate Getting Started With TensorFlow
Use TensorFlow with Intellij IDEA
Approximate sin function with TensorFlow
Jetson Nano JETPACK 44.1 (2020/10/21) with Tensorflow
Easy image classification with TensorFlow
Stock price forecast with tensorflow
Zura with softmax function implemented
Try TensorFlow MNIST with RNN