Comments (12)
Hi
I am trying to use jaccard matrix as an attribute to clusterfck -- here is my code :
var clusters = clusterfck.hcluster(dataarray, clj_fuzzy.metrics.levenshtein, clusterfck.COMPLETE_LINKAGE);
however, it always returns single node for each array item
from clj-fuzzy.
Hello @PrayagAshwini. I am not very acquainted with how the clusterfck
works so it is quite difficult to help you efficiently. However, your example uses the levenshtein
function rather than the jaccard
one.
from clj-fuzzy.
Could you elaborate a bit more on what you are trying to do @PrayagAshwini, please?
from clj-fuzzy.
thanks for quick response Yomguithereal .
Actually I tried both Jaccard & levenshtein, however none of them working. same output with any matrix attribute.
I am using clj-fuzzy - v0.3.1 js file .
let me know if you get any other pointers.
from clj-fuzzy.
Do you have a sample of the data you are trying to cluster somewhere so I can run tests on my side?
from clj-fuzzy.
here is sample data - ["economictimes.com","food.com","gaana.com","google.com","facebook.com","food.com","facebook.com","food.com"]
from clj-fuzzy.
After running some tests on my own, I am not sure this library is really suited to analyze strings. It seem that it will only process numbers.
from clj-fuzzy.
Moreover the library behaves quite strangely, sometimes it computes instantaneously but sometimes it just does not compute at all or very slowly. Besides the library is not maintained anymore.
from clj-fuzzy.
Why don't you use something like hierarchical-clustering
:
var cluster = require('hierarchical-clustering'),
metrics = require('clj-fuzzy').metrics;
var data = [
'economictimes.com',
'food.com',
'gaana.com',
'google.com',
'facebook.com',
'food.com',
'facebook.com',
'food.com'
];
// Single-linkage clustering
function linkage(distances) {
return Math.min.apply(null, distances);
}
var levels = cluster({
input: data,
distance: metrics.jaccard,
linkage: linkage,
minClusters: 2, // only want two clusters
});
var clusters = levels[levels.length - 1].clusters;
clusters = clusters.map(function (cluster) {
return cluster.map(function (index) {
return data[index];
});
});
console.log(clusters);
from clj-fuzzy.
thanks Yomguithereal. The above code is working.. however metrics parameter is not working..
here is data -
[ 'chatting.com', 'chrysler.com', 'economictimes.com', 'food.com', 'toopgaana.com', 'health.nih.gov', 'ibncnn.com', 'nytimes.com', 'khaanakhajana.com','kidshealth.org','makaan.com', 'photography.com', 'pinrest.com', 'test.com', 'thetimes.co.uk', 'topgames.com', 'topnonprofits.com' ]
And output is -
[["kidshealth.org"],["topnonprofits.com","topgames.com","toopgaana.com","test.com","food.com","pinrest.com","nytimes.com","makaan.com","ibncnn.com","chrysler.com","chatting.com","thetimes.co.uk","economictimes.com","khaanakhajana.com","photography.com","health.nih.gov"]]
whether I use "metrics.jaccard," or " metrics.levenshtein" ..
Any pointers??
I would like to receive output something like below --
[["kidshealth.org"], ["topnonprofits.com", "topgames.com", "toopgaana.com"], ["test.com"],["food.com"], ["pinrest.com"], ["thetimes.co.uk", "economictimes.com", "nytimes.com"],["makaan.com"] ,["ibncnn.com"], ["chrysler.com", "chatting.com"], ["khaanakhajana.com"], ["photography.com"], ["health.nih.gov"]]
from clj-fuzzy.
You can try to fiddle with the minClusters
option to increase the number of possible clusters generated by the algorithm.
from clj-fuzzy.
I tried that.. however it just creates more clusters with single item, and remaining all in one..
If I provide manual distance formula, it clusters at least two values starting with "ch" and remaining items listed correctly as single item.
// Euclidean distance
function Edistance(a, b) {
var d = 0;
for (var i = 0; i < a.length; i++) {
d += Math.pow(a[i] - b[i], 2);
}
return Math.sqrt(d);
}
output
[["chrysler.com","chatting.com"],["economictimes.com"],["food.com"],["toopgaana.com"],["health.nih.gov"],["ibncnn.com"],["nytimes.com"],["khaanakhajana.com"],["kidshealth.org"],["makaan.com"],["photography.com"],["pinrest.com"],["test.com"],["thetimes.co.uk"],["topgames.com"],["topnonprofits.com"]]
from clj-fuzzy.
Related Issues (20)
- dice algorithm NaN HOT 7
- Fix Levenshtein ortographe
- Switch to gulp
- Fix the cljx pb
- Lovins stemmer
- Rework headers and descriptions
- Repo needs `index.js` so that it can be invoked with `require` HOT 3
- Switch to cljx or feature expressions
- Levenstein distance performance HOT 6
- issue using this project as a dependency in clojurescript HOT 17
- Cologne phonetic will drop the first place 0 erroneously
- Something seems to be amiss with Jaro distance & long strings
- Levenshtein Distance Error On Empty Sequence HOT 1
- Clojurescript should be a dev dependency HOT 5
- Spanish support? HOT 13
- Documentation website outdated HOT 6
- Jaro-Winkler returns unexpected values for two nil inputs HOT 4
- Big-O Performance HOT 2
- interferes with other modules, do NOT use this module unless it's fixed HOT 1
- Is it appropriate to add a non-formal algorithm? HOT 4
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 clj-fuzzy.