ziqi-li / fastgwr Goto Github PK
View Code? Open in Web Editor NEWFast Geographically Weighted Regression (FastGWR)
Home Page: https://www.tandfonline.com/doi/full/10.1080/13658816.2018.1521523
License: MIT License
Fast Geographically Weighted Regression (FastGWR)
Home Page: https://www.tandfonline.com/doi/full/10.1080/13658816.2018.1521523
License: MIT License
Hello,
Thank you for sharing the great code of Fast GWR.
I have used my own file like below.
zillow = pd.read_csv("model.csv",sep=',')
zillow.head()
But I have got the below error. Please let me know how to fix it.
#Running FastGWR 1 Processor with auto bandwidth search
!fastgwr run -np 1 -data model.csv -out results_adap.csv -adaptive -constant
Usage: fastgwr run [OPTIONS]
Try 'fastgwr run --help' for help.
Error: no such option: -c
I had issues with FastGWR on two Linux Mint (Ubuntu derivative) machines. One was Linux Mint 19.3 (tricia/bionic) with python 3.8.0 and the other was Linux Mint 20 (ulyana/focal) with python 3.8.5. fastgwr --version
worked, but when testing/running the software, I was getting various errors about mpiexec despite mpiexec being installed. The error ended up being that I needed to update alternatives for python because both systems had python2 and python3 installed.
To check if you have the same problem run:
>>> update-alternatives --list python
update-alternatives: error: no alternatives for python
If you get the error above, follow the steps in this article to update alternatives to set Python to the correct version. I was using Python 3.8 so for both machines the solution was:
>>> sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python (python) in auto mode
This comand sets python3.8 to your first priority alternative for python. To check this worked, run
>>> update-alternatives --list python
/usr/bin/python3.8
You should get the correct python3 as the result of the command. To check that this solved the issue with FastGWR run:
>>> fastgwr testgwr
Testing GWR with zillow data:
------------------------------------------------------------
Starting FastGWR with 2 Processors
Spatial Kernel: Adaptive Bisquare
Data Input Path: https://raw.github.com/Ziqi-Li/FastGWR/master/Zillow-test-dataset/zillow_1k.csv
Output Result Path: fastgwr_rslt.csv
Intercept: True
Optimal Bandwidth Searching...
Range: 50 1000
BW, AICc 413.0 12499.779288982281
BW, AICc 637.0 12531.633782051933
BW, AICc 274.0 12474.956021862543
BW, AICc 189.0 12431.308996341173
BW, AICc 136.0 12409.551843948328
BW, AICc 103.0 12408.264954026834
BW, AICc 83.0 12421.22851668721
BW, AICc 116.0 12405.67119279391
BW, AICc 123.0 12406.489388497328
BW, AICc 111.0 12405.452378901939
BW, AICc 108.0 12405.964286829414
BW, AICc 113.0 12405.540369991997
BW, AICc 110.0 12405.334206357205
BW, AICc 109.0 12405.904039101335
Fitting GWR Using Bandwidth: 110.0
Diagnostic Information:
AICc: 12405.334206357205
ENP: 112.68000986186829
R2: 0.7543256014825577
Total Time Elapsed: 3.58 seconds
------------------------------------------------------------
I noticed that the code fails if there is a singular matrix because you're using inverse rather than pseudo-inverse.
I wanted to check if this was intentional as I'm not an expert on GWR. If not, I'd be happy to make a pull request that catches the singular matrix error and then uses the pseudo-inverse.
Thanks!
Disregard
李博士 你好:
为了保证我的表述准确,请允许我先以中文叙述,后我会以英文再次叙述我的问题以保证讨论能被尽可能多的人理解。
考虑到大量的数据往往是存在时间动态的,但mgwr或gwr并没有解决这一点,而当前已有的广泛使用的模型gtwr考虑了时间但没有考虑不同自变量的多尺度问题,也因此有了mgtwr方法,该方法在github上同样有共享库(https://github.com/sunkun1997/mgtwr)。
然而正如fastgwr方法所讨论的核心问题一样,我现在正试图处理百万级别时空Postion的数据,该方法的应用包括gtwr方法在内都要求几十t的内存,这无疑是不可能的。
请问是否可以在您的工具里添加gtwr方法或更进一步添加mgtwr方法?
谢谢你的阅读,期待您的回复。
Hello, Dr. Li.
In order to make sure that my statement is accurate, please allow me to state my question in Chinese first, and then I will state my question again in English to ensure that the issue can be understood by as many people as possible.
Considering that a large amount of data is often time-dynamic, mgwr or gwr does not solve this problem, and the existing widely used model gtwr considers time but does not consider the multi-scale problem of different independent variables, hence the mgtwr method. The method on making the same Shared library in github(https://github.com/sunkun1997/mgtwr).
However, as the core problem of the fastgwr method is discussed, I am now trying to deal with the data of the million-level space-time Postion, and the application of this method, including the gtwr method, requires tens of terabytes of memory, which is undoubtedly impossible.
Is it possible to add gtwr methods to your tool or go further and add mgtwr methods?
thanks.
XIaoran Yin
Does this version have a version that calls the server GPU
Is it possible to add an argument for spherical coordinates like mgwr has? I see that mgwr is computing the haversine and that FastGWR is using cdist, which I believe can be passed "metric=haversine".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.