python-Grey forecast Average house price trend Kera Deep Learning Library Introduction

Source: Internet
Author: User
Tags keras

 ###### #编程环境: Anaconda3 (64-bit)->spyder (python3.5)
fromKeras.modelsImportSequential #引入keras库 fromKeras.layers.coreImportDense, Activationmodel= Sequential ()#Building a modelModel.add (Dense (12,input_dim=2))#Input Layer 2 node, hide layer 12 nodes (The number of nodes can be set by itself)
Model.add (Activation ('Relu'))#Use the Relu function as an activation function to provide significant accuracy
Model.add (Dense (1,input_dim=12))#dense hidden layer 12 node, output layer 1 node
Model.compile (loss='Mean_squared_error', optimizer='Adam')#compiling the Model
Model.fit (X_train, y_train, Nb_epoch = 10000, batch_size = 16)#training model, learning 10,000 times; an optimization algorithm for batch_size deep learning
Model.save_weights (Modelfile)#Saving model Parameters

The above is the main code to estimate the price of a city in grey:

    • Keras: Deep Learning Library, Keras-based underlying library uses Theano or tensorflow, so introducing this library requires first installing TensorFlow
    • add: support for sequential operations such as: through
      Model.add (Dense (12,input_dim=2)) Model.add (Activation (' Relu ')) Add elements of the model in turn
    • dense layer (fully connected layer): mainly defines the main structure of input, output and hidden layer of the model.
      Dense (12,input_dim=2) is a hidden layer of 12 nodes, the input layer is 2 nodes, and the input layer must be the second parameter.
    • activation function (Activation): can be self-contained in the Keras library, or it can be customized
    • objective function (loss function): target function, or loss function, is one of the two parameters required to compile a model
      • Model.compile (loss= ' mean_squared_error ', optimizer= ' Adam ') #编译模型 "Chinese Document: http://keras-cn.readthedocs.io/en/latest/ Other/objectives/"

python-Grey forecast Average house price trend Kera Deep Learning Library Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.