Comments (5)
2nd observation, I couldn't get your browserify bundle to work with NodeJS, normally those Browserify bundles work for both Browser & NodeJS.
Might be something to consider looking into.
$ node
> require('./skmeans')
ReferenceError: window is not defined
at Object.__dirname.1../main.js (/Users/mac/Github/turf/packages/turf-clusters-kmeans/skmeans2.js:21:6)
at s (/Users/mac/Github/turf/packages/turf-clusters-kmeans/skmeans2.js:8:44)
at e (/Users/mac/Github/turf/packages/turf-clusters-kmeans/skmeans2.js:13:3)
at Object.<anonymous> (/Users/mac/Github/turf/packages/turf-clusters-kmeans/skmeans2.js:15:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
from skmeans.
Hi @DenisCarriere,
Normally I only use grunt/browserify to export the module to browser only (as a 'window' global variable), because I assume that node users will only use the "require()". But I will take a look into the issue, providing a more standarized module, with window and require modes for ES5
from skmeans.
Thanks for looking into this.
Seems like you are using an outdated browserify library or some configurations are hardcoded for only browser.
I've been able to use this Browserify bundle and it works with Node, so it's not Browserify the issue.
https://wzrd.in/standalone/skmeans@latest
Also ES5 is not only for Browser support, NodeJS 4 doesn't support all the newest fancy gadgets that ES6 has to offer.
from skmeans.
Hi @DenisCarriere, I've updated the module to include both, an only browser module, and a ES5 version for Node.
Now, package.json points to the ES5 distribution, so it will work on older node versions, allowing you also to correctly browserify your project.
Current version is 0.9.7, also published in npm
from skmeans.
👍 Perfect! Thanks @solzimer
FYI: I've locked the version to 0.9.7
, but if you ever release a major release or a critical patch, just send a PR to TurfJS or @
me.
from skmeans.
Related Issues (16)
- K-means++ for initial cluaters HOT 8
- kmpp cluster initialization option does not use custom distance function HOT 1
- `result.it` is wrong if specifying max iterations HOT 1
- TypeScript definitions HOT 2
- Possible mutation-related bug HOT 1
- Same run gives different results HOT 2
- Pass in a random value seed to cluster initialization functions HOT 3
- [0, 0] centroid HOT 8
- Types in the @types/skmeans package are wrong
- License? HOT 1
- How to tell which centroid is most common/ HOT 1
- How to visualise the data?
- FR: custom distance function HOT 1
- Undefined centroid HOT 1
- skmeans object doesnt have predict method. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skmeans.