Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions examples/Large_Language_Models/llm_gsmile_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def query_gpt_for_perturbations(
# Word2Vec model
# --------------------------------------------------------------------------- #

# TODO: anything you want to do
# Improving and using better Word2Vec Models and also giving user an option to have preference on this
# TODO: Improving and using better Word2Vec Models and also giving user an option
# to have preference on this

def load_google_news_vectors():
# First try gensim downloader (fastest & simplest)
Expand Down Expand Up @@ -339,11 +339,11 @@ def clean_text(text: str) -> str:
cleaned = re.sub(r"[^\w\s]", "", text.lower())
return cleaned.strip()

# TODO: anything you want to do
# Removing the word "safe" from the function
# TODO: Removing the word "safe" from the function
# Adding More statistical distances here
# As Statistical distance measures are the code for SMILE, we can consider a separate class for them.


def safe_wmdistance(model, text1: str, text2: str) -> float:
"""Compute Word Mover's Distance using only in-vocabulary cleaned words.

Expand Down Expand Up @@ -418,8 +418,7 @@ def normalize_similarities(wmd_scores: list) -> list:
# Regression
# --------------------------------------------------------------------------- #

# TODO: anything you want to do
# This part can be extended to cover other types of LIME, like BayLIME
# TODO: This part can be extended to cover other types of LIME, like BayLIME

def fit_weighted_regression(
perturbations: list,
Expand Down
Loading
Loading