Comments (4)
why TypeScript? I think that the class is not a bad idea, do you see any advantage doing this?
from kmeans.
I think that's a very good idea. People will be familiar with the API. I think most people doing ML have worked with python and scikit before.
@maasencioh we've been experimenting with Typescript and it's awesome.
- Auto-completion and documentation as you code, really useful for ML where you often see have complex types
- Fix typos and type errors before even running the program
- Thinking with types in mind helps you to design a better API IMHO
- It's still just js at the end
- We often have a build step anyway (for example to support es6 modules)
- People have already expressed their desire to see MLJS in typescript
from kmeans.
Syntax is like Java, for reading the code maybe it's better, you need to write more code for the same result but personally I like the comments functionality for the argument types
from kmeans.
Migrating to a class would be great indeed but I would prefer to have something similar to pca, pls and other packages
const kMeans = new KMeans(dataset, options); (or new KMeans(dataset, numberClusters, options))
const newPoints = [[4.9, 3.2, 1.2, 0.4], [5.4, 3.3, 1.4, 0.9]];
console.log(kMeans.predict(newPoints)); // project new points into the PCA space
const model2 = kMeans.toJSON(); // to save the model
const kMeans2 = KMeans.load(model);
kMeans2.predict(newPoints);
from kmeans.
Related Issues (12)
- Calculating Within-cluster sum of squares & predictions HOT 1
- Compatibility with rollup and es6 HOT 2
- generate .d.ts file to support Typescript HOT 1
- Convert project to typescript
- does it works in n D HOT 1
- cannot import this library -- "no call signitures" HOT 3
- Change the parameters ? HOT 3
- Initialization methods HOT 5
- Interesting implementations and variations
- error message incorrect HOT 1
- Centroid value is NaN 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 kmeans.