<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rithik Vir on Medium]]></title>
        <description><![CDATA[Stories by Rithik Vir on Medium]]></description>
        <link>https://medium.com/@rithikvir?source=rss-f1b4b60735df------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fJwF-jejbWZ1akR_</url>
            <title>Stories by Rithik Vir on Medium</title>
            <link>https://medium.com/@rithikvir?source=rss-f1b4b60735df------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:10:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rithikvir/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Machine Learning Reveals Insights into the Future of Antarctic Ice Sheets]]></title>
            <link>https://medium.com/@rithikvir/machine-learning-reveals-insights-into-the-future-of-antarctic-ice-sheets-d7acefdc69e2?source=rss-f1b4b60735df------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7acefdc69e2</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Rithik Vir]]></dc:creator>
            <pubDate>Sun, 28 Jan 2024 23:07:32 GMT</pubDate>
            <atom:updated>2024-01-29T21:03:55.057Z</atom:updated>
            <content:encoded><![CDATA[<h4>An analysis of univariate and multivariate techniques for forecasting</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L2JppMKDUKLroMnP" /></figure><h3>Introduction</h3><p>The vast expanse of Antarctica holds a substantial amount of water in the ice sheets and any changes to it has the potential to profoundly influence the global climate. The melting of ice sheets in the Antarctic Peninsula have been alarming, and the far reaching repercussions of glacial melting and the subsequent rise in sea levels make this an important area to study¹. In this research article, we will investigate machine learning techniques and their potential to reveal insights into the future.</p><p>We will be analyzing two machine learning techniques: univariate and multivariate analysis. Univariate techniques utilize the historical trends and patterns to predict the future of the same variable. Multivariate technique, on the other hand, brings together multiple related variables to uncover complex connections between them and sometimes provides a more accurate forecast. We will explore the effectiveness of these techniques so they can be used to conduct similar investigations.</p><h3>Objective</h3><p>This research utilizes data from the “<a href="https://nsidc.org/data/nsidc-0782/versions/1">NSIDC-0782</a> Antarctica Grounded Ice Sheet Elevation Change” dataset² to analyze the capabilities of machine learning models for predicting elevation change of the ice sheets in the Antarctic Peninsula. It is used in conjunction with temperature data for the region from the Copernicus Climate Data Store³. Utilizing a three-step approach — analyzing elevation and temperature trends, constructing a multivariate model incorporating past elevation and temperature data, and comparing the Root Mean Squared Error (RMSE) of each model — our goal is to identify the best model for predicting future elevation change.</p><h3>Preparing the Data</h3><p>The first step in the analysis is preparing the data. The NSIDC-0782 Antarctica Grounded Ice Sheet Elevation Change Dataset contains height change data of glaciers, when compared to the nominal reference point of December 2013, from the months April 1985 to December 2020.</p><p>The dataset covers the northern areas of Antarctica, however, we will focus on the circled region, the Antarctic Peninsula ( Longitude: [-73.3, -64.4] and Latitude: [-74.2, -57.2]), as it is one of the fastest melting regions of Antarctica.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kZNkVwZ1-tkEGhpP" /><figcaption><strong><em>Figure 1. Visualization of </em></strong><em>height change data in northern </em><strong><em>Antarctica</em></strong><em>. The </em><strong><em>Antarctic</em></strong><em> Peninsula, which is the focus of our research, is circled.</em></figcaption></figure><h4>Loading in the Datasets</h4><p>Since the data is stored in a .nc (Computer Numerical Code) file, we use NetCDF4, a set of software libraries and data formats, to be able to access it. We can load the dataset using the code:</p><pre>from netCDF4 import Dataset<br>filename = &#39;ANT_GroundedIceHeight.nc&#39;<br>data = Dataset(filename)</pre><p>To access the specified height_change variable, and trim the data to the Antarctic Peninsula region, Longitude: [-73.3, -64.4] and Latitude: [-74.2, -57.2] in EPSG: 4326, we can use the code:</p><pre>height_change = data.variables[&quot;height_change&quot;][:, 621:1206, 153:553]</pre><h4>Creating the DataFrame</h4><p>Using a pandas DataFrame, we can set one column to the months from April 1985 to December 2020 and another to the average height change across the region for every month using <em>np.mean()</em>. When we print the DataFrame, the data looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*kWnmH2ofTzod3aM4" /></figure><p>That’s odd. The data seems to show that between April 1st and July 1st 1985, the height increased over 1 meter in just a couple of months. Let’s plot the data to see what’s going on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EDelXPgiOsBjqtv4" /><figcaption><strong><em>Figure 2.</em></strong><em> Average </em><strong><em>height change</em></strong><em> in the </em><strong><em>Antarctic</em></strong><em> Peninsula region over time</em></figcaption></figure><p>There is a gap in the data prior to May of 1992. In addition, the data also has a lot of seasonality, as expected due to predictable change in temperature through the year, so slicing it and extracting the trend will help make more accurate predictions.</p><pre>import pandas as pd<br>import statsmodels.tsa<br># Start at May 1st, 1992<br>average_df = average_df[85:]<br>average_df.reset_index(drop=True, inplace=True)<br>average_df[&#39;height_change_trend&#39;] = statsmodels.tsa.seasonal.seasonal_decompose(average_df[&#39;height_change&#39;], period=12, extrapolate_trend=1).trend</pre><p>Doing something similar for <strong>t2m</strong>, the temperature at 2 meters, i.e. slicing the dataset and removing seasonality, the DataFrame now looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GPY5pocs8KjabLbf" /></figure><h4>Finding the Best Lags</h4><p>Now that we have the trend of the variables in our DataFrame, it’s time to determine the <strong>lags</strong> we’ll use to predict the future values of height_change. <strong>Lagging</strong> the variables means to shift the past values back in time, to see how they influence future ones. It’s like using echoes of the past to predict the next step. This helps build accurate forecasts.</p><p>To determine the optimal lags for <em>height_change</em>, we use <strong>partial autocorrelation</strong>. <strong>Partial Autocorrelation</strong> helps us gauge the degree of correlation between <em>height_change</em> and its previous values over each lag. This way we can easily visualize the dependency patterns in a time series. We can plot the partial autocorrelation function using the code:</p><pre>import matplotlib.pyplot as plt<br>from statsmodels.graphics.tsaplots import plot_pacf<br>plot_pacf(average_df[&#39;height_change_trend&#39;], lags=25)<br>plt.title(&#39;Partial Autocorrelation Function (PACF) of Height Change Trend&#39;)<br>plt.show()</pre><p>This code plots the following graph:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/0*_VaoVODeJnul4gws" /><figcaption><strong><em>Figure 3. Partial autocorrelation</em></strong><em> function (y-axis) with </em><strong><em>lag</em></strong><em> values (x-axis). Higher correlation indicates a better ability to </em><strong><em>influence</em></strong><em> the future.</em></figcaption></figure><p>From this plot, we can see that the partial autocorrelation is initially very high, however, after the lag goes beyond 6, the magnitude stays relatively the same. Due to this, we will take the first 6 lags of <em>height_change</em> and use them to predict the future values later on. This is all we need for a univariate analysis.</p><h4>Cross Correlation Between Temperature and Height Change</h4><p>Similarly, to determine the best lags for the temperature trend and to explore the relationship between temperature and height change, we need to determine the <strong>cross correlation</strong>. The <strong>cross correlation</strong> is the measurement of similarity between two series at different lags. This way we can determine if patterns in a variable tend to align or precede similar patterns in another variable, indicating potential causal connection or shared underlying factors.</p><p>To determine the cross correlation coefficients, we can use the function below to normalize. This helps scale the variables for a more meaningful comparison. We will then use the <em>np.correlate()</em> function to generate the cross correlation coefficients:</p><pre>import numpy as np<br>def ccf_values(series1, series2):<br>   seq1 = (series1 - np.mean(series1)) / (np.std(series1) * len(series1))<br>   seq2 = (series2 - np.mean(series2)) / (np.std(series2)) <br>   ccf = np.correlate(seq1, seq2, &#39;full&#39;)<br>   return ccf</pre><p>Now that we have the function, to specifically find the cross correlation between <em>t2m</em> and <em>height_change</em>, we make the function call:</p><pre>ccf_hc = ccf_values(average_df[&#39;t2m_trend&#39;], average_df[&#39;height_change_trend&#39;])</pre><p>We are using the trend of the variables, which is the variables after seasonally is removed, to reduce noise and make more accurate predictions of the cross-correlation coefficients. When there is more noise and seasonality in the data, it is a lot harder to forecast as it almost always overfits. Since we are using <em>t2m_trend</em> to predict <em>height_change_trend</em>, <em>t2m_trend</em> should be the first parameter.</p><p>After plotting the cross correlation for each lag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/0*u-SfR3Hu7yDhv5-5" /><figcaption><strong><em>Figure 4. Cross correlation</em></strong><em> (y-axis) with </em><strong><em>lag</em></strong><em> values (x-axis).</em></figcaption></figure><p>We see that the best lags are in the -48 to 0 range. The reason we don’t use the lags that are really far back is because it would cause us to have to shift the DataFrame by great amounts, which would delete most of the data. Additionally, we only use negative lags as we want to predict future ice elevation using historical temperature and height change variables. Due to this, we will use the lags, 1, 2, 12, 24, 36, and 48 so we can use the most recent lags, as well as utilize the data from a few years before.</p><p>Finally, to make the DataFrame that we will use to train the models, we copy <em>average_df</em> and shift the <em>height_change_trend</em> and <em>t2m_trend</em> variables to represent our lags:</p><pre>lagged_average_df = average_df<br>lagged_average_df[&#39;height_change_trend_lagged_1&#39;] = average_df[&#39;height_change_trend&#39;].shift(1)<br>lagged_average_df[&#39;height_change_trend_lagged_2&#39;] = average_df[&#39;height_change_trend&#39;].shift(2)<br>lagged_average_df[&#39;height_change_trend_lagged_3&#39;] = average_df[&#39;height_change_trend&#39;].shift(3)<br>lagged_average_df[&#39;height_change_trend_lagged_4&#39;] = average_df[&#39;height_change_trend&#39;].shift(4)<br>lagged_average_df[&#39;height_change_trend_lagged_5&#39;] = average_df[&#39;height_change_trend&#39;].shift(5)<br>lagged_average_df[&#39;height_change_trend_lagged_6&#39;] = average_df[&#39;height_change_trend&#39;].shift(6)<br>lagged_average_df[&#39;t2m_trend_lagged_1&#39;] = average_df[&#39;t2m_trend&#39;].shift(1)<br>lagged_average_df[&#39;t2m_trend_lagged_2&#39;] = average_df[&#39;t2m_trend&#39;].shift(2)<br>lagged_average_df[&#39;t2m_trend_lagged_12&#39;] = average_df[&#39;t2m_trend&#39;].shift(12)<br>lagged_average_df[&#39;t2m_trend_lagged_24&#39;] = average_df[&#39;t2m_trend&#39;].shift(24)<br>lagged_average_df[&#39;t2m_trend_lagged_36&#39;] = average_df[&#39;t2m_trend&#39;].shift(36)<br>lagged_average_df[&#39;t2m_trend_lagged_48&#39;] = average_df[&#39;t2m_trend&#39;].shift(48)<br>lagged_average_df.dropna(inplace=True)</pre><h3>Training the Model</h3><p>Using our new DataFrame, we can begin to train our machine learning models. Use the <em>train_test_split()</em> function and our regressors in <em>column_names</em> to split the DataFrame into 25% for testing and 75% for training the model. This is a common practice for supervised learning as it prevents overfitting and can objectively evaluate model effectiveness on unseen data.</p><pre>from sklearn.model_selection import train_test_split<br># Split the data into training and test sets<br>column_names = [&#39;height_change_trend_lagged_1&#39;, &#39;height_change_trend_lagged_2&#39;, &#39;height_change_trend_lagged_3&#39;,<br>               &#39;height_change_trend_lagged_4&#39;, &#39;height_change_trend_lagged_5&#39;, &#39;height_change_trend_lagged_6&#39;,<br>               &#39;t2m_trend_lagged_1&#39;, &#39;t2m_trend_lagged_2&#39;, &#39;t2m_trend_lagged_12&#39;, &#39;t2m_trend_lagged_24&#39;, &#39;t2m_trend_lagged_36&#39;,<br>               &#39;t2m_trend_lagged_48&#39;]<br>X_train, X_test, y_train, y_test = train_test_split(<br>   lagged_average_df[column_names],<br>   lagged_average_df[&#39;height_change_trend&#39;],<br>   test_size=0.25<br>)</pre><p>The models we will be training use Linear Regression, Random Forest Regression, XGradient Boosted Regression, Gradient Boosted Regression, and Support Vector Regression.</p><p>Here is a brief summary and strengths and weaknesses of these models.</p><ol><li>Linear Regression: It is a widely used model that assumes a linear relationship between the input variables and the target variable. Linear regression is easy to compute and can provide good estimates where the relationship follows a linear pattern. It has its limitations when the relationship is more complex or when there are a lot of outliers in the input data.</li><li>Gradient Boosted Regression: It is a more sophisticated supervised learning technique that uses an ensemble method to combine weak models to create a more accurate final model. A series of decision trees are used that correct the errors of previous trees, and have shown to perform well when more complex relationships exist between input and output variables. Gradient Boosted Regression models can be complex and difficult to interpret, in addition to being computationally expensive.</li><li>Random Forest Regression: It is also an ensemble method combining multiple decision trees with each tree trained on a random subset of data and features to create a more accurate model and prevent overfitting. This can also work better on complex relationships.</li><li>Support Vector Regression: It is a regression model which, unlike linear regression, aims to find a hyperplane rather than a line that best fits the data points while minimizing the errors. It works well for more complex relationships than linear, but can be computationally expensive for larger datasets.</li><li>XGradient Boosted Regression: It is a supervised machine learning model that builds on Gradient Boosted Regression and Decision Trees. It also performs well when a complex relationship exists between input and output variables, but can be difficult to interpret.</li></ol><h4>Defining the Models</h4><p>To define these models, we can use the code:</p><pre>from sklearn.linear_model import LinearRegression<br>from xgboost.sklearn import XGBRegressor<br>from sklearn.ensemble import RandomForestRegressor<br>from sklearn.ensemble import GradientBoostingRegressor<br>from sklearn.svm import SVR<br>lr_model = LinearRegression()<br>rf_model = RandomForestRegressor(n_estimators=500, max_features=3, random_state=3)<br>xgb_model = XGBRegressor(n_estimators=500, learning_rate=0.01)<br>gb_model = GradientBoostingRegressor(n_estimators=500,max_features=3, random_state=3)<br>svr_model = SVR(kernel=&#39;linear&#39;)</pre><h4>Using the Regressors to Train the Models</h4><p>Since we want to train the models to specifically predict the height_change, we can <em>fit()</em><strong> </strong>them to the training data defined in the <em>train_test_split()</em> function above.</p><pre>lr_model.fit(X_train.values, y_train)<br>rf_model.fit(X_train.values, y_train)<br>xgb_model.fit(X_train.values, y_train)<br>gb_model.fit(X_train.values, y_train)<br>svr_model.fit(X_train.values, y_train)</pre><p>We can now use the <em>predict()</em> function with the test data defined earlier to get the predictions made from each model for the <em>height_change_trend</em> from what we already have. To store it into variables, we can use the code:</p><pre>y_pred = lr_model.predict(X_test)<br>y_pred1 = rf_model.predict(X_test)<br>y_pred2 = xgb_model.predict(X_test)<br>y_pred3 = gb_model.predict(X_test)<br>y_pred4 = svr_model.predict(X_test)</pre><h4>Assess the Model’s Fit of the Data</h4><p>To make sure the models fit the data well, we can plot the <strong>residuals</strong> from the models. The <strong>residuals</strong> are the difference from the model’s prediction and the actual value. Here is an example of the residual plots, in this case, the residuals between the Linear Regression model’s predictions, using each specific lag, and the actual values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qIkUilqMgjF2nuoa" /><figcaption><strong><em>Figure 5. Residuals</em></strong><em> between the </em><strong><em>linear regression </em></strong><em>model predictions and </em><strong><em>actual values</em></strong><em> using each </em><strong><em>regressor.</em></strong></figcaption></figure><p>A good residual plot should contain randomly scattered points around the identity line, the line going through 0, which means that the model isn’t always underestimating or overestimating the data. After making this confirmation, we can move on to the next step.</p><h4>Plotting the Learning Curve</h4><p>Our next step is to plot the learning curve of the models. A learning curve plots the RMSE at different training set sizes and displays the model’s performance over time. A learning curve is good if the validation and training scores show a downward trend and converge, and the RMSE lowers over time. Here is the code:</p><pre>from sklearn.model_selection import learning_curve<br># Assume X and y are your feature matrix and target variable<br>X = lagged_average_df[column_names]<br>y = lagged_average_df[&#39;height_change_trend&#39;]<br><br>train_sizes, train_scores, validation_scores = learning_curve(<br>   xgb_model, X, y, train_sizes=np.linspace(0.1, 1.0, 10),<br>   scoring=&#39;neg_mean_squared_error&#39;, cv=5<br>)<br><br>train_mean = np.mean(train_scores, axis=1)<br>train_std = np.std(train_scores, axis=1)<br>validation_mean = np.mean(validation_scores, axis=1)<br>validation_std = np.std(validation_scores, axis=1)</pre><p>We can plot the training and validation curves for each model. An example of a learning curve, in this case, for the XGradient Boosted Regression Model, is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*byMDFGI5-gawgTvX" /><figcaption><strong><em>Figure 6. Learning curve</em></strong><em> for the </em><strong><em>XGradient Boosted Regression</em></strong><em> Model</em></figcaption></figure><p>Since the training and validation score curves eventually converge, we can conclude that the model is performing well.</p><h3>Selecting the Best Model</h3><h4>Plotting the Predictions</h4><p>Now that we’ve shown that the models perform well, it’s time to plot their predictions against the <em>height_change_trend</em> values that we’ve determined from the dataset. After combining the predictions into a DataFrame, we can plot the predictions of each model versus the actually values using this code:</p><pre>plt.rcParams[&#39;figure.figsize&#39;] = (12,8)<br>plt.plot(result_df[&#39;y_pred&#39;], label=&#39;Linear Regression&#39;)<br>plt.plot(result_df[&#39;y_pred1&#39;], label=&#39;Random Forest&#39;)<br>plt.plot(result_df[&#39;y_pred2&#39;], label=&#39;XGB Regression&#39;)<br>plt.plot(result_df[&#39;y_pred3&#39;], label=&#39;Gradient Boosted Regression&#39;)<br>plt.plot(result_df[&#39;y_pred4&#39;], label=&#39;Support Vector Regression&#39;)<br>plt.plot(result_df[&#39;y_test&#39;], label=&#39;Actual Value&#39;)<br>plt.title(&#39;Model Performance with Linear Regression&#39;)<br>plt.ylabel(&#39;Height Change (m)&#39;)<br>plt.xlabel(&#39;Months 5-1996 to 1-2021&#39;)<br>plt.legend()<br>plt.show()</pre><p>This gives us the plot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/0*LtsQ0albLJSPWxet" /><figcaption><strong><em>Figure 7.</em></strong><em> Model </em><strong><em>predictions</em></strong><em> versus the </em><strong><em>actual value.</em></strong></figcaption></figure><p>Looking at the plot, all models look like they have accurate predictions. In order to determine which one is the best, we will need to compare the RMSE (Root Mean Squared Error). The RMSE displays the error between a model’s predictions and the actual value.</p><h4>Calculating the RMSE</h4><p>To calculate the RMSE of each model when predicting <em>height_change_trend</em>, we can use the code:</p><pre>from sklearn.metrics import mean_squared_error<br>rmse_values = [<br>   np.sqrt(mean_squared_error(y_test, y_pred)),<br>   np.sqrt(mean_squared_error(y_test, y_pred1)),<br>   np.sqrt(mean_squared_error(y_test, y_pred2)),<br>   np.sqrt(mean_squared_error(y_test, y_pred3)),<br>   np.sqrt(mean_squared_error(y_test, y_pred4))<br>]</pre><p>Once we have these values, we can add it to a DataFrame with the columns being the different models:</p><pre>data = {<br>   &#39;Model&#39;: [&#39;Linear Regression&#39;, &#39;Random Forest Regression&#39;, &#39;XGB Regression&#39;, &#39;Gradient Boosted Regression&#39;, &#39;Support Vector Regression&#39;],<br>   &#39;RMSE&#39;: rmse_values<br>}<br>df = pd.DataFrame(data)</pre><p>Printing the DataFrame, we get the RMSE for each model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*-fypu27S21RTVyIUzlz6xA.png" /><figcaption><em>The results in the table above show the </em><strong><em>accuracy</em></strong><em> of </em><strong><em>each model</em></strong><em> in order from the most accurate to the least.</em></figcaption></figure><p>After determining that Linear Regression is the best model for this task, since it has the smallest RMSE, we will now use it to forecast height_change_trend.</p><h3>Forecasting</h3><h4>Creating the Forecast Function</h4><p>To create the function to forecast the height change trend, we must be able to take in the DataFrame we’re predicting from, the model, the regressors that are used, and the number of steps into the future. We can start off by creating a copy of the input DataFrame and creating a new row with the time where the prediction will be.</p><pre>def forecast_height_change(dataframe, model, regressor_columns, forecast_steps):<br>   forecast_df = dataframe.copy()<br>   for step in range(1, forecast_steps + 1):<br>       new_row = pd.Series({&#39;time&#39;: forecast_df.iloc[-1][&#39;time&#39;] + np.timedelta64(1, &#39;M&#39;)})</pre><p>For us to be able to always have the values of the regressors, <em>height_change_trend</em> and <em>t2m_trend</em>, we will need to update them as we continue to predict the <em>height_change_trend</em> value. Since the <em>height_change_trend</em> is continuously being predicted, we can use the code below to simply lag the prediction to generate the regressor values:</p><pre>for column in [&#39;height_change_trend_lagged_1&#39;, &#39;height_change_trend_lagged_2&#39;, &#39;height_change_trend_lagged_3&#39;,<br>                      &#39;height_change_trend_lagged_4&#39;, &#39;height_change_trend_lagged_5&#39;, &#39;height_change_trend_lagged_6&#39;]:<br>  lag = int(column.split(&#39;_lagged_&#39;)[1])<br>  new_row[column] = forecast_df[column.split(&#39;_lagged_&#39;)[0]].iloc[-lag]</pre><p>However, for <em>t2m_trend</em>, we will be using a different approach. Since the temperature is rising by approximately 0.22C° every decade, we can take the value from 120 months behind in the DataFrame and add 0.22C° to it, demonstrating the effects of global warming⁴. This can be done using the code:</p><pre>for column in [&#39;t2m_trend_lagged_1&#39;, &#39;t2m_trend_lagged_2&#39;, &#39;t2m_trend_lagged_12&#39;,<br>                      &#39;t2m_trend_lagged_24&#39;, &#39;t2m_trend_lagged_36&#39;, &#39;t2m_trend_lagged_48&#39;]:<br>  new_row[column] = forecast_df[column].iloc[-120] + 0.22</pre><p>Lastly, we can make our predictions using the line:</p><pre>  X = new_row[regressor_columns].values.reshape(1, -1)<br>  forecast_value = model.predict(X)[0]<br>  new_row[&#39;height_change_trend&#39;] = forecast_value<br>  new_index = forecast_df.index.max() + 1<br>  forecast_df.loc[new_index] = new_row<br>return forecast_df</pre><h4>Plotting the Forecast</h4><p>To plot the forecast, we can store the results of the method using our specific parameters:</p><pre>forecasted_dataset = forecast_height_change(lagged_average_df, lr_model, column_names, 360)</pre><p>Plotting this, we get the height change prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*seVtKefZ-drCxU-1" /><figcaption><strong><em>Figure 8: Height change prediction</em></strong><em> in meters (y-axis) vs time in </em><strong><em>months since 1985</em></strong><em> (x-axis)</em></figcaption></figure><p>Based on our model and assuming no significant changes in current environmental factors, we foresee a continuous decline in the height of ice sheets in the Antarctic Peninsula over the next 30 years. While the exact rate of decline may vary, our model warns of a clear and concerning downward trajectory for the Antarctic Peninsula ice sheets in the coming decades.</p><h3>Conclusion</h3><p>In order to anticipate potential changes in the elevation of Antarctic ice sheets, we initially tried univariate analysis using historical height change. This analysis did not include the impact of temperature on the elevation of the ice sheet. To address this limitation, we performed multivariate analysis by incorporating historical temperature data as additional parameters. Multivariate analysis model predictions are more representative of the real situation considering temperature is a key factor of the melting of ice caps. Our analysis suggests that the ice caps could still melt regardless of the temperature change, and that the rate of melting is expected to accelerate with rising temperatures.</p><p>Among the regression methods used for multivariate analysis including Linear Regression, XGradient Boosted Regression, Random Forest Regression, Gradient Boosted Regression, and Support Vector Regression, we observed that linear regression yielded the best fit and is likely to be best suited for forecasting elevation changes over the coming decades. Please note that the choice of best regression model will depend on the problem at hand and the input parameters. I encourage you to explore all of them before you pick one for your task.</p><h3>References</h3><ol><li>Lu, D. (2023, May 25). Slowing ocean current caused by melting Antarctic ice could have drastic climate impact, study says. [The Guardian]. <a href="https://www.theguardian.com/science/2023/may/25/slowing-ocean-current-caused-by-melting-antarctic-ice-could-have-drastic-climate-impact-study-says">https://www.theguardian.com/science/2023/may/25/slowing-ocean-current-caused-by-melting-antarctic-ice-could-have-drastic-climate-impact-study-says</a></li><li>Nilsson, J., A. Gardner, and F. S. Paolo. (2023). MEaSUREs ITS_LIVE Antarctic Grounded Ice Sheet Elevation Change, Version 1 [Data Set]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. https://doi.org/10.5067/L3LSVDZS15ZV.</li><li>Hersbach, H., Bell, B., Berrisford, P., Biavati, G., Horányi, A., Muñoz Sabater, J., Nicolas, J., Peubey, C., Radu, R., Rozum, I., Schepers, D., Simmons, A., Soci, C., Dee, D., Thépaut, J-N. (2023): ERA5 monthly averaged data on single levels from 1940 to present. Copernicus Climate Change Service (C3S) Climate Data Store (<a href="https://cds.climate.copernicus.eu/#!/home">CDS</a>), DOI: 10.24381/cds.f17050d7</li><li>Casado, Mathieu &amp; Hébert, Raphaël. (2023). Ice core records suggest that Antarctica is warming faster than the global average. Nature Climate Change. 13. <a href="https://doi.org/10.1038/s41558-023-01795-1">https://doi.org/10.1038/s41558-023-01795-1</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7acefdc69e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>