70-774 · Question #63
You have the following HiveQL query in an Import Data module. Which type of operation is being performed?
The correct answer is D. stratified sampling. Random sampling is stratified with respect to a categorical variable when the samples obtained have categorical values that are present in the same ratio as they were in the parent population. Using the same example as above, suppose your data has the following observations by st
Question
You have the following HiveQL query in an Import Data module. Which type of operation is being performed?
Exhibit
Options
- Asampling a bucketized table
- Brandom sampling by groups
- Cuniform random sampling
- Dstratified sampling
How the community answered
(20 responses)- A15% (3)
- B5% (1)
- C5% (1)
- D75% (15)
Explanation
Random sampling is stratified with respect to a categorical variable when the samples obtained have categorical values that are present in the same ratio as they were in the parent population. Using the same example as above, suppose your data has the following observations by states: NJ has 100 observations, NY has 60 observations, and WA has 300 observations. If you specify the rate of stratified sampling to be 0.5, then the sample obtained should have approximately 50, 30, and 150 observations of NJ, NY, and WA respectively. Here is an example query: SET sampleRate=<sample rate, 0-1>; field1, field2, field3, ..., fieldN, state field1, field2, field3, ..., fieldN, state, count() over (partition by state) as state_cnt, rank() over (partition by state order by rand()) as state_rank from <table name> where state_rank <= state_cnt'${hiveconf:sampleRate}' https://docs.microsoft.com/en-us/azure/machine-learning/team-data-science-process/sample-
Topics
Community Discussion
No community discussion yet for this question.
