Downloads · 30 days
15
15% of all-time downloads
micposso/word-semantic-similarity
word-semantic-similarity is a machine learning model from micposso. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for sentence-transformers. The card lists the license as apache-2.0.
Model Name: PatentSim Word Semantic Similarity Author: Michael Posso Source: Trained for the Kaggle "U.S. Patent Phrase to Phrase Matching" competition License: Apache 2.0
Downloads · 30 days
15
15% of all-time downloads
All-time downloads
100
Public
Repo size
531 B
Likes
0
Public
Click a slice to open those files.
.md3.2 KB · 60%
From the Hugging Face model README
Model Name: PatentSim Word Semantic Similarity
Author: Michael Posso
Source: Trained for the Kaggle "U.S. Patent Phrase to Phrase Matching" competition
License: Apache 2.0
PatentSim is a lightweight, hybrid machine learning pipeline designed to evaluate the semantic similarity between pairs of phrases in the context of patent literature. The model combines a pre-trained transformer-based sentence encoder with a ridge regression model trained on cosine similarity scores. It was developed as part of the Kaggle competition hosted by the U.S. Patent and Trademark Office (USPTO).
This model addresses the critical need for semantic equivalence detection in legal and technical language, supporting tasks such as patent search, prior art retrieval, and claim comparison.
all-mpnet-base-v2alpha=1.0), trained to map cosine similarity to semantic relatedness scoressentence-transformers/all-mpnet-base-v2.from sentence_transformers import SentenceTransformer, util
import joblib
import numpy as np
# Load embedding model
model = SentenceTransformer("sentence-transformers/all-mpnet-base-v2")
# Load regression model
from joblib import load
reg = load("ridge_model.joblib")
def predict_similarity(anchor, target):
a_emb = model.encode(anchor, convert_to_tensor=True)
t_emb = model.encode(target, convert_to_tensor=True)
cosine_sim = util.cos_sim(a_emb, t_emb).item()
score = reg.predict(np.array([[cosine_sim]]))[0]
return score