Last active
January 15, 2022 20:13
-
-
Save varrek/028cb1edf55fd36b2795ce7b79b19d25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow_hub as hub | |
| import tensorflow_text | |
| embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder-multilingual/3") | |
| df_test = pd.read_csv(os.path.join(INPUT_DIR, "test.csv"), header=0) | |
| categories = df_test.targetcat.unique() | |
| df = pd.DataFrame({'cat_name':categories}) | |
| df['cat_embeding'] = embed(df['cat_name']) | |
| df['cat_embeding'] = df['cat_embeding'].apply(lambda x: np.asarray(x)) | |
| df_test['embed'] = embed(df_test['description']) | |
| df_test['embed'] = df_test['embed'].apply(lambda x: np.asarray(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment