Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multidimensional example #41

Open
alexandercommon opened this issue Aug 30, 2024 · 2 comments
Open

Multidimensional example #41

alexandercommon opened this issue Aug 30, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@alexandercommon
Copy link

I'm sure it would save a lot of us time if you provided even a rudimentary multidimensional example.

@alexandercommon
Copy link
Author

Email from the author, to the email address I had listed on my pubic resume repo. My response below.

from: O'Brien, Travis Allen [email protected]
to: [email protected]

Dear Alexander,

This is Travis O'Brien - the developer of fastKDE.

It appears from your resume that you might be seeking jobs, and I wanted to reach out directly in e-mail before responding to the issue you opened on github, since that issue and my response might have an impact.

The response I plan to provide on github would be along the lines of the following:

The very first example on the fastKDE webpage provides a rudimentary multidimensional example, and some more complex ones follow. The Open in Colab link should allow you to test this example immediately. There are more examples in the `examples/' folder. Is there some specific information you were seeking?

The reason I'm reaching out privately first is because your resume notes that one of your skills is "Learning quickly, Googling / info gathering" and another is "Empathy". This issue/interaction on github is part of your digital footprint, and your github page is something that I would scrutinize at as a potential employer.

This interaction could be perceived to undermine both of those skills: the info gathering skill because it could appear that you overlooked key documentation before opening your issue. The empathy skill may also appear to be undermined because the wording of the e-mail ("it would save a lot of us time if you provided even a rudimentary example") could be viewed as overlooking the fact that my main job has a lot of demands on my time and that I've provided and maintained fastKDE as free software as a side project that in the hopes that it will be useful to others. You may want to consider revising your issue; or if you feel that what I provided above addressed the issue you raised, you're welcome to delete the issue instead.

So you're aware, I plan on respond to the issue on github by the end of the week.

With Kind Regards,
-Travis-

--
Travis A. O'Brien
Pronouns: he/him

Fall 2024 Student Hours (M—Th): Book Time

Assistant Professor
Earth and Atmospheric Sciences
Indiana University, Bloomington

Visiting Faculty
Climate and Ecosystem Sciences Division
Lawrence Berkeley Lab

Topical Editor

Geoscientific Model Development

https://earth.indiana.edu/directory/faculty/obrien-travis.html
+1 (812) 856-6298

I was considering "multidimensional" to refer to dimensions beyond the cartesian plane. This was a potential mistaken interpretation my part.

To reiterate my point, presuming this is an indended use case, it might've been helpful if one of the eleven contributors over the past ten years could've written an example for this.

Here's an example (likely incorrect) of the sort of thing that might help future users of the repo.

import numpy as np
from fastkde import fastKDE

n_points = 1000
X = np.random.normal(size=n_points)
Y = np.random.normal(size=n_points)
Z = np.random.normal(size=n_points)

data = np.vstack([X, Y, Z])

kde = fastKDE.fastKDE(data)

pdf = kde.pdf
axes = kde.axes

print("PDF shape:", pdf.shape)
print("Axes lengths:", [len(axis) for axis in axes])

@taobrienlbl
Copy link
Collaborator

To clarify @alexandercommon - it sounds like when you say multidimensional here, you mean more than two dimensions: e.g., three dimensions as in the example you provided? If so, it is a minor modification of the two dimensional example given in the readme:

import numpy as np
import fastkde
import matplotlib.pyplot as plt

#Generate three random variables dataset (representing 100,000 pairs of datapoints)
N = int(1e5)
x = 50*np.random.normal(size=N) + 0.1
y = 0.01*np.random.normal(size=N) - 300
z = np.random.normal(size = N)

#Do the self-consistent density estimate
PDF = fastkde.pdf(x, y, z, var_names = ['x', 'y','z'])

Note that the above assumes that xarray is installed; use of xarray objects is a feature recently added in v2.

Note also that while the underlying technique that fastKDE uses can extend to higher dimensions--more variables--a practical limitation associated with memory (see #5) limits this to four or five variables.

I'd welcome a contribution if you'd like to fork the repository, augment the documentation, and issue a pull request.

@taobrienlbl taobrienlbl added documentation Improvements or additions to documentation good first issue Good for newcomers labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants