[PYTHON] Learning record No. 26 (30th day)

Learning record (30th day)

Start studying: Saturday, December 7th

Teaching materials, etc .: ・ Miyuki Oshige "Details! Python3 Introductory Note ”(Sotec, 2017): 12/7 (Sat) -12/19 (Thu) read ・ Progate Python course (5 courses in total): 12/19 (Thursday) -12/21 (Saturday) end ・ Andreas C. Müller, Sarah Guido "(Japanese title) Machine learning starting with Python" (O'Reilly Japan, 2017): 12/21 (Sat) -December 23 (Sat) ・ Kaggle: Real or Not? NLP with Disaster Tweets: Posted on Saturday, December 28th to Friday, January 3rd Adjustment ・ Wes Mckinney "(Japanese title) Introduction to data analysis by Python" (O'Reilly Japan, 2018): 1/4 (Wednesday) to 1/13 (Monday) read ・ Yasuki Saito "Deep Learning from Zero" (O'Reilly Japan, 2016): 1/15 (Wed) -1/20 (Mon) ・ ** François Chollet “Deep Learning with Python and Keras” (Queep, 2018): 1/21 (Tue) ~ **

"Deep learning with Python and Keras"

p.94 Chapter 3 Finished reading up to the neural network.

Regression model with keras


from keras import models
from keras import layers

def build_model():

    #You can add layers with add. This time it consists of two layers
    model = models.Sequential() 

    #input(input_shape)A hidden layer is created with 64 units, and the activation function is ReLU.
    model.add(layers.Dense(64, activation = 'relu',
                           input_shape=(train_data.shape[1],)))

    #2nd layer
    model.add(layers.Dense(64, activation = 'relu'))

    #Since it is a final layer scalar regression problem, the activation function is not applied. (The number width is fixed.)
    model.add(layers.Dense(1))

    #Weight adjustment optimizer is rmsprop, loss function is mse, index is mae
    model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])

    return model

I have no idea what the comma ** after ** shape [1] of the 3rd argument input_shape in the 1st layer means, and if I remove the comma because I think it is unnecessary, I will throw an error, so I will search for various things. While turning around, I found the following article

What does TensorFlow shape (?,) mean? (stackoverflow)

Apparently, the comma is used to get a tensor that takes any dimension.

And after doing so far

python


train_data.shape[1] = 13

input_shape(13, )

I noticed that. It was like slicing, and I made a misunderstanding that it was a special process of putting a comma outside the list [].

If you get stuck, it's important to first read the structure without rushing, and then subdivide and understand it one by one.

Recommended Posts

Learning record No. 21 (25th day)
Learning record No. 24 (28th day)
Learning record No. 23 (27th day)
Learning record No. 25 (29th day)
Learning record No. 26 (30th day)
Learning record No. 20 (24th day)
Learning record No. 14 (18th day) Kaggle4
Learning record No. 15 (19th day) Kaggle5
Learning record 4 (8th day)
Learning record 9 (13th day)
Learning record 3 (7th day)
Learning record 5 (9th day)
Learning record 6 (10th day)
Learning record 8 (12th day)
Learning record 1 (4th day)
Learning record 7 (11th day)
Learning record 2 (6th day)
Learning record 16 (20th day)
Learning record 22 (26th day)
Learning record 13 (17th day) Kaggle3
Learning record No. 17 (21st day)
Learning record No. 18 (22nd day)
Learning record No. 19 (23rd day)
Learning record No. 29 (33rd day)
Learning record No. 28 (32nd day)
Learning record No. 27 (31st day)
Learning record 11 (15th day) Kaggle participation
Programming learning record day 2
Learning record
Learning record # 1
Learning record # 2
Python learning day 4
Learning record (2nd day) Scraping by #BeautifulSoup
Learning record (4th day) #How to get the absolute path from the relative path
Learning record so far
Go language learning record
Linux learning record ① Plan
Effective Python Learning Memorandum Day 15 [15/100]
Effective Python Learning Memorandum Day 6 [6/100]
Effective Python Learning Memorandum Day 12 [12/100]
Learning record (3rd day) #CSS selector description method #BeautifulSoup scraping
Rabbit Challenge Deep Learning 1Day
<Course> Deep Learning: Day1 NN
Learning record (6th day) #Set type #Dictionary type #Mutual conversion of list tuple set #ndarray type #Pandas (DataFrame type)
Effective Python Learning Memorandum Day 14 [14/100]
Subjects> Deep Learning: Day3 RNN
Effective Python Learning Memorandum Day 13 [13/100]
Effective Python Learning Memorandum Day 3 [3/100]
Effective Python Learning Memorandum Day 5 [5/100]
Effective Python Learning Memorandum Day 4 [4/100]
Effective Python Learning Memorandum Day 7 [7/100]
Effective Python Learning Memorandum Day 2 [2/100]
Thoroughly study Deep Learning [DW Day 0]