py_pcha icon indicating copy to clipboard operation
py_pcha copied to clipboard

Finding S

Open pooyakhosravi opened this issue 4 years ago • 3 comments

Thank you for your implementation. I was wondering if it is possible to use your implementation to calculate the S2 for a new set of data (like validation data let's call it X2) or transform and inverse_transform them after we get the XC, C, S from a training set. For example, we can calculate the inverse_transform of our training data (X) using X_hat = np.matmul(XC, S), but is there a way to do the same for a new data that wasn't our original X to get X2_hat = np.matmul(XC, S2)?

pooyakhosravi avatar Jun 20 '20 06:06 pooyakhosravi

Just to second this, it would be amazing if the package also provided a predict method, which returned a n * k matrix signifying the probability of membership to each of the k archetypes identified by PCHA(). Thanks for publishing your implementation though, I appreciate a lot of work has gone in to it!

orbidder avatar Jan 11 '21 22:01 orbidder

Hi guys! Thanks for the kind words, this was a big effort at one point in my life, and I'm happy to see that people are finding it useful. To be completely honest, I don't really use archetypal analysis anymore, and have more or less lost touch with this code. If you need these features, I recommend you fork and make a pull request. I will gladly test your code and publish it to pypi if it runs so you can upgrade your py_pcha modules with pip.

ulfaslak avatar Jan 25 '21 20:01 ulfaslak

Just to second this, it would be amazing if the package also provided a predict method, which returned a n * k matrix signifying the probability of membership to each of the k archetypes identified by PCHA(). Thanks for publishing your implementation though, I appreciate a lot of work has gone in to it!

I'm not completely sure in my theory, but I think the Transpose S matrix is what you're looking for. It has the right dimensions and sums to 1 over each data point, however, I am not sure it can be considered a probability, for example, would a data point that is outside the convex hull be a combination of two archetypes but 0 in for all other archetype. So for K=3 you may get a datapoint looking like this [0.95,5,0] if your fine interpretating this as 95% probability of type 0 and 5% type 1 and 0% type 2 then you get your probability.

AndreasRaaskov avatar Jun 09 '23 08:06 AndreasRaaskov