联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2025-07-05 07:33

COMP9414 25T2 Artificial Intelligence Assignment 1 – Artificial neural networks Due: Week 5, Friday, 4 July 2025, 5 pm. 1 Problem overview The Amazon rainforest is the largest tropical rainforest on Earth, renowned for its unpar- alleled biodiversity and vital role in regulating global climate patterns [1, 2]. It spans over 5.5 million km2 and acts as a critical carbon sink by absorbing substantial amounts of atmo- spheric CO2, thus mitigating global climate change [2]. However, recent decades have witnessed a concerning rise in temperatures across the Amazon basin, attributed primarily to climate change [3]. Within this vast rainforest (contoured in green in Figure 1), specific regions have experienced notably rapid increases in temperature, leading to more frequent and intense “hot events” [4]. These hot events threaten local ecosystems by increasing the risk of forest fires and have broader implications for global climate stability. The occurrence and intensity of these hot events in the Amazon are influenced by large-scale climate drivers that modulate weather patterns worldwide [5]. In particular, four significant oceanic climate modes, El Nin?o Southern Oscillation (ENSO), Tropical South Atlantic (TSA), Tropical North Atlantic (TNA), and North Atlantic Oscillation (NAO), play crucial roles in determining temperature variations within the Amazon region. Each of these climate modes occurs in different oceanic regions surrounding the Amazon, as highlighted in Figure 1. In this assignment, your task is to build a neural model using TensorFlow/Keras to predict monthly temperature and the occurrence of hot events in a specific Amazonian region, indicated in red in Figure 1. You will use monthly time-series data from 1982 to 2022, comprising temperature observations from the Amazon and indices representing the ENSO, TSA, TNA, and NAO climate modes. 1 Figure 1: Map of the Amazon basin showing the study area (red) and the four surrounding climate-driver domains. 2 Provided Data ? Temperature time-series data and the values of the indices of climate modes ENSO, NAO, TSA and TNA as shown in Table 1 (Amazon temperature student.csv). ? Temperature thresholds provided for each month of the year (threshold.csv). Table 1: Climate-mode indices: measurement, range and interpretation Index Measurement Range Interpretation ENSO Sea-surface temperature anomaly in Nin?o 3.4 region ?3 to 3 °C +→ El Nin?o; –→ La Nin?a NAO Normalised sea-level pressure differ- ence (Azores – Iceland) ?4 to 4 +→ stronger westerlies, milder win- ters; –→ reverse TSA SST anomaly in Tropical South At- lantic ?1 to 1 °C +→ warmer South Atlantic waters TNA SST anomaly in Tropical North At- lantic ?1 to 1 °C +→ warmer North Atlantic waters 2 3 Objective Your goal is to build neural network models for two distinct tasks: ? Task A (Classification): Predict whether a hot event occurs. ? Task B (Regression): Predict the temperature. 4 Task A: Classification (Hot event detection) Data preparation (a) Define a binary variable named Hot: A month is classified as Hot if the monthly temperature exceeds the provided threshold for that specific month. (i) Set Hot = 1 if the monthly temperature exceeds the monthly threshold. (ii) Otherwise, set Hot = 0. (b) Create a bar plot that summarises, for each year, the number of hot months. Model development (c) Randomly partition the dataset into training, validation, and test sets. (d) Pre-processing: Apply any necessary transformations to the training set, then apply the same transformations to the validation set. Keep a record of all applied transformations. (e) Build a neural network classifier to predict the occurrence of hot events: define the archi- tecture and hyper-parameters (loss function, optimiser, batch size, learning rate, number of epochs). It is recommended that the total number of trainable parameters obey Nparams < Nsamples 10 , i.e. keep the parameter count below one-tenth of the sample size. (f) Create a plot showing the accuracy (y-axis) versus the number of epochs (x-axis) for both the training and validation sets. Model evaluation (g) Apply the same transformations to the test set as you did to the training and validation sets. (h) Use your model to predict the class Hot on the test set. (i) Evaluate performance by plotting a confusion matrix. Note that your positive class is 1. 3 (j) Calculate: Balanced Accuracy, True Negative Rate (Specificity), and True Positive Rate (Sensitivity). 5 Task B: Regression (Temperature prediction) For this task, directly predict temperature values rather than using the binary Hot variable. Model development (k) Randomly split the dataset into training, validation, and test sets. (l) Pre-processing: Apply any necessary transformations to the input features of the training set, and replicate exactly the same transformations on the validation set. Do not scale, normalise or otherwise transform the ground-truth (target) values. Keep an explicit record of every transformation applied. (m) Build your model by defining its architecture and training hyper-parameters: loss function, optimiser, batch size, learning rate and number of epochs. It is recommended that the total number of trainable parameters be less than one-tenth of the number of samples. (n) Create a plot showing the values of the loss function (y-axis) versus the number of epochs (x-axis) for both the training and validation sets. Model evaluation (o) Evaluate the regression model by comparing the true and predicted temperature values on the test set. Use the Pearson Correlation Coefficient (r) and the Mean Absolute Error (MAE) as evaluation metrics. The metrics are defined as r = ∑n i=1(yi ? yˉ)(y?i ? y?)√∑n i=1(yi ? yˉ)2 √∑n i=1(y?i ? y?)2 , MAE = 1 n n∑ i=1 |yi ? y?i|, where yi is the true temperature, y?i is the predicted temperature, and n is the number of test samples. Model development (year-wise split & target normalisation) [6] (p) Split the data by whole calendar years: each year must appear in one subset only. Use the same proportions as in part (k) for train/validation/test. Fit a separate scaler to the training-set temperature targets and apply it to the validation and test targets; do not reuse the feature scaler. Retain the feature transformations specified in part (l) unchanged. (q) Work with the train/validation/test partitions—and the target–scaler—already established in part (p). Now apply every remaining feature-level pre-processing step specified in part (l) to those same splits. 4 (r) Re-train the same regression network and hyper-parameters defined in (m) on the year-wise split (no new architecture). (s) Create a plot showing the values of the loss function (y-axis) versus the number of epochs (x-axis) for both the training and validation sets. Model evaluation (Year-wise Split) (t) Evaluate the regression model by comparing the true and predicted temperature values on the test set. Use the Pearson Correlation Coefficient (r) and the Mean Absolute Error (MAE) as evaluation metrics. 6 Additional notes (apply to both tasks) ? You need to set a random seed to ensure that your results are reproducible. ? You must serialise both versions of every trained model and the corresponding feature-scaler objects feature scalers (and the separate target scalers from part (p) where applicable) for the random split and for the year-wise split. ? You cannot use year as a predictor. However, you may choose whether or not to include month as a predictor. If you include month, use cyclic encoding to represent it properly, ensuring your neural network correctly understands the continuity between December and January. To achieve cyclic encoding: Normalise the month to the range [0, 2π] using: month normalised = 2π × (month-1) 12 . ? In the year-wise split, the years selected for training, validation, or testing do not need to be consecutive. For example, data from 1982 may belong to the training set, 1983 to the validation set, and 1984 to the test set. 7 Testing and discussing your code Your notebook will be exercised live during the tutorial-based discussion (25 marks in total); Attendance is compulsory; submissions not discussed will receive zero. You must build and save neural models for both tasks (classification and regression) under the random split and the year-wise split. For full marks you must include, within the same Jupyter notebook, a single code cell that (i) loads the hold-out hidden test dataset dataset provided by the course tutors; (ii) restores every serialised artefact: ? classifier model & its feature scaler, ? random-split regressor & feature scaler, ? year-wise regressor & both its feature scaler and its separate target-scaler; 5 (iii) evaluates the models, printing all required metrics and ? the confusion matrix for the classifier; ? a “true vs predicted” scatter plot for the random-split regressor; ? the same scatter plot for the year-wise regressor (after inverse-transforming the tar- gets with its own scaler). Code readability is worth 1 mark. During the discussion your tutor will award up to 8 marks per task based on your understanding: 8 Outstanding, 6 Great, 4 Fair, 2 Low, 0 Deficient/No answer. 8 Submitting your assignment The assignment must be done individually. You need to submit your solution on Moodle. Your submission must include: ? A single Jupyter notebook (.ipynb). ? the serialised trained models for the classification and regression tasks; ? all associated scaler objects (feature scalers for every model and the separate target–scaler used in the year-wise regression). The first line of your Jupyter notebook should display your full name and your zID as a com- ment. The notebook should contain all the necessary code for reading files, data preprocessing, network architecture, and result evaluation. Additionally, your file should include short text descriptions to help markers better understand your code. Please be mindful that providing clean and easy-to-read code is a part of your assignment. You can submit as many times as you like before the deadline—later submissions overwrite earlier ones. After submitting your file, a good practice is to take a screenshot of it for future reference. Late submission penalty: UNSW has a standard late submission penalty of 5% per day from your mark, capped at five days from the assessment deadline; after that students cannot submit the assignment. 9 Deadline and questions Deadline: Week 5, Friday 4 July 2025, 5pm. Please use the forum on Moodle to ask questions related to the assignment. We will prioritise questions asked in the forum. However, you should not share your code to avoid making it public and possible plagiarism. If that’s the case,


相关文章

【上一篇】:到头了
【下一篇】:没有了

版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp