CMN 222 Winter 2025 Guided Exercise 2: Interactive Wireframe Due: Fri. Feb. 7, 11:59pm ET Overview Create a wireframe. for an imaginary website using Adobe XD. Format Submit a text file (e.g. .txt, .rtf, .doc, or .docx) with both your sharing link and any password you've set (if the link isn’t public). Content Choose a concept you’ve brainstormed for the Major Assignment Series, and create a wireframe for it that show the user experience. Consider using the one you also used for your Site Map; however, if you choose, you may select a different concept to work with. (Remember, the Major Assignment Series asks you to brainstorm concepts for a company or organization that would provide a service for an underserved portion of the TMU community.) Remember to: • Include at least 4 separate screens connected together • Focus on the user’s mobile experience (i.e. on a phone or phone-like device) Assessment 15% The website concept could apply to the Major Assignment Series 15% There are at least 4 main screens. 15% The 4 screens are connected/interconnected. 15% The wireframe. focusses on a mobile experience. 40% The wireframe is complete and includes all the components necessary to understand the user experience. Generative AI Guidelines Using generative AI such as ChatGPT is not recommended, but you may use it to brainstorm, spell-/grammar-check, and/or create citations. If you do, you must indicate on your submission how you’ve used it. You may not use generative AI to generate images, video, audio, multimedia, text, or code.
[pdf-embedder url="https://assignmentchef.com/wp-content/uploads/2025/01/A2B_Specification.pdf"] FIT5202 - Data processing for Big Data 2025 SSB Assignment 2: Building Models for Realtime Food Delivery Prediction Weight: 30% (15% A2A+15% A2B) Background Food delivery services have become an integral part of modern society, revolutionising the way we consume meals and interact with the food industry. These platforms, accessible through websites and mobile apps, provide a convenient bridge between restaurants and consumers, allowing users to browse menus, place orders, and have food delivered directly to their doorstep with just a few taps. In today's fast-paced world, where time is a precious commodity, food delivery services offer an invaluable solution, catering to busy lifestyles, limited mobility, and the ever-present desire for convenience. In the food delivery industry, accurate on-time delivery prediction is paramount. Big data processing allows companies to achieve this by analysing vast datasets encompassing order details, driver performance, real-time traffic, and even weather. Objective of the Project In the first assignment (A1), we performed data analysis with the datasets to uncover key trends and patterns related to delivery times, order volumes, and other crucial metrics. In assignment 2A, we will harness the power of Apache Spark's MLLib to construct and train machine learning models. We will focus on accurately and efficiently predicting delivery times. Finally, assignment 2B will utilise Apache Spark Structured Streaming and our ML model from 2A to process live data streams and dynamically make predictions. Key Information This is a two-part assignment (A2A and A2B) that requires staged submissions. In part A2A, you are going to use the provided dataset, complete the assignment tasks, and build your ML model; then, in part A2B, the trained ML model will be used in combination with streaming data to make real-time predictions. A2A Due Date: (23:55 Friday 31/Jan/2025, End of Week 5) A2B Due Date: (23:55 Wednesday 5/Feb/2025, Mid of Week 6) Submission links can be found in Moodle. Weight: 30% of Final Marks (15% each for 2A and 2B) A2A and A2B will be marked separately. A2B has a compulsory interview/demo component, which will be conducted during the last lab. The teaching team only marks A2B submissions during your demo session. Failure to attend this demo will result in 0 marks (for A2B). (Please pay attention to the unit announcement in the final teaching week. If you have an extension/special consideration, more demo sessions will be arranged.) The Datasets: - order.csv - driver.csv - delivery_address.csv - restaurant.csv - new_order.csv (for A2B) What you need to achieve Use Case 1 (A2A) Based on the historical dataset, build a ML model that can predict food delivery time. Regression Use Case 2 (A2B) Use streaming data to perform. real-time prediction and visualise the results Spark Structured Streaming Architecture The following figure represents the overall architecture of the assignment setup. Part A of the assignment consists of preparing the data, performing data exploration and extracting features, and building and persisting the machine learning models. Fig 1: Overall Architecture for Assignment 2 In both parts, you must implement the solutions using PySpark DataFrame/MLlib for the data pre-processing and machine learning pipelines. Excessive use of Pandas for data processing is discouraged. Please follow the steps to document the processes and write the codes in your Jupyter Notebook. Getting Started ● Download the datasets from Moodle. ● Download a template file for submission purposes: ● A2A_template.ipynb file in Jupyter Notebook to write your solution. Rename it into the format (for example, A2A_xxxx0000.ipynb. xxxx0000 is your authcate ID. ● You will use Python 3+ and PySpark 3.5.0+ for this assignment (This environment is the same as we used in labs.) IMPORTANT: Please answer each question in your Jupyter Notebook file using code/markdown cells. Acknowledge any ideas or codes you referenced from others in the markdown cell or reference list. If you use generative AI tools, all prompts you use should also be included in the reference section or appendix. A2A Part 1: Data Loading, Transformation and Exploration (40%) In this section, you must load the given datasets into PySpark DataFrames and use DataFrame. functions to process the data. Spark SQL usage is discouraged, and you can only use pandas to format results. For plotting, various visualisation packages can be used, but please ensure that you have included instructions to install the additional packages, and that the installation will be successful in the provided docker container (in case your marker needs to clear the notebook and rerun it). 1.1 Data Loading (5%) 1. Write the code to create a SparkSession. Please use a SparkConf object to configure the Spark app with a proper application name, to ensure the maximum partition size does not exceed 16MB, and to run locally with 4 CPU cores on your machine. (2%) 2. Write code to define the schemas for the datasets, following the data types suggested in the metadata. Then, using predefined schemas, write code to load the CSV files into separate data frames. Print the schemas of all data frames. (3%) 1.2 Data Transformation to Create Features (10%) Feature engineering involves transforming, combining or extracting information from the raw data to create more informative and relevant features that improve the performance of your ML models. In our food delivery use case, the order_ts is not very useful when it is treated as a timestamp. However, it provides more information if you perform. transformation and extract valuable information from it, for example, extracting the day of the week (it may tell you how busy a restaurant is) or hours (peak hours may have bad traffic conditions). (Note: Some tasks may overlap with A1, feel free to use/reuse your own code/UDF from A1.) Perform. the following tasks based on the loaded data frames and create a new one. We will refer to this as feature_df, but feel free to use your own naming. (2% each) Please print 5 rows from the feature_df after each step. 1. Extract the day of the week (Monday-Sunday) and hour of the day (0-23) from order_ts, and store the extract information in 2 columns. 2. Create a new boolean column (isPeak) to indicate peak/non-peak hours. (Peak hours are defined as 7-9 and 16-18 in 24-hour format.) 3. Join the geolocation data frame of the restaurant and delivery location, get suburb information and add two columns. 4. Join data frames to add restaurant information to the feature_df: primary_cuisine, latitude, longitude, suburb and postcode. 5. Add columns you deem necessary from the dataset (at least one column is required). (hint: delivery driver’s vehicle type may affect the delivery time.) 1.3 Exploring the data (25%) 1. With the feature_df, write code to show the basic statistics: a) For each numeric column, show count, mean, stddev, min, max, 25 percentile, 50 percentile, 75 percentile; b) For each non-numeric column, display the top-5 values and the corresponding counts; c) For each boolean column, display the value and count. (5%) 2. Explore the dataframe and write code to present two plots, describe your plots and discuss the findings from the plots. (20%) ○ One of the plots must be related to our use case (predicting delivery time). ○ Hint 1: You can use basic plots (e.g., histograms, line charts, scatter plots) to show the relationship between a column and the label or use more advanced plots like correlation plots. ○ Hint 2: If your data is too large for plotting, consider using sampling before plotting. ○ 150 words max for each plot’s description and discussion ○ Feel free to use any plotting libraries: matplotlib, seabon, plotly, etc. A2A Part 2. Feature extraction and ML training (50%) In this section, you must use PySpark DataFrame. functions and ML packages for data preparation, model building, and evaluation. Other ML packages, such as scikit-learn, should not be used to process the data; however, it’s fine to use them to display the result or evaluate your model. 2.1 Discuss the feature selection and prepare the feature columns (10%) 1. Based on the data exploration from 1.2 and considering the use case, discuss the importance of those features (For example, which features may be useless and should be removed, which feature has a significant impact on the label column, which should be transformed), which features you are planning to use? Discuss the reasons for selecting them and how you plan to create/transform them. ○ 300 words max for the discussion ○ Please only use the provided data for model building ○ You can create/add additional features based on the dataset ○ Hint - Use the insights from the data exploration/domain knowledge/statistical models to consider whether to create more feature columns, whether to remove some columns 2. Write code to create/transform. the columns based on your discussion above. 2.2 Preparing Spark ML Transformers/Estimators for features, labels, and models (10%) 1. Write code to create Transformers/Estimators for transforming/assembling the columns you selected above in 2.1 and create ML model Estimators for Random Forest (RF) and Gradient-boosted tree (GBT) model. o Please DO NOT fit/transform. the data yet. 2. Write code to include the above Transformers/Estimators into two pipelines. o Please DO NOT fit/transform. the data yet. (Some students may be confused about the differences between 2.1.2 and 2.2.1. Task 2.1.2 is for the new or customised feature you discussed and created, while 2.2.1 is for the “standard” features in the dataset like road_condition or weather_condition, which obviously affect the delivery time.) 2.3 Preparing the training data and testing data (5%) 1. Write code to split the data for training and testing, using 2025 as the random seed. You can decide the train/test split ratio based on the resources available on your laptop. Note: Due to the large dataset size, you can use random sampling (say 20% of the dataset). 2.4 Training and evaluating models (25%) 1. Write code to use the corresponding ML Pipelines to train the models on the training data from 2.3. And then use the trained models to predict the testing data from 2.3 2. For both models (RF and GBT): with the test data, decide on which metrics to use for model evaluation and discuss which one is the better model (no word limit; please keep it concise). You may also use a plot for visualisation (not mandatory). 3. Save the better model (you’ll need it for A2B). (Note: You may need to go through a few training loops or use more data to create a better-performing model.) A2A Part 3. Hyperparameter Tuning and Model Optimisation (10%) 3.1 Apply the techniques you have learnt from the labs, for example, CrossValidator, TrainValidationSplit, ParamGridBuilder, etc., to perform further hyperparameter tuning and model optimisation. The assessment is based on the quality of your work/process, not the quality of your model. Please include your thoughts/ideas/discussions. (A2 Part B Specification: To be released in Week 5) Submission A2A You should submit your final version of the assignment solution online via Moodle. You must submit the files created: - Your jupyter notebook file A2A_authcate.ipynb - A pdf file saved from Jupyter Notebook with all output following the file naming format as follows: A2A_authcate.pdf - A2A Due date: (23:55 Friday 31/Jan/2025) Note that both submitted (ipynb and pdf) files will be scanned using plagiarism detection software. The highest similarity score among students may be interviewed to prove the originality of the task. Submission A2B You should submit your final version of the assignment solution via Moodle. You must submit the following: ● A zip file named based on your authcate name (e.g. abcd1234). The zip file should contain ○ Assignment-2B-Task1_producer_authcate.ipynb ○ Assignment-2B-Task2_spark_streaming_authcate.ipynb ○ Assignment-2B-Task3_consumer_authcate.ipynb The file in submission should be a ZIP file and not any other kind of compressed folder (e.g. .rar, .7zip, .tar). Please do not include the data files in the ZIP file. The A2B due date is 23:55 Wednesday 5/Feb/2025
1. Problem 1: (a) Construct the bilinear transformation w(z) = az + b cz + d that maps the region between the two circles |z − 1 4 | = 1 4 and |z − 1 2 | = 1 2 into an infinite strip bounded by the vertical lines u = ℜ{w} = 0 and u = ℜ{w} = 1. To avoid ambiguity, suppose that the outer circle is mapped to u = 1.(b) Upon finding the appropriate transformation w, carefully show that the image of the inner circle under w is the vertical line u = 0, and similarly for the outer circle.2. Problem 2: Use the result of Problem 1 to find the steady state temperature T(x, y) in the region bounded by the two circles, where the inner circle is maintained at T = 0°C and the outer circle at T = 100°C. Assume T satisfies the two-dimensional Laplace equation
1. Problem 1: (a) Let ˆf(s) and ˆg(s) be the Laplace transforms of one-sided functions f(t) and g(t), respectively. Show that the inverse Laplace transform of ˆf(s)ˆg(s) is Z t 0 f(t − τ )g(τ )dτ(b) Use the Laplace transform and the result in (a) to solve the following ordinary differential equation d 2y dt2 + 4y = f(t), subject to the initial conditions y(0) = 0, dy dt (0) = 02. Problem 2: Solve the following Laplace equation ∂ 2ϕ ∂x2 + ∂ 2ϕ ∂y2 = 0 in the upper half plane x ∈ (−∞, ∞) y ∈ [0, ∞), subject to the boundary conditions ϕ → 0 as y → ∞; ϕ → 0 as x → ±∞; ϕ(x, 0) = x x 2 + a 23. Problem 3: Use the Fourier transform to solve the following wave equation: ∂ 2u ∂t2 = c 2 ∂ 2u ∂x2 where x ∈ (−∞, ∞) and t ∈ [0, ∞), subject to the initial condition u(x, 0) = 0, ∂u ∂t (x, 0) = δ(x) and the boundary conditions u(x, t) → 0 as x → ±∞.
1. Problem 1: Evaluate the integrals 1 2πi I C f(z)dz where C is the unit circle centered at the origin with f(z) given below by (a) enclosing the singular points inside C, and (b) enclosing the singular points outside C by including the point at infinity t = 1 z as z → ∞. Show that you obtain the same result in both cases2. Problem 2: Find the Fourier transform of f(t) where f(t) = 1 for −a < t < a and f(t) = 0 otherwise. Then, do the inverse transform using techniques of contour integration, e.g. Jordan’s lemma, principle values, etc.3. Problem 3: Consider the function f(z) = ln(z 2 − 1) made single-valued by restricting the angles in the following ways, with z1 = z − 1 = r1e iθ1 and z2 = z + 1 = r2e iθ2 . Find where the branch cuts are for each case by locating where the function is discontinuous. Use AB tests and show your results.
1. Problem 1. From AF: 4.2.1 c d (a) Evaluate I = Z ∞ 0 dx (x 2 + a 2)(x 2 + b 2) where a 2 , b2 > 0.(b) Evaluate I = Z ∞ 0 dx x 6 + 12. Problem 2. From AF: 4.2.2 a, b h. Evaluate the following integrals: (a) R ∞ −∞ x sin(x) x2+a2 dx; a 2 > 0(b) R ∞ −∞ cos(kx)dx (x2+a2)(x2+b 2) ; a 2 , b2 , k > 0(c) R 2π 0 dθ (5−3 sin θ) 23. Problem 3. From AF: 4.2.7. Use a sector contour with radius R, as in Figure 4.2.6, centered at the origin with angle 0 ≤ θ ≤ 2π 5 to find, fora > 0, I = Z ∞ 0 dx x 5 + a 5 = π 5a 4 sin(π/5)
1. Problem 1: Using residue calculus, calculate I = Z ∞ −∞ sin x sinh x dx2. Problem 2: Using residue calculus, calculate I = Z ∞ −∞ 1 + cos(x) (x − π) 2 d3. Problem 3: Evaluate the following integral using residue calculus I = Z ∞ 0 x a a + 2x cos b + x 2 dx where −1 < a < 1, a ̸= 0, and −π < b < π, b ̸= 0. Justify all key steps. Do not use the general formula for this integral.
1. Problem 1: Evaluate H C f(z)dz where C is the unit circle centered at the origin and f(z) is given by the following: (a) e iz (b) e z 2 (c) 1 z−1/2 (d) 1 z 2−4 (e) 1 2z 2+1 (f) √ z − 4, with 0 ≤ z − 4 < 2π2. Problem 2: We wish to evaluate the integral Z ∞ 0 e ix2 dx Consider the contour IR = I C(R) e iz2 dz where C(R) is the closed circular sector in the upper half plane with boundary points 0, R, and Reiπ/4 . Show that IR = 0 and that lim R→∞ Z C1(R) e iz2 dz = 0 where C1(R) is the line integral along the circular sector from R to Reiπ/4 . Hint: Use sin(x) ≥ 2x π on 0 ≤ x ≤ π/2. Then, breaking up the contour C(R) into three component parts, deduce lim R→∞ Z R 0 e ix2 dx − e iπ/4 Z R 0 e −r 2 dr! = 0 and from the well-known result of real integration: Z ∞ 0 e −x 2 dx = √ π 2 deduce that I = e iπ/4√ π/2.3. Problem 3: Consider the integral I = Z ∞ −∞ dx x 2 + 1 Show how to evaluate this integral by considering I C(R) dz z 2 + 1 where C(R) is the closed semicircle in the upper half plane with endpoints at (−R, 0) and (R, 0) plus the x axis. Hint: use 1 z 2 + 1 = −1 2i 1 z + i − 1 z − i and show that the integral along the open semicircle in the upper half plane vanishes as R → ∞. Verify your answer by usual integration in real variables.4. Problem 4: Let f(z) = e t 2 (z−1/z) = X∞ n=−∞ Jn(t)z n Show from the definition of Laurent series and using properties of integration that Jn(t) = 1 2π Z π −π e −i(nθ−t sin θ) dθ = 1 π Z π 0 cos (nθ − tsin θ)dθ The functions Jn(t) are called Bessel functions, which are well-known special functions in mathematics and physics.
1. Problem 1: Express each of the following in polar exponential form. (a) −i (b) 1 + i (c) 1 2 + √ 3 2 i2. Problem 2: Express each of the following in the form of a + bi, where a and b are real. (a) e 2+iπ/2 (b) 1 1+i (c) (1 + i) 3 (d) |3 + 4i| (e) cos(iπ/4 + c), where c is real.3. Problem 3: Solve for the roots of the following equations. (a) z 3 = 4 (b) z 4 = −14. Problem 4: Establish the following results. (a) (z + w)∗ = z ∗ +w∗ (b) ℜ(z) ≤ |z| (c) |wz ∗ +w ∗ z| ≤ 2|wz| (d) |z1z2| = |z1||z2|
HW4.1. Pairs (Xi , Yi), i = 1, . . . , n consist of correlated standard normal random variables (mean 0, variance 1) forming a sample from a bivariate normal MVN 2(0, Σ) distribution, with covariance matrix Σ = ” 1 ρ ρ 1 # .The density of (X, Y ) ∼ MVN 2(0, Σ) is2 f(x, y|ρ) = 1 2π √ 1 − ρ 2 exp ( − 1 2(1 − ρ 2 ) (x 2 − 2ρxy + y 2 ) ) , with ρ as the only parameter. Take prior on ρ by assuming Jeffreys’ prior on Σ as π(Σ) = 1 |Σ| 3/2 = 1 (1−ρ 2) 3/2 , since the determinant of Σ is 1 − ρ 2 . Thus π(ρ) = 1 (1 − ρ 2 ) 3/2 1(−1 ≤ ρ ≤ 1).(a) If (Xi , Yi), i = 1, . . . , n are observed, write down the likelihood for ρ. Write down the expression for the posterior, up to the proportionality constant (that is, un-normalized posterior as the product of likelihood and prior).(b) Since the posterior for ρ is complicated, develop a Metropolis-Hastings algorithm to sample from the posterior. Assume that n = 100 observed pairs (Xi , Yi) gave the following summaries: X 100 i=1 x 2 i = 115.9707, X 100 i=1 y 2 i = 105.9196, and X 100 i=1 xiyi = 84.5247.In forming a Metropolis-Hastings chain take the following proposal distribution for ρ: At step i generate a candidate ρ ′ from the uniform U(ρi−1 − 0.1, ρi−1 + 0.1) distribution. Why the proposal distribution cancels in the acceptance ratio expression?(c) Simulate 51000 samples from the posterior of ρ and discard the first 1000 samples (burn in). Plot two figures: the histogram of ρs and the realizations of the chain for the last 1000 simulations. What is the Bayes estimator of ρ based on the simulated chain?(d) Replace the proposal distribution from (b) by the uniform U(−1, 1) (independence proposal). Comment on the results of MCMC.HW4.2. Exponentially distributed lifetimes have constant hazard rate equal to the rate parameter λ. When λ is a constant hazard rate, a simple way to model heterogeneity of hazards is to introduce a multiplicative frailty parameter µ, so that lifetimes Ti have distribution3 Ti ∼ f(ti |λ, µ) = λµ exp{−λµti}, ti > 0, λ, µ > 0. The prior on (λ, µ) is π(λ, µ) ∝ λ c−1µ d−1 exp{−αλ − βµ}, that is, λ and µ are apriori independent with distributions Ga(c, α) and Ga(d, β), respectively.The hyperparameters c, d, α and β are known (elicited) and positive.Assume that lifetimes t1, t2, . . . , tn are observed.(a) Show that full conditionals for λ and µ are gamma, [λ|µ, t1, . . . , tn] ∼ Gan + c, µXn i=1 ti + α ! , and by symmetry, [µ|λ, t1, . . . , tn] ∼ Gan + d, λXn i=1 ti + β ! .(b) Using the result from (a) develop Gibbs Sampler algorithm that will sample 21000 pairs (λ, µ) from the posterior and burn-in the first 1000 simulations. Assume that n = 20 and that the sum of observed lifetimes is P20 i=1 ti = 522. Assume further that the priors are specified by hyperparameters c = 3, d = 1, α = 100, and β = 5. Start the chain with µ = 0.1.(c) From the produced chain, plot the scatterplot of (λ, µ) as well as histograms of individual components, λ, and µ. Estimate posterior means and variances for λ and µ. Find 95% equitailed credible sets for λ and µ.(d) A frequentist statistician estimates the product λµ as P n n i=1 ti = 20/522 = 0.0383.What is the Bayes estimator of this product? (Hint: It is not the product of averges, it is the average of products, so you will need to save products in the MCMC loop).This is a toy example. In realistic applications the multiplicative frailty depends on the i, or on a subclass of population as µj(i) .
HW1.1. Chad is taking a Bayesian Analysis course. He believes he will get an A with probability 0.7. At the end of semester he will get a car as a present form his rich uncle depending on his class performance. For getting an A in the course he will get a car with probability 0.9, for anything less than A, he will get a car with probability of 0.1. If Chad gets a car, he would travel to Cocoa Beach with probability 0.7, or stay on campus with probability 0.3. If he does not get a car, these two probabilities are 0.2 and 0.8, respectively. After the semester was over you learn that Chad is in Cocoa Beach. What is the probability that he got a car?HW1.2. Carpal tunnel syndrome is the most common entrapment neuropathy. The cause of this syndrome is hard to determine, but it can include trauma, repetitive maneuvers, certain diseases, and pregnancy.Three commonly used tests for carpal tunnel syndrome are Tinel’s sign, Phalen’s test, and the nerve conduction velocity test. Tinel’s sign and Phalen’s test are both highly sensitive (0.98 and 0.92, respectively) and specific (0.91 and 0.88, respectively). The sensitivity and specificity of the nerve conduction velocity test are 0.93 and 0.87, respectively.2 Assume that the tests are conditionally independent.Calculate the sensitivity and specificity of a combined test if combining is done (a) in a serial manner;3 (b) in a parallel manner.4 (c) Find Positive Predictive Value (PPV) for tests in (a) and (b) if the prevalence of carpal tunnel syndrome in the general population is approximately 50 cases per 1000 subjects.1.3. A student answers a multiple choice examination with two questions that have four possible answers each. Suppose that the probability that the student knows the answer to a question is 0.70 and the probability that the student guesses is 0.30. If the student guesses, the probability of guessing the correct answer is 0.25.The questions are independent, that is, knowing the answer on one question is not influenced by the other question.(a) What is the probability that the both questions will be answered correctly? (b) If answered correctly, what is the probability that the student really knew the correct answer to both questions?(c) How would you generalize the above from 2 to n questions, that is, what are answers to (a) and (b) if the test has n independent questions? What happens to probabilities in (a) and (b) if n → ∞.
HW3.1. Marietta Traffic Authority is concerned about the repeated accidents at the intersection of Canton and Piedmont Roads. Bayes-inclined city-engineer would like to estimate the accident rate, even better, find a credible set.A well known model for modeling the number of road accidents in a particular location/time window is the Poisson distribution. Assume that X represents the number of accidents in a 3 month period at the intersection od Canton and Piedmont Roads.Assume that [X|θ] ∼ Poi(θ). Nothing is known a priori about θ, so it is reasonable to assume the Jeffreys’ prior π(θ) = 1 √ θ 1(0 < θ < ∞).In the four most recent three-month periods the following realizations for X are observed: 1, 2, 0, and 2. (a) Compare the Bayes estimator for θ with the MLE (For Poisson, recall, ˆθMLE = X¯). (b) Compute (numerically) a 95% equitailed credible set. (c) Compute (numerically) a 95% HPD credible set. (d) Numerically find the mode of the posterior, that is, MAP estimator of θ. (e) If you test the hypotheses H0 : θ ≥ 1 vs H1 : θ < 1, based on the posterior, which hypothesis will be favored?HW3.2. Find the Jeffreys’ prior for the parameter α of the Maxwell distribution p(x|α) = s 2 π α 3/2x 2 exp(− 1 2 αx2 )and find a transformation of this parameter in which the corresponding prior is uniform.HW3.3. Let yi |θi ∼ind. Exp(θi), θi ∼iid Inv − Gamma(α, 1), for i = 1, . . . , n. Find the empirical Bayes estimator of θi , i = 1, . . . , n (Note: If x ∼ Exp(θ), then p(x) = 1/θe−x/θ and if x ∼ Inv−Gamma(α, β), then p(x) = 1/{β αΓ(α)}x −α−1 e −1/(βx) .).
This project is split into two parts; the Branch Predictors and the Out-of-Order Processor. Please refer to Section 3 for information on implementing the Branch Predictors, and refer to Section 4 for information on implementing the Out-of-Order Processor. In this section, we will discuss simulator parameters and trace files, which are shared by both parts of the project.2.1 Simulator Parameters The following command line parameters can be passed to the simulator. Details on these parameters can be found in the corresponding sections listed in Section 2: • -x: When enabled, only run the Branch Predictors. • -i: The path to the input trace file • -h: Print the usage information. 2.1.1 Branch Predictor Specific Parameters • -b: Select the Branch Predictor to use. – 0: Always Taken (provided) – 1: Two-bits Smith Counter (provided) – 2: Yeh-Patt (for students in ECE 6100 & CS 6290) – 3: GShare (for everyone) • -p: Log2 of the number of entries in the Pattern Table for Yeh-Patt, or the number of 2-bit counters in GShare. – Restriction: P ≥ 9, small pattern tables are not very performant. • -H: Log2 of the number of entries in the History Table for Yeh-Patt. – Restriction: H ≥ 9, small history tables are not very performant. 2.1.2 Out-of-Order Processor Specific Parameters • -a: The number of Addition (ALU) function units in the Execute stage. • -m: The number of Multiply (MUL) function units in the Execute stage. • -l: The number of Load/Store (LSU) function units in the Execute stage. • -s: The number of reservation stations per function unit. The scheduling queue is unified, which means that s × (a + m + l) reservation stations are shared by all function units. • -f: The “Fetch Width”, which is the number of instructions fetched/added to the Dispatch queue per cycle. • -d: This flag has no argument; if it is passed, cache misses and mispredictions are disabled by the driver. Note that the upper bounds for some parameters are not defined. You will need to constraint these in the experiments according to Section 8.2.2 Trace Format Each line in a trace represents the following:
3.1 Prefetcher (+1 and Strided) In this project, you will build a simulator with a write-back, write-allocate L1 cache, and a write through, write-no-allocate L2 cache. You will only implement a prefetcher in the L2 cache. Remember that L2 cannot miss on write due to being write non-allocate. You only 1 prefetch a block when an L2 cache read miss happens and the block you want to bring in is not yet in the cache. In this project we will use two prefetching schemes.The first one being a simple +1 Prefetcher and the second one being a Strided Prefetcher. Since the minimum unit the Prefetcher can fetch is a block, we only use the block address and ignore the block offset. Where “block address” is the concatenation of the tag and the index. +1 Prefetcher: On a miss on block at block address X, if the next block (block at block address (X + 1)) is not in the cache, prefetch that block and insert it into the L2 cache. Prefetch (X + 1) only after inserting block X into the cache. Strided Prefetcher: On a miss on a block at block address X, then on a block at block address Y , prefetch the block at block address Y +k where k = Y −X, if block at address Y + k is not in the cache. k is the difference between the current miss and the previous. Prefetch (Y + k) only after the block at block Y is inserted into the cache. 3.1.1 Insertion Policies (MIP and LIP) In this project, we will consider two cache insertion policies when dealing with prefetching. The first is the standard insertion policy used in LRU replacement, which we call “MIP” for clarity: MRU Insertion Policy (MIP): The MRU insertion policy means that new blocks are inserted in the MRU position. MRU insertion policy is originally defined only under the LRU replacement policy.For this project, we extend the definition of MIP under the LFU replacement policy. In this project, we define the MIP under LFU as setting the MRU bit of a block and clear other the MRU bit of every other block in the same set. LRU Insertion Policy (LIP): Designed for L2 caches to avoid thrashing on workloads with low temporal locality, LIP inserts all new blocks at the LRU position. Similarly, for this project, we define of LIP under the LFU replacement policy. We define LIP under LFU as clearing the MRU bit of the inserted block and leaving the MRU bit of other blocks in the set unmodified. 4 Simulator Specifications In this project, you will build a simulator with a write-back, write-allocate L1 cache, and a write through, write-no-allocate L2 cache.Your simulator will receive a series of memory accesses from the CPU in a provided trace and must print some final statistics before exiting. 4.1 Simulator Configuration Both the L1 and L2 caches should implement LRU replacement (for everyone) and LFU replacement (for students in 6100 & 6290). The L1 cache follows the write-back, writeallocate write strategy. The L2 cache shares the L1 block size (B parameter) and follows the write-through, write-no-allocate write strategy. The system uses 64-bit addresses. The L1 cache in your simulator will have the following configuration knobs: • -c < CL1 >: A total size of 2CL1 bytes • -b < B >: Block size of 2B bytes. This will also be the block size used for the L2 cache 2Restriction: The block size must be reasonable: 5 ≤ B ≤ 7 • -s < SL1 >: 2SL1 -way associativity Restriction: SL1 ≥ 1 0 The L2 cache in your simulator will have the following configuration knobs: • -D: if this flag is supplied, the L2 cache is Disabled, it is enabled otherwise • -C < CL2 >: A total size of 2CL2 bytes Restriction: The size of the L2 cache must be strictly greater than the size of the L1 cache (CL2 > CL1) • -S < SL2 >: 2SL2 -way associativity Restriction: The associativity of the L2 cache must be greater than the associativity of the L1 cache (SL2 > SL1) Restriction: The L2 CL2 − SL2 must be greater than the L1 CL1 − SL1 • -P < 0, 1, 2 >: Sets the type of prefetcher to use – 0: Disable prefetcher – 1: Use +1 prefetcher Everyone – 2: Use Strided Prefetcher students in 6100 & 6290 • -I : Prefetcher Insertion PolicyThe following parameters apply to the entire simulation: • -r : Replacement policy for both caches: LRU (Everyone) or LFU (LFU is for students in 6100 & 6290) • -f : The filename/path for the trace to execute 4.2 Simulator Semantics 4.2.1 L1 And L2 Obliviousness In this project, the L1 cache does not know about the L2 cache, and vice versa. The bus connecting L1 to L2 is the width of an L1 cache block. Effectively, the L1 cache believes it is talking to memory, and the L2 cache believes it is talking to the CPU. For example, the L2 cache sees a write-back from L1 as a write to L2. So even during writebacks from L1, your L2 cache simulation code should increment L2 hit/miss statistics counters. Also, when performing a write to L2, if the block is present in L2 already, that block should be moved to the MRU position. (If the written block is not present in L2, do not add it, because L2 is write-through and write-no-allocate.) The L2 cache is write-through, meaning that the values in the L2 cache are always in sync with values in memory. Note that a write miss in L1 will first read the block from L2 and then update the L1 copy with the write.4.2.2 Prefetching Prefetching in the cache system is a trick that uses spatial/sequential locality to try to predict what blocks might be needed in the future. The main two types of prefetching schemes that we are going to implement in this cache system are the +1 prefetch and the strided prefetch. +1 Prefetching On an L2 cache read miss, we fetch the missing block from memory, but also fetch the next block in memory and bring it into the cache. If the next block is already in cache, we skip the prefetch. Strided Prefetching (for students in 6100 & 6290) On an L2 cache read miss, we not only fetch the missing block from memory, but also fetch the block that is k block addresses away where k equals the difference between the current block address and the previous miss’s block address block address. For every subsequent L2 read miss, make sure to use the most recent previous L2 read miss to calculate your stride. To implement the strided prefetcher, you keep track of ”previous miss”.You initialize ”previous miss” to 0x0. For the first L2 read miss, the prefetch address you calculated from that ”previous miss” may be meaningless. However, if that block at the calculated address is not in the cache, you still prefetch that block and increase prefetches l2 by 1. 4.2.3 LRU Replacement and Tracking One possible way to implement the LRU Replacement Policy is to use timestamp counters. We strongly recommend using timestamps to implement LRU tracking for this project as it follows the same logic of our implementation. To use this implementation, you need to keep track of the counter value where a certain block has been used and update it every time that block is used. This needs to be done per cache as there is possible cases where the LRU is different in the L1 cache and in the L2 cache. When it comes to evict a block, simply look through the timestamps associated with each block and evict the one with the farthest back (smallest) timestamp.Here is how you will use and manage the timestamp counter. • First, you initialize the cache’s timestamp counter to the value 2(C−B+1) . • In cases where the block of current access or the block you want to prefetch is already in the cache: – If the block of current access is already in cache, you set the timestamp of the block to the current value of the timestamp counter. This acts like setting the block to most recently used. After access, you increment the timestamp counter by 1. – Case where you do not change the timestamp: If the block you want to prefetch is already in the cache, prefetching does not happen, and you do nothing. You do not increment the timestamp counter. • In cases where you need to install a new block, there are two possible insertion policies: MIP or LIP. The block of current access can only use MIP, and the block you want to prefetch may use MIP or LIP based on configuration. – For MIP, you set the timestamp of the newly installed block to the current value of the timestamp counter. After insertion, you increment the timestamp counter by 1. – For LIP, you set the timestamp of the newly installed block to lowest − 1.After insertion, you increment the timestamp counter by 1. We define lowest as the smallest timestamp of all valid blocks in the set you want to install a new block into. If there is no valid block in the set before insertion, lowest is undefined. In this case where lowest is undefined, you set the timestamp of the newly installed block to current value of the timestamp counter. 4.2.4 LFU Replacement and Tracking Note: Implementation of LFU Replacement Policy is for students in 6100 & 6290. To implement the LFU Replacement Policy, you must keep a counter of how many times a certain block is used and refer to the counter when deciding which block to evict.However, the naive LFU Replacement Policy has one huge fatal flaw. Imagine missing on a block with a full cache. When you bring in that new block, you replace the LFU, but now that new block is most likely the LFU. If the next access is also a miss, then that next block will replace the block that you just brought in. This is very inefficient and goes against temporal locality, therefore we will use the MRU bit to prevent this case. The MRU bit serves as a way to prevent a block from being evicted. When it comes to evict a block, simply check each counter for each block and evict the one with the lowest counter with the restriction that you do not evict the block that has the MRU bit set. In the cases where multiple blocks are equal in terms of frequency of use, break the tie by choosing to evict the block with the smallest tag. We track LFU status by having a “use” counter for each block that counts how many times it has been used and a MRU bit for each block that tells us if it is the MRU block in the set. • In cases where the block of current access or the block you want to prefetch is already in the cache: – If the block of current access is already in cache, you set the MRU bit of the block and clear the MRU bit of every other block in the same set.After access, you increment the block’s “use” counter by 1. – Case where you leave the MRU bit and the “use” counter alone: If the block you want to prefetch is already in cache, prefetching does not happen, and you do nothing. You do not increment the “use” counter nor touch the MRU bit. • In cases where you need to install a new block, there are two possible insertion policies: MIP or LIP. The block of current access can only use MIP, and the block you want to prefetch may use MIP or LIP based on configuration: – For MIP, you set the MRU bit of this new block and clear the MRU bit of every other block in the same set. – For LIP, you clear the MRU bit of this new block. You leave the MRU bit of the other blocks in the set unmodified. • If the newly installed block is the block of current access, set the “use” counter to 1. If the newly installed block is the block you prefetched, set the “use” counter to 0. 4.2.5 Serial Checks Although there may be plenty of parallelism in a real-life cache hierarchy, you will implement memory accesses in the simulator serially because it helps calculate the statistics we care about in this project. The sequence of checks for a given memory access should be: 1. Check L1 cache2. Check L2 cache However, your simulator should increment hit/miss counters for the L2 cache only when L1 has missed. Similarly, blocks in L2 should not move into the MRU position for an access unless the L1 cache missed. 4.2.6 Do Not Writeback Before L2 Read When the L1 cache misses, please have the L1 cache perform a read from L2 before you write back a dirty victim block to L2. Otherwise, if the block written back and the requested block share an L2 set, their positions in the LRU queue for their L2 set could be swapped compared to the expected behavior. 4.2.7 Disabling Caches For simplicity, when the L2 cache is disabled, it should act as an zero-sized write-through cache: it should miss on every read, and send all writes directly to DRAM. L2 statistics still need to be updated and printed in this case. However, if the L2 cache is disabled, please set its hit time (HT) to zero. 4.3 Simulator Statistics Your simulator will calculate and output the following statistics: • Overall statistics: – Reads (reads): Total number of cache reads – Writes (writes): Total number of cache writes • L1 statistics: – L1 accesses (accesses l1): Number of times L1 cache was accessed – L1 hits (hits l1): Total number of L1 hits. – L1 misses (misses l1): Total number of L1 misses. – L1 hit ratio (hit ratio l1): Hit ratio for L1, calculated using the first three L1 stats above. – L1 miss ratio (miss ratio l1): Miss ratio for L1, calculated using the first three L1 stats above. – L1 AAT (avg access time l1): See Section 4.3.1 • L2 statistics: – L2 reads (reads l2): Number of times the L2 cache received a read request. This stat should not be touched unless there was L1 read miss – L2 writes (writes l2): Number of times the L2 cache received a write request. This stat should not be touched unless there was a write-back from L1 cache – L2 read hits (read hits l2): Total number of L2 read hits. This stat should not be touched unless there was an L1 cache miss – L2 read misses (read misses l2): Total number of L2 read misses. This stat should not be touched unless there was an L1 cache missL2 prefetches (prefetches l2): Total number of L2 prefetches. This stat should not be touched unless the block you want to prefetch is not in the cache at the time you want to bring it in. – L2 read hit ratio (read hit ratio l2): Read hit ratio for L2, calculated using earlier L2 read stats. – L2 read miss ratio (read miss ratio l2): Read miss ratio for L2, calculated using earlier L2 read stats. – L2 AAT (avg access time l2): See Section 4.3.1 4.3.1 Average Access Time For the purposes of average access time (AAT) calculation, we assume that: • For L1, hit time is k0 + (k1 × (CL1 − BL1 − SL1)) + k2 × (max(3, SL1) − 3) – k0 = 1 ns – k1 = 0.15 ns – k2 = 0.15 ns • For L2, hit time is k3 + (k4 × (CL2 − BL2 − SL2)) + k5 × (max(3, SL2) − 3) – k3 = 4 ns – k4 = 0.3 ns – k5 = 0.3 ns • The time to access DRAM is 100 ns The provided header file, cachesim.hpp, includes constants for these values. These values are in nanoseconds. Please also provide your answer in nanoseconds. When computing the L1 AAT, use the following equation from the lecture slides: AATL1 = HTL1 + MRL1 × MPL1 where the hit time HTL1 is as calculated above, and MRL1 is the L1 miss ratio (miss ratio l1). When computing the AAT for the L2 cache, which is write-through and write-no-allocate, use the L2 read miss ratio (read miss ratio l2) as the miss ratio in the AAT equation.5 Implementation Details We included a driver, cachesim driver.cpp, which parses arguments, reads a trace from standard input, and invokes your sim access() function in cachesim.cpp for each memory access in the trace. The driver takes a flag for each of the knobs described in Section 4.1; run ./cachesim -h to see the list of options. The provided cachesim.cpp template file also contains sim setup() and sim finish() functions you should complete for simulator setup and cleanup (including final stats calculations), respectively. By default, the provided ./run.sh script invokes the ./cachesim binary produced by linking cachesim driver.cpp with cachesim.cpp. You are discouraged from modifying the Makefile, ./run.sh, cachesim driver.cpp, or the header file cachesim.hpp, because it will make it much more difficult for TAs to help with debugging.5.1 Docker Image We have provided an Ubuntu 22.04 LTS Docker image for verifying that your code compiles and runs in the environment we expect — it is also useful if you do not have a Linux machine handy. To use it, install Docker (https://docs.docker.com/get-docker/) and extract the provided project tarball and run the 6290docker* script in the project tarball corresponding to your OS. That should open an 22.04 bash shell where the project folder is mounted as a volume at the current directory in the container, allowing you to run whatever commands you want, such as make, gdb, valgrind, ./cachesim, etc. Note: Using this Docker image is not required if you have a Linux system available and just want to make sure your code compiles on 22.04. We will set up a Gradescope autograder that automatically verifies we can successfully compile your submission. 6 Validation Requirements We have provided six memory traces in the traces/ directory of the provided project tarball. Validation outputs for the default simulator configuration for each of these traces are provided in the ref outs/ directory. There are also validation outputs for gcc under the default configuration except with only L1 (-D), L1 and L2 with prefetcher disabled (-P 0). Given these configurations, the output of your code must match these reference outputs byte-for-byte! We have included a script to compare the output of your simulator to these reference outputs using make validate undergrad (for students in 4100 & 4290) and make validate grad (for students in 6100 & 6290).We would advise against modifying cachesim driver, which prints the final statistics, unless you are confident it will not cause differences from the solution output. We may grade by testing against other configurations or other traces. 6.1 Debug Traces Debugging this project can be difficult, particularly when looking only at final statistics. We have provided some verbose debug traces for you that correspond to the reference traces. To motivate you to use them, part of your grade will depend on you implementing matching debug traces in your own code (see Section 9). Please see the debug outs/README.txt for more information. Note that your debugging statements should only print when a special DEBUG flag is set. Otherwise, it will slow down your implementation and potentially cause issues during grading. To make the debugging statements conditional, use the following code: # ifdef DEBUG // Your debug statement here # endif To see your debugging statements print when you test your implementation, add DEBUG=1 to the make command. 7 Experiments Once you have your simulator working, you should find an optimal cache configuration for each of the six traces that meets the following constraints:Project 1 1. Configuration should respect all the restrictions mentioned in Section 4.1 2. The L2 data store is 128 KiB (C = 17) 3. The L1 data store is 32 KiB (C = 15) An optimal cache configuration would have the lowest average access time, while minimizing metadata/tag storage. Identify points of diminishing returns in terms of cache parameters (C, B, S). Consider that highly associative caches can use substantially more area and power. Include any rationale, quantitatively or qualitatively, to justify your decisions. In your report you must provide, in addition to the cache configuration, the total size of any associated metadata required to build the cache for your recommended configuration(s), except for the LRU/LFU tracking metadata. For L1, the per cache tag storage size is 2C−B × (64 − (C − S) + 2) bits due to the dirty and valid bits. For L2, the tag storage size is 2C−B × (64 − (C − S) + 1) bits, since there are no dirty bits in L2.Assume that maintaining LRU/LFU information has no implementation cost for the simplicity of the project. You should submit a report in PDF format (inside your submission tarball) in which you describe your methodology, rationale, and results. 8 What to Submit to Gradescope Please submit your project to Gradescope as a tarball containing the your experiments writeup as a PDF, as well as everything needed to build your project: the Makefile, the run.sh script, and all code files (including provided code). You can use the make submit target in the provided Makefile to generate your tarball for you. Please extract your submission tarball and check it before submitting! We plan to enable a Gradescope autograder that will verify that your code compiles on 22.04 at submission time and test your implementation. 9 Grading You will be evaluated on the following criterion: +0: You don’t turn in anything (significant) by the deadline +50: You turn in well commented significant code that compiles and runs but does not match the validation +35: Your simulator completely matches the validation output +10: You ran experiments and found the optimum configuration for the ‘experiments’ workload and presented sufficient evidence and reasoning +5: You implement debug outputs as explained in Section 6.1.Your code is well formatted, commented and does not have any memory leaks! Check out the section on helpful tools Appendix A – Plagiarism We take academic plagiarism very seriously in this course. Any and all cases of plagiarism are reported to the Dean of Students. We use accepted forensic techniques to determine whether there is copying of a coding assignment. You may not do the following in addition to the Georgia Tech Honor Code: • Copy/share code from/with your fellow classmates or from people who might have taken this course in prior semesters. • Publish your assignments on public repositories, github, etc, that are accessible to other students.• Submit an assignment with code or text from an AI assistant (e.g., ChatGPT). • Look up solutions online. Trust us, we will know if you copy from online sources. • Debug other people’s code. You can ask for help with using debugging tools (Example: Hey XYZ, could you please show me how GDB works), but you may not ask or give help for debugging the cache simulator. • You may not reuse any code from earlier courses even if you wrote it yourself. This means that you cannot reuse code that you might have written for this class if you had taken it in a prior semester. You must write all the code yourself and during this semester. Using AI Assistants Anything you did not write in your assignment will be treated as an academic misconduct case. If you are unsure where the line is between collaborating with AI and copying AI, we recommend the following heuristics: Heuristic 1: Never hit “Copy” within your conversation with an AI assistant. You can copy your own work into your own conversation, but do not copy anything from the conversation back into your assignment. Instead, use your interaction with the AI assistant as a learning experience, then let your assignment reflect your improved understanding.Heuristic 2: Do not have your assignment and the AI agent open at the same time. Similar to the above, use your conversation with the AI as a learning experience, then close the interaction down, open your assignment, and let your assignment reflect your revised knowledge. This heuristic includes avoiding using AI directly integrated into your composition environment: just as you should not let a classmate write content or code directly into your submission, so also you should avoid using tools that directly add content to your submission.Deviating from these heuristics does not automatically qualify as academic misconduct; however, following these heuristics essentially guarantees your collaboration will not cross the line into misconduct. Appendix B – Helpful Tools You might the following tools helpful: • gdb: The GNU debugger will prove invaluable when you eventually run into that segfault. The Makefile provided to you enables the debug flag which generates the required symbol table for gdb by default. – To pass a trace on standard in (as cachesim expects) while running in gdb, you can invoke gdb with gdb ./cachesim and then run run at the gdb prompt • Valgrind: Valgrind is really useful for detecting memory leaks. Use the following command to track all leaks and errors: valgrind –leak-check=full –show-leak-kinds=all –track-origins=yes ./cachesim 11
This assignment has three parts and focuses on the development of a Rest/Restful API for the creation & retrieval of ● Posts ● Comments.You will learn about ● Developing a Nodejs server that uses a CouchDB (NoSQL) database ● Developing a Rest Level 2 (CRUD) API ● Developing a Rest level 3 APIPlease provide the Dockerfile and/or docker-compose.yml you used in completing the assignment. Failure to provide the needed Dockerfile and/or docker-compose.yml will make it impossible to test the solution you developed and result in 0 marks for this assignment.Part A) 40 Points Develop and implement a Level 2 Rest API (CRUD) that allows the creation and retrieval of posts and comments. A post consists of a PostID, Topic and PostData. A comment consists of CommentID, PostID, CommentText.Your API should support users in creating Posts & Comments. Obviously, Comments must relate to an existing Post. Your API should also all users to retrieve all posts & all comments for a post.Part B) 40 Points Develop and implement a Level 3 Rest API (all resonance must be in JSON) that allows the creation and retrieval of posts and comments. A post consists of a PostID, Topic and PostData. A comment consists of CommentID, PostID, CommentText.Your API should support users in creating Posts & Comments. Obviously, Comments must relate to an existing Post. Your API should also all users to retrieve all posts & all comments for a post.Part C) 20 Points Provide 2 web pages that use the APIs of parts A & B. The first web page called TestRestLevel2.html should demonstrate all features of your Rest Level 2 API (Part A). The second web page called TestRestLevel3.html should demonstrate all features of your Rest Level 3 API (Part B).What to hand in? The docker-compose.yml file that you used in the assignment and any additional dockerfiles you developed. Failure to provide this/these files will result in a zero (0) grade for the assignment. Part A) -> one file called serverA.js that contains all code for part A. Part B) -> one file called serverB.js that contains all code for part B. Part C) -> TestRestLevel2.html & TestRestLevel3.html
This assignment has five parts and focuses on the development of a simple posting system based on nodejs, React & mysql. In this assignment, you will train: ● the development of a stateful React application, ● use of asynchronous fetch ● testing of your codePlease provide the Dockerfile and/or docker-compose.yml you used in completing the assignment. Failure to provide the needed Dockerfile and/or docker-compose.yml will make it impossible to test the solution you developed and result in 0 marks for this assignment.Part A) 10 Points Develop a post method that will create a database in mysql designed for storing posts in a table called posts. A post consists of ID, Topic and Data. Make sure that the ID is assigned automatically by the database (should be the primary key). In case the database already exists the method should delete all existing entries in the tablePart B) 20 Points Develop a post and a get method that allows the addition of a new post and the retrieval of all existing posts.Part C) 60 Points Using React develop a website that enables a user to ● Initialize/Create the database and the table posts. ● Create a new post consisting of topic and data. ● List all existing posts Make sure you provide a Post, PostID, PostTopic and PostData tag. To improve usability design your system, make sure to offer: ● A landing page ● A page for showing all postings ● A page for creating new posts Feel free to use react-router-dom.Part D) 10 Points Write a test report that shows how you verified/tested that parts A, B and C work as intended,What to hand in? The docker-compose.yml file that you used in the assignment and any additional dockerfiles you developed. Failure to provide this/these files will result in a zero (0) grade for the assignment. Parts A&B&C) -> The modified App.js file, all .js & .css files you developed/created. Part D) -> one file called report.pdf that contains your report.
This assignment has five parts and focuses on the development of a simple posting system based on nodejs & mysql. In this assignment, you will train: ● the development of a stateful client-server application, ● use of asynchronous fetch ● testing of your codePlease provide the Dockerfile and/or docker-compose.yml you used in completing the assignment. Failure to provide the needed Dockerfile and/or docker-compose.yml will make it impossible to test the solution you developed and result in 0 marks for this assignment.Part A) 20 Points Develop a get method with the patch /init that creates a database named postdb and a table named posts.Part B) 20 Points Develop a post method with the patch /addPost that expects data and topic in the body of a request. This method will insert the topic and data into the table posts.Part C) 20 Points Develop a get method with the patch /getPosts that returns all the entries in the table posts.Part D) 20 Points Develop a web page that allows the user to create a post (topic & data) and submit it (e.g. pressing a button) via an asynchronous fetch to the server. Also, provide a mechanism for the user (e.g. pressing a button) to retrieve all existing posts in the database via an asynchronous fetch.Part E) 20 Points Write a test report that shows how you tested the nodejs code you developed (e.g. be sure to use loadtest [https://www.npmjs.com/package/loadtest] for the performance test). Your report (short paragraph) should answer the following questions● How did you test your code? ● How long does it take to process a single post (performance)? ● Does the size of the data submitted to the server impact the performance? ● How does the number of requests impact the performance of the server? ● How does the level of concurrency impact the performance of the server?What to hand in? Dockerfile and docker-compose.yml file that you used in the assignment. Failure to provide this/these files will result in a zero (0) grade for the assignment.Part a&b&c) -> one file called server.js (make sure that calling nodejs server.js will work). Part d) -> one file called posting.html (this file should contain all JS code and HTML) Part e) -> one file called report.pdf that contains your report.
This assignment has three parts and focuses on the development of a simple posting system based on nodejs. In this assignment, you will train: ● the development of a stateful client-server application, ● use of asynchronous XHTMLHttpRequest ● testing of your codePlease provide the Dockerfile and/or docker-compose.yml you used in completing the assignment. Failure to provide the needed Dockerfile and/or docker-compose.yml will make it impossible to test the solution you developed and result in 0 marks for this assignment.Part A) 30 Points Develop for the nodejs platform a post method called postmessage that accepts two parameters (topic and data) and saves them together with a timestamp (date and time) in a file called posts.txt. Make sure that if the file already exists that you add append it – if it doesn’t exist you should create it. To simplify your task, you may use the npm module express and body-parser. No other libraries are to be used. Obviously, you are free to use any standard nodejs module, e.g. fs.Part B) 50 Points Develop a webpage called posting.html that allows a user to see all posts and allows the creation of new posts. You should only use asynchronous XMLHttpRequest calls for client-server communication. To improve the user experience, use alert to inform the user about the success or failure of posting a new message. Ensure that the displayed posts are up to date, e.g. update the data on the webpage if another user made a post. No javascript libraries are allowed for this part.Part C) 30 Points Write a test report that shows how you tested the nodejs code you developed (e.g. be sure to use loadtest [https://www.npmjs.com/package/loadtest] for the performance test). Your report (short paragraph) should answer the following questions● How did you test your code? ● How long does it take to process a single post (performance)? ● Does the size of the data submitted to the server impact the performance? ● How does the number of requests impact the performance of the server? ● How does the level of concurrency impact the performance of the server?What to hand in? Dockerfile and/or docker-compose.yml file that you used in the assignment. Failure to provide this/these files will result in a zero (0) grade for the assignment.Part a) -> one file called server.js (make sure that calling nodejs server.js will work). Part b) -> one file called posting.html (this file should contain all JS code and HTML) Part c) -> one file called report.pdf that contains your report.