Skip to content

Commit

Permalink
added README for model usage
Browse files Browse the repository at this point in the history
  • Loading branch information
adithya8 committed Apr 25, 2021
1 parent 86a567e commit cfee05f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions models/README.md
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}


0 comments on commit cfee05f

Please sign in to comment.