Giter Site home page Giter Site logo

Comments (6)

alexisfacques avatar alexisfacques commented on May 25, 2024

Hi @noVaSon !
Thanks for your support, you made me look back at this project and found a tiny bug occurring in the tree's generation, which is nice already!

Back to your issue, I believe we can work a solution out.
I needed a execution time assessment feature at the time, as my final goal was to compare this Typescript implementation with other pattern mining algorithms; but I believe it's not of great use to anyone else other than that; especially considering it's the only thing preventing this module from being run in a browser environment out of the box.

I like the idea of using browser-process-hrtime, but see no problem removing the time measurement feature too, keeping the project's dependencies low. Whatever you feel more appropriate.

If you have any piece of code, even in JS, feel free to contribute !

from node-fpgrowth.

noVaSon avatar noVaSon commented on May 25, 2024

Hi @alexisfacques!

It would be totally adequate to remove the timing output.
I just couldn't quickly figure out how to get rid of it using TypeScript...

I just did it this way in my project:

In the ES5 compiled ./node-modules/node-fpgrowth/dist/fpgrowth.js

var process = {}; process.hrtime = require('browser-process-hrtime');

That worked for me.

Alternatively if you want to keep the feature:
https://github.com/kumavis/browser-process-hrtime/blob/master/index.js

His solution is short and straight forward, if you port it to TypeScript, maybe add a check for node or process.hrtime() first, it would still work.

Thanks for your quick reply!
I am wondering why this repo is so lonely here :)

Best!

from node-fpgrowth.

alexisfacques avatar alexisfacques commented on May 25, 2024

I just removed the time measurement feature on the following branch: 002-make-this-module-runnable-in-browser.

FpGrowth.exec() now solely returns the array of itemsets once completed.

fpgrowth.exec(transactions) 
    .then( (itemsets: Itemset<number>[]) => { 
      // Returns an array representing the frequent itemsets. 
    }); 

Feel free to try and import it in your project 😄 Will merge and publish this new version to npm once sure it runs properly on a browser environment.
Maybe include a proper example on how to import the module on browser too.

from node-fpgrowth.

noVaSon avatar noVaSon commented on May 25, 2024

Unfortunately the branch includes only package.json, readme.md and examples when I try to install with npm install <repo-url>#<branch-name> like it is advised here.
So i tryed npm install https://github.com/alexisfacques/Node-FPGrowth.git#002-make-this-module-runnable-in-browser --save.

Need to try it another way later...
But thanks for your quick reply, helps a lot!

from node-fpgrowth.

alexisfacques avatar alexisfacques commented on May 25, 2024

@noVaSon Woops, I guess including the .npmignore to the repo was not the way to go.

Anyway, everything should be all set right now:

  • Just published a new 1.2.0 version to npm and encountered no incompatibilities with either webpack or browserify. This version also includes a pre-bundled ./dist/fpgrowth-client.js to import and use outside of these environments. 😉

Hope everything works for you.
Best !

from node-fpgrowth.

noVaSon avatar noVaSon commented on May 25, 2024

Yes, it works fine!
Thanks for your support!
Best,
Eric

from node-fpgrowth.

Related Issues (4)

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.