Inspired Search作业代做、代写Python语言作业

2019-03-20  本文已影响0人  kanghuanzhi

Nature Inspired Search and Optimisation 2018/2019Lab 4: Time Series Prediction with GPReleased: March 5, 2019Deadline: March 19, 2019Weight: 10 % for 06-27819, or 11.25 % for 06-27818 %You need to implement one program that solves Exercises 1-3 using any programming language.In Exercise 5, you will run a set of experiments and describe the result using plots and a shortdiscussion.(In the following, replace abc123 with your username.) You need to submit one zip file withthe name niso3-abc123.zip. The zip file should contain one directory named niso3-abc123containing the following files: the source code for your program a Dockerfile (see the appendix for instructions) a PDF file for Exercises 4 and 5In this lab, we will do a simple form of time series prediction. We assume that we are given somehistorical data, (e.g. bitcoin prices for each day over a year), and need to predict the next value inthe time series (e.g., tomorrow’s bitcoin value).We formulate the problem as a regression problem. The training data consists of a set of minput vectors X = (x(0), . . . , x(m1)) representing historical data, and a set of m output valuesY = (x(0), . . . , x(m1)), where for each 0 ≤ j ≤ m ? 1, x(j) ∈ Rn and y(j) ∈ R. We will use geneticprogramming to evolve a prediction model f : Rn → R, such that f(x(j)) ≈ y(j).1Candidate solutions, i.e. programs, will be represented as expressions, where each expression evaluatesto a value, which is considered the output of the program. When evaluating an expression,we assume that we are given a current input vector x = (x0, . . . , xn?1) ∈ Rn. Expressions and evaluationsare defined recursively. Any floating number is an expression which evaluates to the valueof the number. If e1, e2, e3, and e4 are expressions which evaluate to v1, v2, v3 and v4 respectively,then the following are also expressions (add e1 e2) is addition which evaluates to v1 + v2, e.g. (add 1 2)≡ 3 (sub e1 e2) is subtraction which evaluates to v1 ? v2, e.g. (sub 2 1)≡ (mul e1 e2) is multiplication which evaluates to v1v2, e.g. (mul 2 1)≡ (div e1 e2) is division which evaluates to v1/v2 if v2 6= 0 and 0 otherwise, e.g., (div 4 2)≡ 2,and (div 4 0)≡ 0, (pow e1 e2) is power which evaluates to v, e.g., (pow 2 3)≡ 8 (sqrt e1) is the square root which evaluates to √v1, e.g.(sqrt 4)≡ 2 (log e1) is the logarithm base 2 which evaluates to log(v1), e.g. (log8)≡ 3 (exp e1) is the exponential function which evaluates to ev1, e.g. (exp 2)≡ e2 ≈ 7.39 (max e1 e2) is the maximum which evaluates to max(v1, v2), e.g., (max 1 2)≡ 2 (ifleq e1 e2 e3 e4) is a branching statement which evaluates to v3 if v1 ≤ v2, otherwise theexpression evaluates to v4 e.g. (ifleq 1 2 3 4)≡ 3 and (ifleq 2 1 3 4)≡ 4 (data e1) is the j-th element xj of the input, where j ≡ |bv1c| mod n. (diff e1 e2) is the difference xk x` where k ≡ |bv1c| mod n and ` ≡ |bv2c| mod n (avg e1 e2) is the average 1|k`|Pmax(k,`)1t=min(k,`)xt where k ≡ |bv1c| mod n and ` ≡ |bv2c|mod nIn all cases where the mathematical value of an expression is undefined or not a real number (e.g.,√1, 1/0 or (avg 1 1)), the expression should evaluate to 0.We can build large expressions from the recursive definitions. For example, the expression(add (mul 2 3) (log 4))evaluates to2 · 3 + log(4) = 6 + 2 = 8.To evaluate the fitness of an expression e on a training data (X , Y) of size m, we use the meansquare error is the value of the expression e when evaluated on the input vector x(j).2Exercise 1. (30 % of the marks)Implement a routine to evaluate expressions. You can assume that the input describes a syntacticallycorrect expression. Hint: Use a library for parsing s-expressions.Input arguments: -expr an expression -n the dimension of the input vector n -x the input vectorOutput: the value of the expressionExample:[pkl@phi ocamlec]$ niso_lab3 -question 1 -n 1 -x 1.0 -expr (mul (add 1 2) (log 8))9.0[pkl@phi ocamlec]$ niso_lab3 -question 1 -n 2 -x 1.0 2.0 -expr (max (data 0) (data 1))2.0Exercise 2. (10 % of the marks) Implement a routine which computes the fitness of an expressiongiven a training data set.Input arguments: -expr an expression -n the dimension of the input vector -m the size of the training data (X , Y) -data the name of a file containing the training data in the form of m lines, where each linecontains n + 1 values separated by tab characters. The first n elements in a line representsan input vector x, and the last element in a line represents the output value y.Output: The fitness of the expression, given the data.3Exercise 3. (30 % of the marks)Design a genetic programming algorithm to do time series forecasting. You can use any geneticoperators and selection mechanism you find suitable.Input arguments: -lambda population size -n the dimension of the input vector -m the size of the training data (X , Y) -data the name of a file containing training data in the form of m lines, where each linecontains n + 1 values separated by tab characters. The first n elements in a line representsan input vector x, and the last element in a line represents the output value y. -time budget the number of seconds to run the algorithmOutput: The fittest expression found within the time budget.Exercise 4. (10 % of the marks)Describe your algorithm from Exercise 3 in the form of pseudo-code. The pseudo-code should besufficiently detailed to allow an exact re-implementation.Exercise 5. (20 % of the marks)In this final task, you should try to determine parameter settings for your algorithm which lead toas fit expressions as possible.Your algorithm is likely to have several parameters, such as the population size, mutation rates,selection mechanism, and other mechanisms components, such as diversity mechanisms.Choose parameters which you think are essential for the behaviour of your algorithm. Run a set ofexperiments to determine the impact of these parameters on the solution quality. For each parametersetting, run 100 repetitions, and plot box plots of the fittest solution found within the time budget.4A. Docker HowtoFollow these steps exactly to build, test, save, and submit your Docker image. Please replace abc123in the text below with your username.1. Install Docker CE on your machine from the following website:https://www.docker.com/community-edition2. Copy the PDF file from Exercises 4 and 5 all required source files, and/or bytecode to anempty directory named niso3-abc123 (where you replace abc123 with your username).mkdir niso3 - abc123cd niso3 - abc123 /cp ../ exercise . pdf .cp ../ abc123 . py .3. Create a text file Dockerfile file in the same directory, following the instructions below.# Do not change the following line . It specifies the base image which# will be downloaded when you build your image .FROM pklehre / niso2019 - lab3# Add all the files you need for your submission into the Docker image ,# e . g . source code , Java bytecode , etc . In this example , we assume your# program is the Python code in the file abc123 . py . For simplicity , we# copy the file to the / bin directory in the Docker image . You can add# multiple files if needed .ADD abc123 . py / bin# Install all the software required to run your code . The Docker image# is derived from the Debian Linux distribution . You therefore need to# use the apt - get package manager to install software . You can install# e . g . java , python , ghc or whatever you need . You can also# compile your code if needed .# Note that Java and Python are already installed in the base image .# RUN apt - get update# RUN apt - get -y install python - numpy# The final line specifies your username and how to start your program .# Replace abc123 with your real username and python / bin / abc123 . py# with what is required to start your program .CMD [ - username , abc123 , - submission , python / bin / abc123 . py ]54. Build the Docker image as shown below. The base image pklehre/niso2019-lab3 will bedownloaded from Docker Hubdocker build . -t niso3 - abc1235. Run the docker image to test that your program starts. A battery of test cases will be executedto check your solution.docker run niso3 - abc1236. Once you are happy with your solution, compress the directory containing the Dockerfile asa zip-file. The directory should contain the source code, the Dockerfile, and the PDF file forExercise 4 and 5. The name of the zip-file should be niso3-abc123.zip (again, replace theabc123 with your username).7. Submit the zip file niso3-abc123.zip on Canvas.本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

上一篇 下一篇

猜你喜欢

热点阅读