Giter Site home page Giter Site logo

deep_recommenders's People

Contributors

grogusball avatar sharpcx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep_recommenders's Issues

google_tt模型中batch_softmax疑问

def corrected_batch_softmax(x, y, sampling_p=None):
    """logQ correction softmax"""
    correct_inner_product = log_q(x, y, sampling_p=sampling_p)
    return tf.math.exp(correct_inner_product) / tf.math.reduce_sum(tf.math.exp(correct_inner_product))

这里softmax计算的是不是有些问题呢?
原论文:
image
中分母是x_i与batch内不同y_j点乘的和, 而代码中分母是batch内x_i与y_i点乘的和

Fix bug from `transformer.ipynb` in `/experiments`

Hi, thank you so much for open sourcing your project, it helps me a lot!!
Here I just have one simple bug to report:


Source: 3rd code cell from notebook

  • Original:
outputs = Transformer(
    vocab_size, 
    model_dim, 
    n_heads=2, 
    encoder_stack=2,
    decoder_stack=2, 
    feed_forward_size=50
)([encoder_inputs, decoder_inputs])

After ran the notebook and traced your code (deep_recommenders/keras/models/nlp/Transformer.py),
the input of Transformer class object needs 2 parameters (encoder_inputs, decoder_inputs), it should not be a list.

  • Revised:
outputs = Transformer(
    vocab_size, 
    model_dim, 
    n_heads=2, 
    encoder_stack=2,
    decoder_stack=2, 
    feed_forward_size=50
)(encoder_inputs, decoder_inputs)

DeepRecommend.src.transformer.train中的load_data的到的decoder_targets是全零arrays

源码:

 decoder_targets = np.zeros((len(answers_seqs), max_len, vocab_size), dtype='float32')
    for i, seq in enumerate(answers_seqs):
        for j, index in enumerate(seq):
            if j > 0: decoder_targets[i, j-1, index-1] = 1
            if index == 0: break

似乎是出问题在break处,因为padding为0,pad_sequences默认是 pre pad,所以遇见0 就break,导致decoder_targets未能成功赋值

这段挖掘hard 负样本的方法不太懂,还请大佬赐教

class HardNegativeMining(tf.keras.layers.Layer):
"""Hard Negative"""

def __init__(self, num_hard_negatives: int, **kwargs):
    super(HardNegativeMining, self).__init__(**kwargs)

    self._num_hard_negatives = num_hard_negatives

def call(self, logits: tf.Tensor, labels: tf.Tensor) -> Tuple[tf.Tensor, tf.Tensor]:
    num_sampled = tf.minimum(self._num_hard_negatives + 1, tf.shape(logits)[1])

    _, indices = tf.nn.top_k(logits + labels * MAX_FLOAT, k=num_sampled, sorted=False)

    logits = _gather_elements_along_row(logits, indices)
    labels = _gather_elements_along_row(labels, indices)

    return logits, labels

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.