GithubHelp home page GithubHelp logo

Comments (5)

colesbury avatar colesbury commented on May 29, 2024 3

Here's what I generally do:

local d = tnt.TableDataset{data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}
d = d:shuffle() -- before the iterator()

-- So the we can call 'iterator:exec('manualSeed', seed)'
function d:manualSeed(seed) torch.manualSeed(seed) end

local iterator = tnt.ParallelDatasetIterator{
    nthread = 3,
    init = function() require 'torchnet' end,
    closure = function()
        return d
    end,
    ordered = true
}

for sample in iterator() do
    print(sample)
end

iterator:exec('manualSeed', epochNumber)
iterator:exec('resample')

for sample in iterator() do
    print(sample)
end

The call to manualSeed is there so that each thread shuffles the data in the same way.

from torchnet.

lvdmaaten avatar lvdmaaten commented on May 29, 2024 1

I suppose we could add an optional seed to ResampleDataset (and ShuffleDataset)?

from torchnet.

Cadene avatar Cadene commented on May 29, 2024

That is a clever way. However it seems a bit tricky to me. Do you think there could be a way to integrate this functionality into torchnet?

from torchnet.

szagoruyko avatar szagoruyko commented on May 29, 2024

would be useful to have a dataset that reshuffles itself each :size() calls

from torchnet.

lvdmaaten avatar lvdmaaten commented on May 29, 2024

I think that's very tricky. Imagine coding up some ranking loss that does hard negative mining during training. In that case, the number of get() calls per epoch will likely be different from size().

from torchnet.

Related Issues (20)

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.