Time2vec
This repository accompanies the paper "Learning Concept Embeddings from Temporal Data" (Meyer, Van Der Merwe, and Coetsee, 2018)
Install / Use
/learn @francois-meyer/Time2vecREADME
Time2Vec
Time2Vec learns embeddings for concepts based on the occurrences of the concepts in a temporal data set. This is done by extending Word2Vec's Skip-gram architecture to take the time interval between events into account.
The model used to learn the embeddings can be specified by various parameters that relate to the way that the time at which events occur in the data set influence the way that the model learns the embeddings.
Dependencies (Python)
- Numpy
- Pandas
- TensorFlow
- Scikit-Learn
Source Data
The data set from which the embeddings are learned must consist of a sequence events of corresponding to occurrences of the concepts. The events must be in the format [id, datetime, concept]:
- id refers to an identifier with which each event is associated (this is used to group related events together)
- datetime specifies the date and time at which the event occurred
- concept specifies the concept that occurred
Example Usage
medical_data_file = '../example_data/medical.csv'
medical_training_file = '../example_data/medical_training_data.csv'
# Initialise the model
model = Time2Vec(data_file_name=medical_data_file,
min_count=1,
subsampling=0,
train_file_name=medical_training_file,
decay=1,
unit=2,
const=1.,
rate=0.3,
limit=5,
chunk_size=1000,
processes=4,
dimen=100,
num_samples=5,
optimizer=2,
lr=1.0,
min_lr=0.1,
batch_size=16,
epochs=1000,
valid=0,
seed=1)
# Training process
model.build_vocab()
model.gen_train_data()
model.learn_embeddings()
# Explore embeddings
closest = model.most_similar('disease1', 4)
print(closest)
Related Skills
proje
Interactive vocabulary learning platform with smart flashcards and spaced repetition for effective language acquisition.
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
400Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
