-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## **Model usage** | ||
|
||
--- | ||
|
||
### **Using pickle files through python** | ||
|
||
These pickle files are composed of a sckit learn decomposition class. Hence, to apply the learnt reduction, you can unpickle the model and run transform() method on the user embeddings. | ||
Here is an example showing how: | ||
|
||
import pickle | ||
with open("model.pickle", "rb") as f: | ||
model = pickle.load(f)["clusterModels"]["noOutcome"] | ||
#user embeddings are stored in a variable calles user_emb | ||
user_emb = model.transform(user_emb) | ||
|
||
### **Using pickle files through DLATK** | ||
|
||
If the user embeddings have been generated using [DLATK](github.com/DLATK/DLATK/) by following the commands [here](https://github.com/adithya8/ContextualEmbeddingDR#commands-to-extract-dimension-reduced-tables-using-a-specific-method), then you can use these pickle files directly by using the following command: | ||
|
||
python dlatkInterface.py -d {database-name} -t {table-name} -g {group-name} -f {user-embeddings-table-name} --transform_to_feats {dimred-table-name} --load --pickle {path-to-pickle-file} | ||
|
||
|