1/5
Set a macro value.
What if you wanted to send someone a smaller sample of your dataset, e.g. 50% of the original dataset? You can use macros to calculate a new example set size for any dataset; then sample the data down to this new size. Macros are like variables. You can use them to dynamically store and load values in your process.
|
ACTIVITY |
|
|
|
|
|
|
EXPLANATION |
|
|
|
|
Step 3 shows how macros are like variables – you define their name, and value. This particular macro is a constant, 0.5.
|
2/5
Extract a macro value from the dataset.
|
ACTIVITY |
|
|
|
|
|
|
EXPLANATION |
|
|
|
|
Unlike Set Macro which defines a macro from scratch, Extract Macro defines a macro from the existing dataset.
|
3/5
Calculate a new macro from other macros.
|
ACTIVITY |
|
|
|
|
|
|
EXPLANATION |
|
|
|
|
The formula in Step 2 essentially says “round up the value of macro size multiplied by the value of macro fraction”.
When using macros in formulas, you have to use them in the %{macro} format, for instance %{fraction}.
|
4/5
Sample the dataset to a smaller size.
|
EXPLANATION |
|
|
|
|
In step 2 above the Sample operator uses the macro new size to determine the size of the sample it should produce. By definition new size is equal to the rounded up product of size and fraction. Going back to page 2, size is derived from the number of examples, which is for our dataset 2326 examples. Going back to page 1, we set fraction at 0.5. So in conclusion, new size = round (2326*0.5) = 1163. This is exactly the number of examples in our Results view.
|
5/5
Practice sampling more.
Congratulations! You have successfully produced a smaller random sample of your dataset.
|
CHALLENGE |
|
|
|
|
|
Next Page: Previous Page: