Keyword Set Similarity

No algorithm description given

Determines similarity between sets of weighted keywords.  How it works: Each keyword set is represented as a Map<String,Double>, where the String is the keyword and the Double is it's weight. The similarity of two sets is the sum of the products of the weights of their shared keywords, for instance, if set A has keywords "dog", "cat", and "mouse" with weights 1,2, and 2, respectively and set B has keywords "dog", "cat", and "moose" with weights 1.5,3, and 4, their similarity by this metric is 1*1.5 + 2*3 = 7.5. This can be thought of as the inner product of word vectors. Input format: [{id1:{word1:weight1, word2:weight2}, id2:{word3:weight3}}, 2] The most convenient input format for a set of keyword sets is  Map<String,Map<String,Double>>, where the first String key is an identifier for the keyword set, and its value, a Map<String,Double>, is the set of keywords with their respective weights as values. The algorithm also requires an int that determines the maximum number of similar sets to return for each keyword set.  You do not have to name the sets, if you just provide a List<Map<String,Double>>, the algorithm takes the index of each set as the id and returns the output accordingly. Output format: The output is a Map from Strings to Set<String>'s, where the Set<String> value is the set of most similar keyword sets (denoted by a  String identifier ).

Tags
(no tags)

Cost Breakdown

0 cr
royalty per call
1 cr
usage per second
avg duration
This algorithm has permission to call other algorithms which may incur separate royalty and usage costs.

Cost Calculator

API call duration (sec)
×
API calls
=
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

Calls other algorithms

This algorithm has permission to call other algorithms. This allows an algorithm to compose sophisticated functionality using other algorithms as building blocks, however it also carries the potential of incurring additional royalty and usage costs from any algorithm that it calls.


To understand more about how algorithm permissions work, see the permissions documentation.

1. Type your input

2. See the result

Running algorithm...

3. Use this algorithm

curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/nlp/KeywordSetSimilarity/0.1.4
View cURL Docs
algo auth
# Enter API Key: YOUR_API_KEY
algo run algo://nlp/KeywordSetSimilarity/0.1.4 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://nlp/KeywordSetSimilarity/0.1.4");
AlgoResponse result = algo.pipeJson(input);
System.out.println(result.asJsonString());
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._

val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://nlp/KeywordSetSimilarity/0.1.4")
val result = algo.pipeJson(input)
System.out.println(result.asJsonString)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://nlp/KeywordSetSimilarity/0.1.4")
           .pipe(input)
           .then(function(output) {
             console.log(output);
           });
View Javascript Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://nlp/KeywordSetSimilarity/0.1.4")
           .pipe(input)
           .then(function(response) {
             console.log(response.get());
           });
View NodeJS Docs
import Algorithmia

input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('nlp/KeywordSetSimilarity/0.1.4')
print algo.pipe(input)
View Python Docs
library(algorithmia)

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("nlp/KeywordSetSimilarity/0.1.4")
result <- algo$pipe(input)$result
print(result)
View R Docs
require 'algorithmia'

input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('nlp/KeywordSetSimilarity/0.1.4')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::*;

let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo('nlp/KeywordSetSimilarity/0.1.4');
let response = algo.pipe(input);
View Rust Docs
Discussion
  • {{comment.username}}