Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Split data into training and testing sets
ResourceFunction["TrainTestSplit"][data] splits data into a pair of shuffled training and testing sets. |
The default test size is 20%:
In[1]:= |
Out[1]= |
Specify a non-default test set size as a scaled value:
In[2]:= |
Out[2]= |
Specify a non-default test set size as an explicit value:
In[3]:= |
Out[3]= |
Specify a non-default training set size (a real value is taken as a Scaled):
In[4]:= |
Out[4]= |
By default, samples are shuffled:
In[5]:= |
Out[5]= |
Use "Shuffle"→False to ensure that a sample keeps its original ordering:
In[6]:= |
Out[6]= |
You must give sensible sizes:
In[7]:= |
Out[7]= |
The option "TrainSize" takes precedence over "TestSize":
In[8]:= |
Out[8]= |
This work is licensed under a Creative Commons Attribution 4.0 International License