Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

scientific report: Abstract Introduction Materials & Methods Results Discussion Referen Add external information, no problem Earthquake Prediction Model with Machine Learning THECLEVERPROGRAMMER I ( )

scientific report:

Abstract

Introduction

Materials &Methods

Results

Discussion

Referen

Add external information, no problem
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Earthquake Prediction Model with Machine Learning THECLEVERPROGRAMMER I ( ) NOVEMEER 12,2020 I E MACHINE LEARNING In this article, I will take you through how to create a model for the task of Earthquake Prediction using Machine Learning and the Python programming language. Predicting earthquakes is one of the great unsolved problems in the earth sciences. With the increase in the use of technology, many seismic monitoring stations have increased, so we can use machine learning and other data-driven methods to predict earthquakes. Also, Read - Machine Learning Full Course for free. Earthquake Prediction Model with Machine Learning It is well known that if a disaster occurs in one region, it is likely to happen again. Some regions have frequent earthquakes, but this is only a comparative amount compared to other regions. So, predicting the earthquake with date and time, latitude and longitude from previous data is not a trend that follows like other things, it happens naturally. I will start this task to create a model for earthquake prediction by importing the necessary python libraries: 3 inport matplotifb. pyplot as plt earthquake.py hosted with by GitHub Now let's load and read the dataset. The dataset that I am using here can be easily downloaded here: 1 data = pd, read_cs v( "database, c5v) 2 data, colunns earthquake,py hosted with by Github Index (f 'Date', 'Time', 'Latitude', "Longitude', "Type', 'Depth', 'Depth Error', 'Depth Seismic Stations', 'Magnitude', 'Magnitude Type", 'Magnitude Error', 'Magnitude Seismic Stations', 'Azimuthal Gap', "Horizontal Distance', "Horizontal Error', 'Root Mean Square', "ID', 'Source', 'Location Source', 'Magnitude Source', 'Statua', . dtype='object') Now let's see the main characteristics of earthquake data and create an object of these characteristics, namely, date, time, latitude, longitude, depth, magnitude: 1 data = data[l'Date', 'Tine', 'Latitude', 'Longitude', 'Depth', 'Magnitude' 1] 2 data.head( ) earthquake.py hosted with by Github Since the data is random, so we need to scale it based on the model inputs. In this, we convert the given date and time to Unix time which is in seconds and a number. This can be easily used as an entry for the network we have built: earthquake.py hosted with by citHub Data Visualization Now, before we create the earthquake prediction model, let's visualize the data on a world map that shows a clear representation of where the earthquake frequency will be more: Splitting the Dataset Now, to create the earthquake prediction model, we need to divide the data into Xs and ys which respectively will be entered into the model as inputs to receive the output from the model. Here the inputs are TImestamp, Latitude and Longitude and the outputs are Magnitude and Depth. I'm going to split the xs and y into train and test with validation. The training set contains 80% and the test set contains 20% : Neural Network for Earthquake Prediction Now I will create a neural network to fit the data from the training set. Our neural network will consist of three dense layers each with 16,16,2 nodes and reread. Relu and softmax will be used as activation functions: Now I'm going to define the hyperparameters with two or more options to find the best fit: 1. tron keras,wrappers_scikit_learn inport keraiclassifler modet = Kerasclassifierfpuild_fncreate_nodel, verboseief 2 neurens =[16,64,125,256] neurons =16 b batch_size =(10,23,50,100] batch_site ={10] 9. epochs ={101 16. " activation = ['relu", "tanh?, "signaid', "hardsigeoid', "tinear", "exgonestiat'] activation = ['signoid', 'relu'] optimizer =1560, 'Adsdetta'I Loss = ['squared_hinge'] pacan_grid = dictineuronseneurons, batch_size=batch_size, epochs-epochis, activation-activatian, optimizeraptieizer, toss: Now we need to find the best fit of the above model and get the mean test score and standard deviation of the best fit model: grif e CritleardicV(estieatereodel, paran_grideparac_arid, in jeem-1) grid_result in arid,titixitrain, y_train? seas = gridiretulf, cv resulti, t mean_test sicere'l itas =-orit_rebat. parase o artdertsute,ci_resulfs_l'parans'l for mean, stdet, paran in riptneans, stdi, garans): 9 grinti +t (vt }withi ur 1 in \{nean, stdev, paran)\} warthquele sy bocted with 9 by quthlu Seat: 0.957655 using f'activation" "re.1a", "bateh_ntze' 110, 'epochs "1 10, "1osa': 'squared_hinge', 'neurons': 16, 'optinizer'y 'Sco') 0.333316(0.471398) witht ('activation'i 'siqmold", "bateh isite":10, "epochs': 10 , "1oas"" 'mquared hinge'. 'neurons', 16 , 'optinizer' 'SGD') 0.000000 (0,000000) Witht ('activation' I "igmotd', 'bateh aize' 10, 'epochs': 10, "loss'; "squared hinge", "neurons"; 16, "optintrer't 'Mdadelta') 0,957655 (0,029957) with: f'activatioa": "rolu', 'batch_site': 10, 'epocha' ; 10, 'losa't 'squared hinge", 'neurono"t 16, "optimizer': "gco') 0.645111 (0.456960) with: f'aetivation't 'rela", "batch_atze'1 10, 'epochs': 10, 'loss": 'suared hinge", 'neurons"; 16 , "optintrer' 'Rdade 1eaJ In the step below, the best-fit parameters are used for the same model to calculate the score with the training data and the test data: 1. nocht = Mebintiatf) mednt, addipease (1s, activatiene' relu")) eotel, dditbense(2, aetivatien-'sittax') ) (test_toss, test_ace) = sodet. fraluate (x2 iess, y y_test) 14 printi" Eraluation result on Test oata + Leps = Dl. acceracy =(), fermat(tent_tess. test_acc)\} earthouake py hosed wath by olioud Evaluation result on zest. Data Lons = 0.5038455790406056. accuracy =0.9241777017558995 So we can see in the above output that our neural network model for earthquake prediction performs well. I hope you liked this article on how to create an earthquake prediction model with machine learning and the Python programming language. Feel free to ask your valuable questions in the comments section below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions