Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Map a function to pairs formed from a list and another function
ResourceFunction["PairMap"][f,args] creates a data structure whose head is the same as the head of args and each element of which is a list with the first element in args, and the second element has function f applied to that first element. | |
ResourceFunction["PairMap"][f,args,g] applies g to each element in the result. | |
ResourceFunction["PairMap"][f,args,g,h] wraps h around the overall result. | |
ResourceFunction["PairMap"][f] is an operator form of ResourceFunction["PairMap"] that can be applied to arguments. |
Create a list of lists with elements of the form {x,f[x]}:
In[1]:= |
Out[1]= |
Create a list of rules of the form x→f[x]:
In[2]:= |
Out[2]= |
Apply an operator form of PairMap to some data:
In[3]:= |
Out[3]= |
The head of the result returned by PairMap is the same as the head of args:
In[4]:= |
Out[4]= |
A four-argument form of PairMap in which the function h is composed with the result:
In[5]:= |
Out[5]= |
Use PairMap to create a Dataset in which the keys are integers and the columns are the squares and cubes of those integers:
In[6]:= |
Out[6]= |
Get data in a form suitable for statistical functions such as LinearModelFit:
In[7]:= |
In[8]:= |
Out[8]= |
Get data in a form suitable for machine learning functions such as Predict, Classify or NetTrain:
In[9]:= |
Out[9]= |
Take a complex model and build local emulators around a point {0.4,0.7} using LASSO with varying degrees of regularization in a process that approximates the LIME algorithm for explaining complex machine learning models:
In[11]:= |
Out[11]= |
This work is licensed under a Creative Commons Attribution 4.0 International License