Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add external information, no problem Earthquake Prediction Model with Machine Learning THECLEVERPROGRAMMER I ( ) NOVEMBER 12,2020 I E MACHINE LEAREING In this article, I

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
image text in transcribed
Earthquake Prediction Model with Machine Learning THECLEVERPROGRAMMER I ( ) NOVEMBER 12,2020 I E MACHINE LEAREING 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 matplot1ib. 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_csv("database, c5vm) 2 data. colunns earthquake.py hosted with by Github Index (l 'Date', 'Time", 'Latitude', 'Longitude', "Type', 'Depth', 'Depth Error', 'Depth Seismic Stations', 'Magnitude', 'Magnitude Type'. 'Magnitude Error', 'Magnitude Seismic Stations', 'Azimuthai Gap', "Horizontal Distance", 'Horizontal Error', 'Root Mean Square', 'ID', 'Source', 'Location Source', 'Magnitude Source', 'statur'1. 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[I'Date', 'Tine', 'Latitude', 'Longitude', 'Depth', 'Magnitude' I] 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 ys into train and test with validation. The training set contains 80% and the test set contains 20% : x = final_data I['Tinestang", "Latitude', 'Longitude'II y= final_data [f'Magnitude', 'Depth'l] fron sklearn.cross_validation inport train_test_split 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 l'm going to define the hyperparameters with two or more options to find the best fit: 1 troe keras, wrappers, scikit_learo inport Kerasclassifier. modet = Kerasclassitier touilo_f thicreate _odel, verbose:0] neurens =[16,64,128,256] neurons =[161 b batchsize - {10,20,50,120} butch_size =[10] 9. epochs =[10] 10. F activation = ['rolu", "tanh', "signoid', "hardsigmoide", 'tizear', 'emonentiat' ] 11 activation = ['signoid', 'relu'] 13. optinizer =1 'SGO', 'Adsdelta' 1. 14 Loss = ['squared_hinge'] 16 . Paran orid = dictineuronseneurons, batch_size=batchsize, epochs-epoctis, activation-activatian, optintzeraoptiaizer, loss: 16 paran_grid = dictineuronsweurons, batchcsaze-batchisize, spectsegeche view raw 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: grid = Critiferdicviestieaterieodet, parat_grideparac_arid, in foein-1) grid_result is arid,titix_tratn, y_train? 5 neas: grid_renult, cv_results. I'neanctest icore'l 6 stas = prit_rebattick_readts_['ste_teat_icore'] 7 paraes o gridertsutt,ci_getsults_l'parans'1 II for mean, steev, paran in ripteeans, stdr, garans): 9 grinti gr (vf) withi r1 i { inean, stdev, paran)\} warthquene ay botied wim 6 by gitile Sest: 0,957655 using f'activation", 're.1a", "bateh_sizet 1 10, "epochs'i 10 , "1osa': 'squared_hinge', 'neurons': 16, 'optimizer', 'Sco') 0.333316(0.47139b) wtht ('activation'i 'optinizer' 'SGD') 0.000000 (0,000000) witht ('activation' nignotd', "batch aize' 10, 'epochs': 10, 'loss"; "squaredihinge", "neurons"; 16, "optinizer't 'Mdadelta') 0,957655 (0,029957) with: f'activatioa': "relu', 'batch_site': 10, 'epocha' ; 10, 'losa'i 'rela", "batch_aize'1 10, 'epochs': 10, 'loss": 'scguared hinge", 'neurons'" ; 16 , "optintrer' 'Rdade 1ea J 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. rodt min Mevitiatf) 2. mocel.adscienie(16, activationn' relu*. iopt_whspes(3,1)) modaliadofbease (1s, activationi' relu")) eoteliddsibensetz, activatiene'sotteax')y notel, coaplie coptiniters'sco', Loisu'squared_hanpe', ketricsil (accoracy'l) (trest_ioss, test_ace) = sode L. Fraluate 1, test, y_test) eartheuake py hewed wath br oulicad Evaluation reoult on zest pata Lons = 0.5038455790406056. accuracy = 0.9241777017.58995 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. You will usually follow the following sequence in actually writing your report, but note that the abstract (if you include it) will come first among these elements in the final report: Abstract Introduction Materials \& Methods Results Discuss ion Referen

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

Question

List the five steps in the message-sending process.

Answered: 1 week ago

Question

List and explain the four steps in the communication process.

Answered: 1 week ago

Question

Describe how communication flows through organizations.

Answered: 1 week ago