Skip to content

Instantly share code, notes, and snippets.

Working on TensorFlow Ranking

Alex Egg eggie5

Working on TensorFlow Ranking
Block or report user

Report or block eggie5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
from tensorflow.python.eager import context
def cyclic_learning_rate(global_step,
"""Checks if a set of TFRecords appear to be valid.
Specifically, this checks whether the provided record sizes are consistent and
that the file does not end in the middle of a record. It does not verify the
import struct
from multiprocessing import Pool
import tensorflow as tf

The saved model CLI can't handle string input w/ the input_examples flag RE: :

saved_model_cli run \
--dir . \
--tag_set serve \
--signature_def predict \
--input_examples 'examples=[{"menu_item":["this is a sentence"]}]'
import org.tensorflow.Graph;
import org.tensorflow.Session;
import org.tensorflow.Tensor;
import org.tensorflow.Tensors;
import org.tensorflow.TensorFlow;
import org.tensorflow.SavedModelBundle;
import org.tensorflow.SavedModelBundle.Loader;
import org.tensorflow.framework.SignatureDef;
import org.tensorflow.framework.MetaGraphDef;
import org.tensorflow.framework.TensorInfo;

Learning to Rank

A common method to rank a set of items is to pass all items through a scoring function and then sorting the scores to get an overall rank. Traditionally this space has been domianted by ordinal regression techniques on point-wise data. However, there are serious advantages to exploit by learning a scoring function on pair-wise data instead. This technique commonly called RankNet was originally explored by the seminal Learning to Rank by Gradient Descent[^1] paper by Microsoft.

In this talk we will discuss:

  • Theory behind point-wise and pair-wise data

  • Ordinal Regression: ranking point-wise data

  • how to crowd-source pair-wise data

import numpy as np
from sklearn.base import BaseEstimator
from keras.layers import Input, Embedding, Dense,Flatten ,Activation, Add, Dot
from keras.models import Model
from keras.regularizers import l2 as l2_reg
from keras import initializers
import itertools
def build_model(max_features,K=8,solver='adam',l2=0.0,l2_fm = 0.0):
View IRI-case-study.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View findphone.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
eggie5 /
Created Dec 11, 2017 — forked from omoindrot/
Example TensorFlow script for fine-tuning a VGG model (uses
Example TensorFlow script for finetuning a VGG model on your own data.
Uses module which is in release v1.2
Based on PyTorch example from Justin Johnson
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
### We will try to seralize and desearlaize a graph that is using the new `get_single_element` function of the Dataset API
### You will see that it does not desearlize gracefully.
#### Part 1: Build arbitrary graph using Dataset API and new get_single_element function
import numpy as np
import tensorflow as tf
from import Dataset, Iterator
You can’t perform that action at this time.