You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DecisionForestTrainer.lua 816B

12345678910111213141516171819202122
  1. local dt = require "decisiontree._env"
  2. -- Interface for all decisionForestTrainers
  3. local DFT = torch.class("dt.DecisionForestTrainer", dt)
  4. -- Train a DecisionForest with examples, a table of valid featureIds and a dataset (i.e. sortedExamplesByFeatureId)
  5. function DFT:train(examples, validFeatureIds, dataset)
  6. assert(torch.type(examples) == "table")
  7. assert(torch.isTypeOf(examples[1], "dt.LabeledExample"))
  8. assert(torch.type(validFeatureIds) == 'table')
  9. assert(torch.type(dataset) == 'table')
  10. for k,v in pairs(dataset) do
  11. assert(torch.type(v) == 'table')
  12. assert(torch.isTypeOf(v[1], 'dt.LabeledExample'))
  13. break
  14. end
  15. -- dataset is a table mapping featureIds to sorted lists of LabeledExamples
  16. -- e.g. {featureId={example1,example2,example3}}
  17. error"Not Implemented"
  18. end