<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321054#M68459</link>
    <description>&lt;P&gt;Not sure how can I can take the advantage of this python code to stick it in JupyterLab in order to apply the analysis&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_16.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78753i58605DC7EFC8CEA3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_16.jpg" alt="Clip_16.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_9.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78756iD5D8C7ED9587933F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_9.jpg" alt="Clip_9.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_10.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78755i8A3A0885337D340E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_10.jpg" alt="Clip_10.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_11.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78754iDD567A28CD647D68/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_11.jpg" alt="Clip_11.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 10:22:46 GMT</pubDate>
    <dc:creator>JamalNUMAN</dc:creator>
    <dc:date>2023-08-22T10:22:46Z</dc:date>
    <item>
      <title>ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1320855#M68455</link>
      <description>&lt;P&gt;ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the screenshot below, I couldn’t figure out how to obtain the python code for the Geographically Weighted Regression (GWR) by which the dependent variable (y) can be expected based on the independent variables (x1, x2, x3, x4) considering the location of each observations where u column represents the x – coordinate and v column represents the y – coordinate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_119.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78709iE491D0B77719771A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_119.jpg" alt="Clip_119.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_120.jpg" style="width: 701px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78707i12FBC7179150376C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_120.jpg" alt="Clip_120.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_121.jpg" style="width: 826px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78708iC9B79548E6C10FFA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_121.jpg" alt="Clip_121.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 18:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1320855#M68455</guid>
      <dc:creator>JamalNUMAN</dc:creator>
      <dc:date>2023-08-21T18:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1320913#M68456</link>
      <description>&lt;P&gt;C:\... install folder ...\Resources\ArcToolBox\toolboxes\Spatial Statistics Tools.tbx\toolbox.module.py&lt;/P&gt;&lt;P&gt;line 3619 :&amp;nbsp; contains the class GeographicallyWeightedRegression description&lt;/P&gt;&lt;P&gt;line 3864:&amp;nbsp; &amp;nbsp;conts the class&amp;nbsp;GWR&lt;/P&gt;&lt;P&gt;you can follow the various imports fromtthat module&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 21:03:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1320913#M68456</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-08-21T21:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321054#M68459</link>
      <description>&lt;P&gt;Not sure how can I can take the advantage of this python code to stick it in JupyterLab in order to apply the analysis&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_16.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78753i58605DC7EFC8CEA3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_16.jpg" alt="Clip_16.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_9.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78756iD5D8C7ED9587933F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_9.jpg" alt="Clip_9.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_10.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78755i8A3A0885337D340E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_10.jpg" alt="Clip_10.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_11.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78754iDD567A28CD647D68/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_11.jpg" alt="Clip_11.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 10:22:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321054#M68459</guid>
      <dc:creator>JamalNUMAN</dc:creator>
      <dc:date>2023-08-22T10:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321073#M68462</link>
      <description>&lt;P&gt;For JupyterLab?&lt;/P&gt;&lt;P&gt;you would have to provide all the input variables into this expression&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ARCPY.GeographicallyWeightedRegression_analysis(
                in_features, dependent_field, explanatory_field, out_feature,
                kernel_type, band_width, distance, nn, weight_field, crw,
                anaCellSize, in_pred, pred_field, out_pred)&lt;/LI-CODE&gt;&lt;P&gt;I don't think that is what you want&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 11:08:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321073#M68462</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-08-22T11:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321265#M68466</link>
      <description>&lt;P&gt;I used the ChatGPT in order to get the python code for the GWR as per the request below&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;Write a python code to read the table saved here:&lt;/P&gt;&lt;P&gt;"C:\D\H3.xlsx"&lt;/P&gt;&lt;P&gt;Write a python code to predict the value of the dependent variable based on the geographically Weighted Regression (GWR) displaying how the weights of neighbouring observations are used to calculate the prediction of the focal observation&lt;/P&gt;&lt;P&gt;The first 4 columns are the independent variables&lt;/P&gt;&lt;P&gt;The fifth column is the dependent variable&lt;/P&gt;&lt;P&gt;The u column represents the x-coordinate&lt;/P&gt;&lt;P&gt;The v column represents the y coordinate&lt;/P&gt;&lt;P&gt;Use the Gaussian as the kernel function&lt;/P&gt;&lt;P&gt;Assume the bandwidth to be 400 meters&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ChatGPT provided the code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;import numpy as np&lt;/P&gt;&lt;P&gt;from spreg import GWR&lt;/P&gt;&lt;P&gt;from spreg.utils import read_spatialdata&lt;/P&gt;&lt;P&gt;# Load the data from the Excel file&lt;/P&gt;&lt;P&gt;file_path = r'C:\D\H3.xlsx'&lt;/P&gt;&lt;P&gt;data = pd.read_excel(file_path)&lt;/P&gt;&lt;P&gt;# Define the independent variables (X1, X2, X3, X4)&lt;/P&gt;&lt;P&gt;X = data[['X1', 'X2', 'X3', 'X4']].values&lt;/P&gt;&lt;P&gt;# Define the dependent variable (y)&lt;/P&gt;&lt;P&gt;y = data['y'].values&lt;/P&gt;&lt;P&gt;# Define the coordinates (u and v)&lt;/P&gt;&lt;P&gt;u = data['u'].values&lt;/P&gt;&lt;P&gt;v = data['v'].values&lt;/P&gt;&lt;P&gt;# Define the bandwidth for the Gaussian kernel&lt;/P&gt;&lt;P&gt;bandwidth = 400&amp;nbsp; # meters&lt;/P&gt;&lt;P&gt;# Create a spatial weights matrix based on Gaussian kernel&lt;/P&gt;&lt;P&gt;distances = np.sqrt((u[:, np.newaxis] - u)**2 + (v[:, np.newaxis] - v)**2)&lt;/P&gt;&lt;P&gt;kernel_weights = np.exp(-distances**2 / (2 * bandwidth**2))&lt;/P&gt;&lt;P&gt;# Create a GWR model&lt;/P&gt;&lt;P&gt;model = GWR(y, X, kernel_weights)&lt;/P&gt;&lt;P&gt;# Fit the GWR model&lt;/P&gt;&lt;P&gt;results = model.fit()&lt;/P&gt;&lt;P&gt;# Predict the values of the dependent variable&lt;/P&gt;&lt;P&gt;predicted_values = results.predict(X)&lt;/P&gt;&lt;P&gt;# You can now use predicted_values for your predictions&lt;/P&gt;&lt;P&gt;print(predicted_values)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;However, running this code on the JupyterLab ends up with an error as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_126.jpg" style="width: 810px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78821i31CF43015A3846F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_126.jpg" alt="Clip_126.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_123.jpg" style="width: 988px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78818i4DF085B534EAF305/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_123.jpg" alt="Clip_123.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_124.jpg" style="width: 975px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78817iD7E8E58C63E2794A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_124.jpg" alt="Clip_124.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_125.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78819i67D8A62C5162F22F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_125.jpg" alt="Clip_125.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 17:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321265#M68466</guid>
      <dc:creator>JamalNUMAN</dc:creator>
      <dc:date>2023-08-22T17:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321300#M68467</link>
      <description>&lt;P&gt;spreg isn't an available package&lt;/P&gt;&lt;P&gt;You can do the same if you examine the code I referenced earlier&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 18:16:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1321300#M68467</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-08-22T18:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1323309#M68485</link>
      <description>&lt;P&gt;I have little knowledge in coding. All what I wanted is a python code for the Geographically Weighted Regression (GWR) that can work in Jupyter or Spyder&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_26.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79347i0E822A6E14B111F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_26.jpg" alt="Clip_26.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 05:28:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1323309#M68485</guid>
      <dc:creator>JamalNUMAN</dc:creator>
      <dc:date>2023-08-29T05:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 3.1.0: What is the python code for the Geographically Weighted Regression (GWR)?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1324086#M68498</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/geoanalytics/tools/gwr/" target="_blank"&gt;https://developers.arcgis.com/geoanalytics/tools/gwr/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/geeksnome/machine-learning-made-easy/blob/master/locally_weighted_regression.py" target="_blank"&gt;https://github.com/geeksnome/machine-learning-made-easy/blob/master/locally_weighted_regression.py&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_141.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79503iEA1B8C91BEB3DCD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_141.jpg" alt="Clip_141.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clip_142.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/79502iAB0C46392EBC4E31/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clip_142.jpg" alt="Clip_142.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 20:12:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-pro-3-1-0-what-is-the-python-code-for-the/m-p/1324086#M68498</guid>
      <dc:creator>JamalNUMAN</dc:creator>
      <dc:date>2023-08-30T20:12:04Z</dc:date>
    </item>
  </channel>
</rss>

