Comments (19)
hi @shiffman! i often dig into the (now relatively old) CalTech-256 which is structured into 256 rather random categories. the tsne demo just is the subset of those categories which are animals. it's neatly organized so it's easy to make themed subsets.
from ml5-library.
Adding to this thread a good reference for t-SNE by @enjalot
https://distill.pub/2016/misread-tsne/
from ml5-library.
Amazing reference! Realtime tSNE Visualizations with TensorFlow.js by @Nicola17
https://twitter.com/nicolapezzotti/status/1004866454578257922?s=11
https://ai.googleblog.com/2018/06/realtime-tsne-visualizations-with.html
from ml5-library.
this looks really nice. great find!
from ml5-library.
We could work on porting this:
https://github.com/tensorflow/tfjs-tsne
from ml5-library.
@jwilber - Sure thing! Thanks so much for your interest in ml5! This issue has been open awhile and we'd love to open up these kinds of methods to the ml5 community. No pressure on timing! Also nice to enjoy the summer :)
Also - I'm assuming I should implement each alg using tensorflowjs?
- Yes and no. While we've noticed that sometimes using tensorflow can be overkill, the nice thing is that we can have more consistent implementations for things as well as reduce the need for more dependencies. However, sometimes it is better not to use a "screwdriver to hammer in a nail" ;)
Is there a particular version? Thanks!
- Currently we are using tensorflow.js version 1.1.2. Word on the street is that version 2.0 is coming in with some big changes so maybe this is something to keep in the back of our minds. As an aside: We have a dependency to tensorflow/magenta: https://github.com/tensorflow/magenta which is currently using tensorflow version 1.0.2 so we should try to be aware to not diverge too far if possible.
p.s. Your pudding.cool piece on skate music is one of my favorite data viz/editorial pieces. I can still remember every trick on beat for all skate videos between ~2000 - 2010. I love the line _Classic rock is often used with a so-called βheshβ style of skateboarding, _ π
from ml5-library.
Haha, thanks a lot! Skateboarders of the world unite β. (I actually watched Appleyard's part in Sorry recently and oh, man, the waves of nostalgia I felt when the Placebo song came on were insane).
Re: implementation: As a first pass I'll just grab any relevant functions I need from tf.js, and if it only turns out to be a few we can discuss cleaning up the dependencies (i.e. rewriting them as class methods or whatever) in the PR.
Looking forward to contributing :)
from ml5-library.
Any ideas for a good sample dataset to try with this? Eventually I'd like to try some interesting demos like @genekogan's amazing TSNe Viewer but will start with something smaller, simpler and more suited for kmeans.
Maybe colors or small corpus of word vectors?
from ml5-library.
The iris dataset is popular for kmeans demos. There are only four dimensions so it's relatively simple to visualize the clusters.
If the intended audience is new to machine learning, the results can be visualized without additional concepts such as PCA.
also, I believe the example is now here: https://github.com/ml5js/ml5-examples/tree/master/p5js/WIP_clustering/kmeans
from ml5-library.
I had originally made a pull request for this, but development fell off and I closed the pull request. I'm leaving some breadcrumbs here for reference.
from ml5-library.
I can work on some of these over summer - is there a particular API I should strive for/methods I should expose?
from ml5-library.
Hi @jwilber - Hooray! Thanks so much for your interest. This would be super wonderful.
I'm happy to chat more about the API structure anytime (I know @shiffman and @yining1023 will have great feedback here), but in general, the ml5 process goes something like:
- load a model & data
classify()
,segment()
,generate()
etc... in this case maybe.cluster()
?- do something with the results
So a rough rough proposal might be something where you set a bunch of options and the kmeans just spits out a bunch of results:
const options = {
prop1: 1,
prop2: 'something'
}
const dataUrl = 'rainbowData.csv'
const kmeans = ml5.cluster('kmeans', dataUrl, options, modelWithDataLoadedCallback)
function modelWithDataLoadedCallback(err, data){
if(err){
return err;
}
console.log(results)
)}
Maybe a different approach could be something like:
const options = {
prop1: 1,
prop2: 'something'
}
const dataUrl = 'rainbowData.csv'
const kmeans = ml5.cluster('kmeans', dataUrl, dataLoadedCallback)
function dataLoadedCallback(err, _data){
if(err) return err;
kmeans.classify(data, options, dataCrunchedCallback)
}
function dataCrunchedCallback(err, data){
if(err) return err;
// do something with the data
}
I'm not sure yet what the terminology or function naming would be best here quite yet, but in general, we try to use more approachable terms or helpful analogies.
I also wonder if it makes sense if some of these functions become "helper" functions like:
ml5.helpers.kmeans()
turf.js has a kmeans implementation for geo operations. Maybe there's some helpful nuggets in there for us too?
from ml5-library.
@joeyklee thanks for the detailed response! I won't be able to get started until roughly the end of the month, so expect an update around then :)
Also - I'm assuming I should implement each alg using tensorflowjs? Is there a particular version? Thanks!
from ml5-library.
@jwilber :
- Yes! π€ - The part that always gets me is Pappalardo's part in Mosaic. The twangy guitar intro mixed w/ the b-roll images were so nicely cut to Dinosaur Jr!
Re implementation:
- Sounds perfect!
- For me the nicest thing would be to wrap up the relevant tf.js functions in a friendly way and show a few examples of how and when different clustering methods might be handy.
- We'd certainly welcome PRs to the ml5-examples repo in case you had some simple but illuminating ways to showcase in which contexts how kMeans, for example, might be useful. Any ideas are welcome!
Thanks!
from ml5-library.
Sorry for long response (had heart surgery and it took longer to recover than I thought) - I'll start working on this over the weekend, so expect a first pass next week!
from ml5-library.
@jwilber - Thanks for the update + no worries. I hope you have a speedy recovery! As many of the ml5 team have been on holidays (myself included) we're also getting caught up with issues and PRs etc.
Thanks + take care!
from ml5-library.
Just making a note that the KMeans
class is now part of the development
branch via @jwilber β¨
from ml5-library.
Linking to: #563
from ml5-library.
Thanks for adding this class! Closing for now, since we have a separate issue for DBScan.
from ml5-library.
Related Issues (20)
- objectDirector() I can use a trained model from teachable machine
- Using safetensors or pkl models (like python)
- ml5.min.js.map not found if offline HOT 2
- DOMException: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': Tainted canvases may not be loaded. HOT 1
- knnClassifier result after .save() and .load() - classIndex becomes undefined and label becomes number, labelToClassId disappears HOT 1
- memory leak in featureExtractor on addImage in WebGL backend HOT 3
- ML5 fails to load on Chrome incognito - localstorage error HOT 1
- PoseNet Bug using custom trained model in a reactjs environment HOT 6
- about use ml5 in vue HOT 1
- How should we handle input data with Nulls/Blanks? HOT 1
- Always outputting the same thing. Might be something wrong with my HTML not sure HOT 2
- add facemesh and handpose to preload
- Possible memory leak in BodyPix and WEBGL
- Various problems with the training-charRNN repo
- Problem with CORS HOT 1
- model topology missing handpose regression HOT 9
- ERR_CONNECTION_REFUSED
- New m15 Coder, couldn't find answer online, Error "Error in oneHot: depth must be >=2, but it is 1" HOT 1
- Memory leak in PoseNet's video processing pattern HOT 3
- "Feature Extractor Examples" from ml5.js website / TypeError: Failed to fetch HOT 9
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 ml5-library.