Coder Social home page Coder Social logo

Comments (5)

hojwk avatar hojwk commented on August 26, 2024

CIDR utilises the package Rcpp, which automatically generates C & C++ code based on the Rcpp code (slightly modified C++ code) that we write.

This is the case when Rcpp generates _cpp_dist from our cpp_dist code.

For more information, you could look into the Rcpp documentation.

from cidr.

eleozzr avatar eleozzr commented on August 26, 2024

Thank you very much. But what's the your cpp_dist and cpp_dist_weighted code? I know the function eigen_centre and getEigenSpace have been defined explictly in the scr directory. But I still could not understand why the funtion cpp_dist and cpp_dist_weighted can be called directly in your scDissim function. Can you give me some notations?

from cidr.

hojwk avatar hojwk commented on August 26, 2024

We can call the C++ functions (that use Rcpp libraries) cpp_dist & cpp_dist_weighted directly from the R function scDissim because we are using the R package Rcpp. This is the beauty of using Rcpp - it abstracts the need for us to know how this process works.

You may notice in the source code located in src/scPCA.cpp, which contains the functions cpp_dist & cpp_dist_weighted, there is a line in the code directly before each function:
// [[Rcpp::export]]
This is part of the required Rcpp procedure to allow the C++ function to become available in the R code.

from cidr.

eleozzr avatar eleozzr commented on August 26, 2024

Thank you very much. I guess I see now. It is very interesting and useful, which is a great work. By the way, I have another question. At the end of your code, thre is some lines to compute the optimal number of clusters, But I don't fully understand why you calculate like that.
image

from cidr.

hojwk avatar hojwk commented on August 26, 2024

The typical shape for the CH index may have one peak that is clearly defined - see example(cidr) CH plot for one such example. In this case it may be reasonable to select the peak, which may correspond to the @Best.nc. However, we have found with a number of data sets, where we may know the real number of clusters, that this single peak shape does not hold. In some of these cases, the CH plot is monotinically decreasing, and @Best.nc is a lower number of clusters than we know to be true. Hence we empirically determined the displayed code via experimentation with a number of data sets, which is a form of the scree method (see CIDR paper for reference). The idea of the code is to find an "elbow" in the CH plot where the gradient may change significantly from the previous part of the plot. The user is encouraged to examine the CH plot, and the default number of clusters suggested by CIDR. If not happy with what CIDR produces, the user is able to override the value.

from cidr.

Related Issues (13)

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.