Coder Social home page Coder Social logo

ovyan / time2vec Goto Github PK

View Code? Open in Web Editor NEW

This project forked from francois-meyer/time2vec

0.0 0.0 0.0 37 KB

This repository accompanies the paper "Learning Concept Embeddings from Temporal Data" (Meyer, Van Der Merwe, and Coetsee, 2018)

Home Page: http://www.jucs.org/jucs_24_10/learning_concept_embeddings_from/jucs_24_10_1378_1402_meyer.pdf

Python 100.00%

time2vec's Introduction

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)

time2vec's People

Contributors

ovyan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.