Coder Social home page Coder Social logo

jeremygelb / geocmeans Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 2.0 131.44 MB

An R package to perform Spatial Fuzzy C-means

License: GNU General Public License v2.0

R 75.35% TeX 1.80% C++ 22.56% C 0.30%
spatial-fuzzy-cmeans fuzzy-classification-algorithms r unsupervised-learning clustering spatial-analysis cmeans

geocmeans's People

Contributors

jeremygelb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

geocmeans's Issues

Check if the data provided are SpatRaster

With the change from raster to terra, the expected input format for raster data is now a list of spaRaster objects and not raster objects. If one gives rasters object, the error produced is not helpful.

geocmeans should test the type of object given and return an error if they are not from the expected class.

Examples Lack Seed Values, Leading to Inconsistent Results

I've noticed that the examples provided do not include seed values when utilizing random processes, such as clustering. I was wondering if you expect reproducibility or not. For example, in the following examples:

https://jeremygelb.github.io/geocmeans/articles/introduction.html

While it's understood that in clustering, some variability can be acceptable, setting a seed ensures reproducibility and consistency in the results, especially for examples and tutorials.

Thank you for your hard work on this package, and I look forward to any updates.

This issue is related to openjournals/joss-reviews#5259 .

Please remove dependencies on **rgdal**, **rgeos**, and/or **maptools**

This package depends on (depends, imports or suggests) raster and one or more of the retiring packages rgdal, rgeos or maptools (https://r-spatial.org/r/2022/04/12/evolution.html, https://r-spatial.org/r/2022/12/14/evolution2.html). Since raster 3.6.3, all use of external FOSS library functionality has been transferred to terra, making the retiring packages very likely redundant. It would help greatly if you could remove dependencies on the retiring packages as soon as possible.

Clustering functions fail for only one raster

I am excited about this package! Thank you for developing it.

If I supply a list with only one raster to any of the clustering functions I get an error

"Error in `colnames<-`(`*tmp*`, value = okname) : 
  attempt to set 'colnames' on an object with less than two dimensions" 

But, supplying a list with two rasters works.

Expected behaviour: One should also be able to make a clustering using just a single variable, correct? e.g. a map of NDVI

> R.Version()
$platform
[1] "x86_64-w64-mingw32"
$arch
[1] "x86_64"
$os
[1] "mingw32"
$system
[1] "x86_64, mingw32"
$version.string
[1] "R version 4.1.2 (2021-11-01)"

Reproducible example

library(geocmeans) # 0.2.0
library(raster) # v 3.5-15

# example rasters r and s
r <- raster(nrows=10, ncols=10)
values(r) <- runif(ncell(r)) 
s <- raster(nrow = 10, ncol = 10)
values(s) <- rnorm(ncell(s))


CMeans(data = list(r), # one raster
               k = 3,
               m = 1.5,
               maxiter = 100,
               seed = 235)
# Error in `colnames<-`(`*tmp*`, value = okname) : 
# attempt to set 'colnames' on an object with less than two dimensions


CMeans(data = list(r,s), #using two rasters works
               k = 3,
               m = 1.5,
               maxiter = 100,
               seed = 235)

# [1] "Standardizing the data (set parameter to FALSE to avoid this step)"
# |=====================                     |  29%[1] "criterion reached"



# Same behaviour for other functions. e.g.


GCMeans(data = list(s), # doesn't work
        k = 3,
        m = 1.5,
        beta = 1,
        maxiter = 100,
        seed = 235)

#[1] "Standardizing the data (set parameter to FALSE to avoid this step)"
#Error in `colnames<-`(`*tmp*`, value = okname) : 
#  attempt to set 'colnames' on an object with less than two dimensions



window.matrix <- matrix(1/9,nrow = 3, ncol = 3)

SFCMeans(data = list(r),
         window = window.matrix,
         k = 3,
         m = 1.5,
         alpha = 1)

# Error in `colnames<-`(`*tmp*`, value = okname) : 
# attempt to set 'colnames' on an object with less than two dimensions

mapClusters

Hi,

First of all, thank you for developing this much needed package.

I ran into an error using mapCluster function.
Code
cmeansMaps<- mapClusters(reseauALL_C_sp,Cmean$Belongings,undecided = 0.45)
Message
Error in fix.by(by.y, y) : 'by' must specify a uniquely valid column

where reseauALL_C_sp is a sp dataframe, the same that was used to create the membership matrix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.