alexisfacques / node-fpgrowth Goto Github PK
View Code? Open in Web Editor NEWFPGrowth Algorithm implementation in TypeScript / JavaScript.
Home Page: https://www.npmjs.com/package/node-fpgrowth
License: MIT License
FPGrowth Algorithm implementation in TypeScript / JavaScript.
Home Page: https://www.npmjs.com/package/node-fpgrowth
License: MIT License
Currently it gives me all possible itemsets.
What I want is a function that accepts an item and returns all its pairs (excluding itself) sorted in order of support
getRelatedItems(item, maxItems?)
var transactions = [
[1, 3, 4],
[2, 3, 5],
[1, 2, 3, 5],
[2, 5],
[1, 2, 3, 5]
];
getRelatedItems(1) // Output: [3, 5, 2]
getRelatedItems(2) // Output: [5, 3, 1]
getRelatedItems(3) // Output: [5, 2, 1]
getRelatedItems(4) // Output: []
getRelatedItems(5) // Output: [2, 3, 1]
Hey @alexisfacques , thanks a lot for such a nice library!
In my experiments, I have around 50-60k transactions and the algorithm stops working after some time, the process crashes with an OOM error. I have 16GB of RAM and it is all getting utilized by the library.
I understand that it's the nature of this algorithm to be inefficient in memory, but do you see any chances to make it work on a regular laptop? Some kinds of tweaks or optimizations maybe. Or use some external tools (such as databases, and file systems) for storing temporary results after each step.
Hi @alexisfacques!
This is very good work! I would like to use it in the frontend and there is an error of process.hrtime is not a function, because process is undefined.
I patched it by hand with the help of browser-process-hrtime, but I need to make this simple patch permanent.
What about including a runtime environment check in your code?
I could renounce the execution time anyway, but I failed to edit your Typescript code in my fork until here.
Regards!
noVaSon
node-fpgrowth/dist/fpgrowth.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node-fpgrowth/dist/fpgrowth.d.ts(15,22): error TS2420: Class 'FPGrowth' incorrectly implements interface 'IFPGrowthEvents'.
Property 'on' is missing in type 'FPGrowth'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.