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

API documentation? #34

Closed
Fil opened this issue Aug 9, 2023 · 4 comments
Closed

API documentation? #34

Fil opened this issue Aug 9, 2023 · 4 comments

Comments

@Fil
Copy link
Contributor

Fil commented Aug 9, 2023

Hello,

I've tried to upgrade my older notebook from 0.3.5 to 0.7.1, and several of the methods break (FASTMAP, PCA, etc). I'm not sure where to find the new API documentation so I can fix this? Thanks!

@saehm
Copy link
Owner

saehm commented Aug 9, 2023

Hey,

the documentation for FASTMAP is here: https://saehm.github.io/DruidJS/FASTMAP.html

I hope this helps!

@saehm
Copy link
Owner

saehm commented Aug 9, 2023

I checked your notebook, and the druid code.

For me, the notebook works for the iterative methods with this:

result = Generators.observe(
  worker(
    function dr({ dr_method, data }) {
      return druid[dr_method].generator(data, {});
    },
    { dr_method, data },
    `
importScripts(${JSON.stringify(
      await require.resolve("@saehrimnir/druidjs@^0.7.1") // note: version 0.7 changes the API, breaking FASTMAP to PCA in this notebook. See https://observablehq.com/@saehrimnir/hello-druidjs/2
    )});
`
  )
)

The generator function just calls the transform function and returns its results, maybe i need to use yield instead?

All the methods work for me with the transform function return druid[dr_method].transform(data, {});.

The second parameter {} is (as a workaround) needed for the DR methods which have a neighbors parameter.

@Fil
Copy link
Contributor Author

Fil commented Aug 9, 2023

I see. So we need one of:

 yield druid[dr_method].transform(data, {});
 yield* druid[dr_method].generator(data, {});

How can I distinguish the methods that have a working generator? (I think it's the same question as #13 (comment) :) )

@saehm
Copy link
Owner

saehm commented Aug 11, 2023

I fixed the issue of the methods which need a neighbor parameter.
I already added the generator function for all DR methods when you were talking about this here: #13 (comment).
But they did not work yet. With version 0.7.3, your notebook works for all DR techniques with your code, but also with this code:

result = Generators.observe(
  worker(
    function dr({ dr_method, data }) {
      return druid[dr_method].generator(data); // show the steps
    },
    { dr_method, data },
    `
importScripts(${JSON.stringify(
      await require.resolve("@saehrimnir/druidjs@^0.7.3")
    )});
`
  )
)

@saehm saehm closed this as completed Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants