in reply to Most efficient record selection method?
Do you want your "sample" to have mock records that show all field variants, or do you want to sample real records?
If you're mocking records, read your data files and for each field track each variant. A hash of hashes would work well for this. See perldsc if you're not familiar with the HoH. Then you pick the field with the most variants, and that's how many records you have to have. Loop over them all, generating a record for each. The record generator will look at every other field and pick a variant that hasn't been shown yet or a random one if they've all been shown.
If you're sampling real records, it's more complicated. You still need to have a record of every variant for every field, but for each of those you need a list of the records that provide an example. I would start with records that appear least frequently in the data structure. That is, pick a record that gives an example of a variant that doesn't appear very often. It will also have examples of more common field variants. Upon picking that record, "mark off" the variants that you've exemplified already. Keep picking records that show the least common remaining variant until you've exemplified them all.
In case it's not obvious, I think the important part of this problem is the data structures you use to store your input data. You want something that will lead you naturally to the records you want.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Most efficient record selection method?
by Kraythorne (Sexton) on Feb 12, 2009 at 22:06 UTC | |
|
Re^2: Most efficient record selection method?
by Kraythorne (Sexton) on Feb 21, 2009 at 22:21 UTC | |
|
Re^2: Most efficient record selection method?
by Kraythorne (Sexton) on Feb 12, 2009 at 16:24 UTC | |
by kyle (Abbot) on Feb 12, 2009 at 16:59 UTC |