repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/first_steps/beyond_pipeline.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.745700 | """Beyond the pipeline."""
# Get a training dataset
from pykeen.datasets import get_dataset
dataset = get_dataset(dataset="nations")
training = dataset.training
validation = dataset.validation
testing = dataset.testing
# The following applies to most packaged datasets,
# although the dataset class itself makes `valid... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/checkpoints/ex_04.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.746961 | """Write a checkpoint whenever a metric improves (here, just the training loss)."""
from pykeen.checkpoints import MetricSelection
from pykeen.pipeline import pipeline
from pykeen.trackers import tracker_resolver
# create a default result tracker (or use a proper one)
result_tracker = tracker_resolver.make(None)
resu... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/checkpoints/ex_01.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.747759 | """Write a checkpoint every 10 steps and keep them all."""
from pykeen.pipeline import pipeline
result = pipeline(
dataset="nations",
model="mure",
training_kwargs={
"num_epochs": 100,
"callbacks": "checkpoint",
# create one checkpoint every 10 epochs
"callbacks_kwargs": {
... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/checkpoints/ex_03.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.750533 | """Write a checkpoint avery 5 epochs, but also at epoch 7."""
from pykeen.pipeline import pipeline
result = pipeline(
dataset="nations",
model="mure",
training_kwargs={
"num_epochs": 10,
"callbacks": "checkpoint",
"callbacks_kwargs": {
"schedule": "union",
#... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/conf.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.751675 | """Configuration file for the Sphinx documentation builder.
This file does only contain a selection of the most common options. For a full list see the documentation:
http://www.sphinx-doc.org/en/master/config
-- Path setup --------------------------------------------------------------
If extensions (or modules to d... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/checkpoints/ex_05.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.752551 | """Write a checkpoint every 10 steps, but keep only the last one and one every 50 steps."""
from pykeen.pipeline import pipeline
result = pipeline(
dataset="nations",
model="mure",
training_kwargs={
"num_epochs": 100,
"callbacks": "checkpoint",
# create one checkpoint every 10 epoc... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/first_steps/callbacks.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.753509 | """Using training callbacks."""
from pykeen.datasets import get_dataset
from pykeen.pipeline import pipeline
dataset = get_dataset(dataset="nations")
result = pipeline(
dataset=dataset,
model="mure",
training_kwargs={
"num_epochs": 100,
"callbacks": "evaluation",
"callbacks_kwargs"... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | benchmarking/benchmark_splitting.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.754716 | """Benchmark the speed for generating new datasets by remixing old ones."""
import itertools as itt
import logging
import time
from datetime import datetime
import click
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import torch
from humanize import intword
from tqdm import tqdm
from pyke... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/checkpoints/ex_02.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:38.774070 | """Write a checkpoint at epoch 1, 7, and 10 and keep them all."""
from pykeen.pipeline import pipeline
result = pipeline(
dataset="nations",
model="mure",
training_kwargs={
"num_epochs": 10,
"callbacks": "checkpoint",
# create checkpoints at epoch 1, 7, and 10
"callbacks_kw... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/models/conv_e.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.758620 | """Example of using ConvE outside of the pipeline."""
# Step 1: Get triples
from pykeen.datasets import get_dataset
dataset = get_dataset(dataset="nations", dataset_kwargs={"create_inverse_triples": True})
# Step 2: Configure the model
from pykeen.models import ConvE
model = ConvE(
triples_factory=dataset.train... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/first_steps/load_pretrained.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.759251 | """Load a trained PyKEEN model."""
import torch
my_pykeen_model = torch.load("trained_model.pkl")
|
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/pyg/typed.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.761439 | """Example for message passing with type information.
Here, we use a one-layer RGCN using the basis decomposition.
"""
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn.pyg import TypedMessagePassingRepresentation
from pykeen.pipeline import pipeline
embedding_dim = 64
dataset ... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/first_steps/using_learned_embeddings.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.762768 | """Using learned embeddings."""
# %%
from pykeen.models import ERModel
from pykeen.pipeline import pipeline
# train a model
result = pipeline(model="TransE", dataset="nations")
model = result.model
assert isinstance(model, ERModel)
# access entity and relation representations
entity_representation_modules = model.en... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/combination.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.765043 | """Demonstrate creating a model with a combine representation."""
import torch
from pykeen.models import ERModel
from pykeen.nn import CombinedRepresentation, ConcatProjectionCombination, Embedding
from pykeen.triples.generation import generate_triples_factory
from pykeen.typing import FloatTensor
n_entities = 15
n_... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/pyg/featurized.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.766264 | """Message passing using relation features."""
from pykeen.datasets import get_dataset
from pykeen.models.nbase import ERModel
from pykeen.nn.pyg import FeaturizedMessagePassingRepresentation
from pykeen.nn.representation import Embedding
from pykeen.pipeline import pipeline
embedding_dim = 64
dataset = get_dataset(d... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/backfill.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.767210 | """Example for backfill representations."""
from pykeen.datasets import get_dataset
from pykeen.nn import BackfillRepresentation, Embedding, init
from pykeen.pipeline import pipeline
# Here we simulate going from a smaller dataset to a larger one
# by starting with a large dataset and narrowing it down.
dataset_large... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/pyg/overall.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.768187 | """Example for using PyTorch Geometric.
Combine static label-based entity features with a trainable GCN encoder for entity representations, with learned
embeddings for relation representations and a DistMult interaction function.
"""
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykee... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/first_steps/evaluation_loop.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.769435 | """Preview: Evaluation Loop."""
from pykeen.datasets import Nations
from pykeen.evaluation import LCWAEvaluationLoop
from pykeen.models import TransE
from pykeen.training import SLCWATrainingLoop
# get a dataset
dataset = Nations()
# Pick a model
model = TransE(triples_factory=dataset.training)
# Pick a training appr... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/pyg/simple.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:39.770813 | """An example for using simple message passing, ignoring edge types.
We create a two-layer GCN on top of an Embedding.
"""
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn.pyg import SimpleMessagePassingRepresentation
from pykeen.pipeline import pipeline
embedding_dim = 64
dat... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/text_based.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:40.787679 | """Using text representations."""
import torch
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn import TextRepresentation
from pykeen.pipeline import pipeline
dataset = get_dataset(dataset="nations")
entity_representations = TextRepresentation.from_dataset(dataset=dataset, enc... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/low_rank_mixture.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:40.789265 | """Use the (generalized) low-rank approximation to create a mixture model representation."""
import pandas
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn import LowRankRepresentation
from pykeen.nn.text.cache import WikidataTextCache
from pykeen.pipeline import pipeline
from ... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/text_curie.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:40.796877 | """Example for using biomedical CURIEs with text representations.."""
import bioontologies
import numpy as np
from pykeen.datasets.base import Dataset
from pykeen.models import ERModel
from pykeen.nn import BiomedicalCURIERepresentation
from pykeen.pipeline import pipeline
from pykeen.triples.triples_factory import T... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/monte_carlo_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:40.799254 | """Monte-Carlo uncertainty estimation with embedding dropout."""
import torch
from pykeen.datasets import Nations
from pykeen.models import ERModel
from pykeen.typing import FloatTensor
dataset = Nations()
model: ERModel[FloatTensor, FloatTensor, FloatTensor] = ERModel(
triples_factory=dataset.training,
inte... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/text_wikidata.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:40.800584 | """Example for using WikidataTextRepresentation."""
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn import WikidataTextRepresentation
from pykeen.pipeline import pipeline
dataset = get_dataset(dataset="codexsmall")
entity_representations = WikidataTextRepresentation.from_datas... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/embedding_bag.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:41.394933 | """Embedding bag, with 2048-dimensional Morgan boolean fingerprints for molecules."""
import torch
from pykeen.models import ERModel
from pykeen.nn import Embedding, EmbeddingBagRepresentation
from pykeen.triples.generation import generate_triples_factory
from pykeen.typing import FloatTensor
n_entities = 15
n_relat... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/node_piece_diversity.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:41.900666 | """Estimating token diversity for NodePiece."""
from pykeen.datasets import CoDExSmall
from pykeen.models import NodePiece
dataset = CoDExSmall(create_inverse_triples=True)
model = NodePiece(
triples_factory=dataset.training,
tokenizers=["AnchorTokenizer", "RelationTokenizer"],
num_tokens=[20, 12],
em... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/partition.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:42.013539 | """The partition representation."""
import torch
from pykeen.nn import Embedding, PartitionRepresentation, init
from pykeen.pipeline import pipeline
from pykeen.triples.generation import generate_triples_factory
num_entities = 5
# create embedding from label encodings
labels = {1: "a first description", 4: "a secon... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/mlp_transformation.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:42.451639 | """Demonstrate applying a learnable MLP transformation on top of a representation."""
import torch
from pykeen.models import ERModel
from pykeen.nn import Embedding, MLPTransformedRepresentation
from pykeen.triples.generation import generate_triples_factory
from pykeen.typing import FloatTensor
n_entities = 15
n_rel... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/02_training.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:42.620459 | """Train the inductive model."""
from pykeen.datasets.inductive.ilp_teru import InductiveFB15k237
from pykeen.evaluation.rank_based_evaluator import SampledRankBasedEvaluator
from pykeen.training import SLCWATrainingLoop
dataset = InductiveFB15k237(version="v1", create_inverse_triples=True)
model = ... # model init... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/feature_enriched_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:42.768867 | """Demonstrate creating a model with a feature-enriched embedding."""
import torch
from pykeen.models import ERModel
from pykeen.nn import Embedding, FeatureEnrichedEmbedding
from pykeen.triples.generation import generate_triples_factory
from pykeen.typing import FloatTensor
n_entities = 15
n_relations = 3
n_triples... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/replace_triples_factory.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.015489 | """An example for exchanging the triples factory after training."""
import logging
from pykeen.datasets import get_dataset
from pykeen.models import InductiveNodePiece
from pykeen.pipeline import pipeline
from pykeen.predict import predict_triples
from pykeen.triples.generation import generate_triples_factory
loggin... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/training/loss_weights.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.177181 | """Training with relation-specific loss weights."""
from pykeen.datasets.utils import get_dataset
from pykeen.pipeline import pipeline
from pykeen.triples.weights import RelationLossWeighter
dataset = get_dataset(dataset="CodexSmall")
loss_weighter = RelationLossWeighter.inverse_relation_frequency(mapped_triples=data... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/01_model_gnn.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.261742 | """Setup an inductive node piece model with GNN encoder."""
from pykeen.datasets.inductive.ilp_teru import InductiveFB15k237
from pykeen.losses import NSSALoss
from pykeen.models.inductive import InductiveNodePieceGNN
dataset = InductiveFB15k237(version="v1", create_inverse_triples=True)
model = InductiveNodePieceGN... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/visual_wikidata.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.263217 | """Example of using visual representations from Wikidata."""
from pykeen.datasets import get_dataset
from pykeen.models import ERModel
from pykeen.nn import WikidataVisualRepresentation
from pykeen.pipeline import pipeline
dataset = get_dataset(dataset="codexsmall")
entity_representations = WikidataVisualRepresentati... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/semi_inductive_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.290446 | """Creating a semi-inductive dataset."""
import logging
from pykeen.datasets import get_dataset
from pykeen.datasets.base import EagerDataset
logging.basicConfig(level=logging.INFO)
# we use all of CodexSmall's data as source graph
dataset = get_dataset(dataset="CodexSmall")
dataset.summarize()
tf_all = dataset.mer... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | notebooks/validation_loss/validation_loss.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.319849 | # %%
"""Validation loss notebook."""
import pandas
import seaborn
from pykeen.datasets import get_dataset
from pykeen.pipeline import pipeline
from pykeen.trackers import PythonResultTracker
# %% [markdown]
# ## Training a model with PyKEEN
# %%
dataset = get_dataset(dataset="nations")
result_tracker = PythonResult... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/nn/representation/transformed.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.372307 | """Using transformed representations."""
from torch import nn
from pykeen.datasets import get_dataset
from pykeen.nn import TransformedRepresentation, init
dataset = get_dataset(dataset="nations")
# Create random walk features
# We used dim+1 for the RWPE initializion as by default it doesn't return the first dimen... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/01_model.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.373311 | """Setup an inductive node piece model."""
from pykeen.datasets.inductive.ilp_teru import InductiveFB15k237
from pykeen.losses import NSSALoss
from pykeen.models.inductive import InductiveNodePiece
dataset = InductiveFB15k237(version="v1", create_inverse_triples=True)
model = InductiveNodePiece(
triples_factory=... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/03_full.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.484250 | """Full example for inductive link prediction."""
from torch.optim import Adam
from pykeen.datasets.inductive.ilp_teru import InductiveFB15k237
from pykeen.evaluation.rank_based_evaluator import SampledRankBasedEvaluator
from pykeen.losses import NSSALoss
from pykeen.models.inductive import InductiveNodePieceGNN
from... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.566761 | """PyKEEN is a Python package for reproducible, facile knowledge graph embeddings.
The fastest way to get up and running is to use the :func:`pykeen.pipeline.pipeline`
function.
It provides a high-level entry into the extensible functionality of
this package. The following example shows how to train and evaluate the
... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.722099 | """Entrypoint module, in case you use ``python -m pykeen``.
Why does this file exist, and why ``__main__``? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
from .cli import main
if __name__ == "__main__":
main()
|
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/ablation/ablation.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.834719 | """Utilities for ablation study configurations."""
from __future__ import annotations
import itertools as itt
import json
import logging
import pathlib
import time
from collections.abc import Iterable, Mapping, Sequence
from typing import Any, TypedDict
from uuid import uuid4
from ..training import SLCWATrainingLoop... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/ablation/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.839397 | """Ablation studies in PyKEEN."""
from .ablation import (
ablation_pipeline,
ablation_pipeline_from_config,
prepare_ablation,
prepare_ablation_from_config,
prepare_ablation_from_path,
)
__all__ = [
"ablation_pipeline",
"ablation_pipeline_from_config",
"prepare_ablation_from_config",
... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/checkpoints/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.847595 | """This module contains methods for deciding when to write and clear checkpoints.
.. warning::
While this module provides a flexible and modular way to describe a desired checkpoint behavior, it currently only
stores the model's weights (more precisely, its :meth:`torch.nn.Module.state_dict`). Thus, it does n... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/checkpoints/base.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.918078 | """Methods for reading and writing checkpoints."""
from __future__ import annotations
import pathlib
from typing import Any, BinaryIO, TypedDict
import torch
from ..models.base import Model
__all__ = [
"save_model",
"load_state_torch",
]
class ModelState(TypedDict):
"""A model state."""
state_di... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/checkpoints/keeper.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.950793 | """Checkpoint cleanup methods.
The cleanup methods determine, for any given set of existing checkpoints, which of them can be pruned. We provide a set
of basic rules that can be easily combined into more complex logic.
"""
import abc
import dataclasses
from collections.abc import Collection, Iterator, Sequence
from ... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/checkpoints/inspection.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:43.951463 | """Tools for investigating schedules outside of a training session."""
from class_resolver import HintOrType, OptionalKwargs
from .keeper import CheckpointKeeper, keeper_resolver
from .schedule import CheckpointSchedule, schedule_resolver
def simulate_checkpoints(
num_epochs: int = 100,
schedule: HintOrType... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | src/pykeen/checkpoints/schedule.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:44.065029 | """Scheduling when to make checkpoints."""
from __future__ import annotations
import abc
import dataclasses
from collections.abc import Collection, Sequence
from class_resolver import ClassResolver, OneOrManyHintOrType, OneOrManyOptionalKwargs
from .utils import MetricSelection, ResultListenerAdapter
from ..tracker... |
pykeen/pykeen | https://github.com/pykeen/pykeen | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | docs/source/examples/tutorial/inductive_lp/fully_inductive_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:47.845789 | """Creating a fully inductive dataset."""
import logging
from pykeen.datasets import get_dataset
from pykeen.datasets.inductive.base import EagerInductiveDataset
logging.basicConfig(level=logging.INFO)
# we use all of CodexSmall's data as source graph
dataset = get_dataset(dataset="CodexSmall")
dataset.summarize()
... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_dssm_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:49.991061 | """
Created on Apr 1, 2022
train DSSM demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import DSSM
from reclearn.data.datasets import movielens as ml
from reclearn.evaluator import eval... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_ncf_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:49.993241 | """
Created on Nov 19, 2021
Updated on Apr 23, 2022
train NCF demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import NCF
from reclearn.data.datasets import movielens as ml
from reclear... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_poprec_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:49.994231 | """
Created on Nov 20, 2021
train PopRec demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import PopRec
from reclearn.data.datasets import movielens as ml
from reclearn.evaluator import eval_pos_neg
os.environ['T... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_gru4rec_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:49.995091 | """
Created on Nov 20, 2021
Updated on Apr 23, 2022
train GRU4Rec demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import GRU4Rec
from reclearn.data.datasets import movielens as ml
from... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_mind_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:49.997102 | """
Created on Apr 26, 2022
train MIND demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import MIND
from reclearn.data.datasets import movielens as ml
from reclearn.evaluator import eva... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_caser_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:49.999131 | """
Created on Nov 20, 2021
Updated on Apr 23, 2022
train Caser demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import Caser
from reclearn.data.datasets import movielens as ml
from rec... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_fissa_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.000247 | """
Created on Nov 21, 2021
Updated on Apr 23, 2022
train FISSA demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import FISSA
from reclearn.data.datasets import movielens as ml
from rec... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_sasrec_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.001604 | """
Created on Nov 20, 2021
Updated on Apr 23, 2022
train SASRec demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import SASRec
from reclearn.data.datasets import movielens as ml
from r... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_bpr_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.006719 | """
Created on Nov 19, 2021
train BPR demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import BPR
from reclearn.data.datasets import movielens as ml
from reclearn.evaluator import eval_... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_attrec_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.019345 | """
Created on Nov 20, 2021
Updated on Apr 23, 2022
train AttRec demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import AttRec
from reclearn.data.datasets import movielens as ml
from r... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_deep_crossing_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.632005 | """
Created on Nov 14, 2021
train Deep Crossing demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import Deep_Crossing
from re... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_dcn_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.635594 | """
Created on Nov 14, 2021
train DCN demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import DCN
from reclearn.data.datasets... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/m_youtubednn_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.636679 | """
Created on Apr 5, 2022
train YoutubeDNN demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
from absl import flags, app
from time import time
from tensorflow.keras.optimizers import Adam
from reclearn.models.matching import YoutubeDNN
from reclearn.data.datasets import movielens as ml
from reclearn.evaluator... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_wdl_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.643331 | """
Created on Nov 14, 2021
train WideDeep demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import WideDeep
from reclearn.dat... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_afm_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.643921 | """
Created on Nov 14, 2021
train AFM demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import AFM
from reclearn.data.datasets... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_pnn_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.654332 | """
Created on Nov 14, 2021
train PNN demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import PNN
from reclearn.data.datasets... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_deepfm_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.655275 | """
Created on Nov 14, 2021
train DeepFM demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import DeepFM
from reclearn.data.da... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_nfm_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.661354 | """
Created on Nov 14, 2021
train NFM demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import NFM
from reclearn.data.datasets... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_xdeepfm_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.661882 | """
Created on Nov 14, 2021
train xDeepFM demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import xDeepFM
from reclearn.data.... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/r_fm_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:50.697584 | """
Created on Aug 25, 2020
Updated on Mar 11, 2022
train FM demo
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import AUC
from reclearn.models.ranking import FM
from ... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/datasets/beauty.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.257072 | """
Created on Nov 23, 2021
Amazon Beauty Dataset.
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
import random
import numpy as np
import pandas as pd
import tensorflow as tf
from tqdm import tqdm
from collections import defaultdict
from tqdm import tqdm
# general recommendation
def split_data(file_path):
... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | example/train_small_criteo_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.276304 | """
Created on Nov 14, 2021
using small criteo dataset to train the model.
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras.losses import binary_crossentropy
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.me... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/datasets/criteo.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.357310 | """
Created on July 13, 2020
Updated on Nov 14, 2021
dataset:criteo
features:
- Label - Target variable that indicates if an ad was clicked (1) or not (0).
- I1-I13 - A total of 13 columns of integer features (mostly count features).
- C1-C26 - A total of 26 columns of categorical features.
The values of these features... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/datasets/games.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.361388 | """
Created on Nov 23, 2021
Amazon Games Dataset.
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
import random
import numpy as np
import pandas as pd
import tensorflow as tf
from tqdm import tqdm
from collections import defaultdict
# general recommendation
def split_data(file_path):
"""split amazon games fo... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/datasets/movielens.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.362403 | import os
import random
import time
import numpy as np
import pandas as pd
import tensorflow as tf
from tqdm import tqdm
from collections import defaultdict
from tensorflow.keras.preprocessing.sequence import pad_sequences
MAX_ITEM_NUM = 3953
MAX_USER_NUM = 6041
# general recommendation
def split_data(file_path):
... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/datasets/steam.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.365520 | """
Created on Nov 24, 2021
STEAM Dataset.
statistics of processed data:
user: 334732
item: 15474
interaction: 4216807
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
import random
import re
import pandas as pd
import numpy as np
from tqdm import tqdm
# general recommendation
def split_data(file_path... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/feature_column.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:51.366436 | """
Created on May 18, 2021
input feature columns: sparseFeature, denseFeature
@author: Ziyao Geng(zggzy1996@163.com)
"""
def sparseFeature(feat_name, feat_num, embed_dim=4):
"""Create dictionary for sparse feature.
Args:
:param feat_name: A string. feature name.
:param feat_num: A scalar(int)... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/evaluator/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.215398 | """
Created on Nov 14, 2021
@author: Ziyao Geng(zggzy1996@163.com)
"""
import numpy as np
def hr(rank, k):
"""Hit Rate.
Args:
:param rank: A list.
:param k: A scalar(int).
:return: hit rate.
"""
res = 0.0
for r in rank:
if r < k:
res += 1
return res / le... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/losses.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.217610 | """
Created on Nov 14, 2021
Loss function.
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
def get_loss(pos_scores, neg_scores, loss_name, gamma=None):
"""Get loss scores.
Args:
:param pos_scores: A tensor with shape of [batch_size, 1].
:param neg_scores: A tensor with shape... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/data/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.218629 | """
Created on July 13, 2020
Updated on May 18, 2021
Some functions.
@author: Ziyao Geng(zggzy1996@163.com)
"""
import os
import time
import numpy as np
def mkSubFile(lines, head, srcName, sub_dir_name, sub):
"""Write sub-data.
Args:
:param lines: A list. Several pieces of data.
:param head: A... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/layers/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.219852 | import tensorflow as tf
def scaled_dot_product_attention(q, k, v, mask):
"""Attention Mechanism Function.
Args:
:param q: A 3d/4d tensor with shape of (None, ..., seq_len, dim)
:param k: A 3d/4d tensor with shape of (None, ..., seq_len, dim)
:param v: A 3d/4d tensor with shape of (None... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.340656 |
from reclearn.models.matching.poprec import PopRec
from reclearn.models.matching.bpr import BPR
from reclearn.models.matching.ncf import NCF
from reclearn.models.matching.dssm import DSSM
from reclearn.models.matching.youtubednn import YoutubeDNN
from reclearn.models.matching.gru4rec import GRU4Rec
from reclearn.model... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/layers/core.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.378204 | """
Created on Nov 07, 2021
core layers
@author: Ziyao Geng(zggzy1996@163.com)
"""
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Layer, Dense, Dropout, BatchNormalization, LayerNormalization, Conv1D, ReLU
from tensorflow.keras.regularizers import l2
from reclearn.layers.utils import sc... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/evaluator/evaluator.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.388068 | """
Created on Nov 14, 2021
Evaluate Functions.
@author: Ziyao Geng(zggzy1996@163.com)
"""
from reclearn.evaluator.metrics import *
def eval_pos_neg(model, test_data, metric_names, k=10, batch_size=None):
"""Evaluate the performance of Top-k recommendation algorithm.
Note: Test data must contain some negative... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/layers/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.457485 | """
This library provides a set of high-level neural networks layers.
"""
from reclearn.layers.core import Linear
from reclearn.layers.core import MLP
from reclearn.layers.core import TransformerEncoder
from reclearn.layers.core import SelfAttention
from reclearn.layers.core import FM_Layer
from reclearn.layers.core i... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/attrec.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.662072 | """
Created on Nov 10, 2020
Updated on Apr 23, 2022
Reference: "Next Item Recommendation with Self-Attentive Metric Learning", AAAI, 2019
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Embedding, Input
from tensorflow.keras.regul... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/fissa.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.835515 | """
Created on Nov 20, 2021
Updated on Apr 23, 2022
Reference: "FISSA: fusing item similarity models with self-attention networks for sequential recommendation",
RecSys, 2020
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers i... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/caser.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.864732 | """
Created on Nov 18, 2020
Updated on Apr 23, 2022
Reference: "Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding", WSDM, 2018
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Embedding, Input, Conv1... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/bpr.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.865905 | """
Created on Nov 13, 2020
Updated on Apr 9, 2022
Reference: "BPR: Bayesian Personalized Ranking from Implicit Feedback", UAI, 2009
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Embedding, Input
from tensorflow.keras.regularize... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/dssm.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.898352 | """
Created on Mar 31, 2022
Reference: "Learning Deep Structured Semantic Models for Web Search using Clickthrough Data", CIKM, 2013
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Embedding, Input
from tensorflow.keras.regularize... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/gru4rec.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.898856 | """
Created on Nov 20, 2021
Updated on Apr 23, 2022
Reference: "Session-based Recommendation with Recurrent Neural Networks", ICLR, 2016
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense, Dropout, Embedding, Input, GRU
from te... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/mind.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.913629 | """
Created on Apr 25, 2022
Reference: "Multi-Interest Network with Dynamic Routing for Recommendation at Tmall", CIKM, 2019
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Input
from tensorflow.keras.regularizers import l2
from ... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/ncf.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:52.971001 | """
Created on Dec 20, 2020
Updated on Apr 23, 2022
Reference: "Neural Collaborative Filtering", WWW, 2017
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Embedding, Dense, Input
from tensorflow.keras.regularizers import l2
from ... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/poprec.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:53.011325 | """
Created on Nov 20, 2021
Model: Pop Recommendation
@author: Ziyao Geng(zggzy1996@163.com)
"""
import numpy as np
import pandas as pd
from tqdm import tqdm
from reclearn.evaluator.metrics import *
class PopRec:
def __init__(self, train_path, delimiter='\t'):
"""Pop recommendation
Args:
... |
ZiyaoGeng/RecLearn | https://github.com/ZiyaoGeng/RecLearn | null | null | null | null | 1,986 | null | null | mit | null | null | null | null | null | null | null | reclearn/models/matching/sasrec.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:53.067648 | """
Created on Dec 20, 2020
Updated on Apr 22, 2022
Reference: "Self-Attentive Sequential Recommendation", ICDM, 2018
@author: Ziyao Geng(zggzy1996@163.com)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer, Dense, LayerNormalization, Dropout, Embedding, Input
from... |
haitongli/knowledge-distillation-pytorch | https://github.com/haitongli/knowledge-distillation-pytorch | null | null | null | null | 1,985 | null | null | mit | null | null | null | null | null | null | null | mnist/distill_mnist.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:56.058200 | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import os
import time
start_time = time.time()
# Training settings
parser = argparse.Argu... |
haitongli/knowledge-distillation-pytorch | https://github.com/haitongli/knowledge-distillation-pytorch | null | null | null | null | 1,985 | null | null | mit | null | null | null | null | null | null | null | model/data_loader.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:56.062661 | """
CIFAR-10 data normalization reference:
https://github.com/Armour/pytorch-nn-practice/blob/master/utils/meanstd.py
"""
import random
import os
import numpy as np
from PIL import Image
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data.sampler import SubsetRandomS... |
haitongli/knowledge-distillation-pytorch | https://github.com/haitongli/knowledge-distillation-pytorch | null | null | null | null | 1,985 | null | null | mit | null | null | null | null | null | null | null | model/densenet.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:56.063203 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
# __all__ = ['densenet']
class Bottleneck(nn.Module):
def __init__(self, inplanes, expansion=4, growthRate=12, dropRate=0):
super(Bottleneck, self).__init__()
plan... |
haitongli/knowledge-distillation-pytorch | https://github.com/haitongli/knowledge-distillation-pytorch | null | null | null | null | 1,985 | null | null | mit | null | null | null | null | null | null | null | mnist/distill_mnist_unlabeled.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:56.065777 | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import os
import time
start_time = time.time()
# Training settings
parser = argparse.Argu... |
haitongli/knowledge-distillation-pytorch | https://github.com/haitongli/knowledge-distillation-pytorch | null | null | null | null | 1,985 | null | null | mit | null | null | null | null | null | null | null | count_model_size.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:56.066268 | '''Count # of parameters in a trained model'''
import argparse
import os
import numpy as np
import torch
import utils
import model.net as net
import model.resnet as resnet
import model.wrn as wrn
import model.resnext as resnext
import utils
parser = argparse.ArgumentParser()
# parser.add_argument('--data_dir', defau... |
haitongli/knowledge-distillation-pytorch | https://github.com/haitongli/knowledge-distillation-pytorch | null | null | null | null | 1,985 | null | null | mit | null | null | null | null | null | null | null | distillation_analysis.py | null | null | null | null | null | null | Python | 2026-05-04T01:41:56.067924 | """Analyzes, visualizes knowledge distillation"""
import argparse
import logging
import os
import numpy as np
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import utils
import model.net as net
import model.resnet as resnet
import model.data_loader as data_loader
from torchnet.meter i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.