Convert List of Associations into Association of Lists

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
For neuralnetworks mathematica likes 2 ways to structure trainingsets:
listFormatData = "Input" -> input2, "OutputKey1" -> OutputKey1Input2Output, ...
and
assocFormatData = <|
"Input" -> input1, input2, ...,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output, ...
, ...
|>
Is the a stock way to convert these 2 formats properly?
concrete examples:
listData =
<
and
assocData = <|
"Input" -> 1, 2, 3,
"double" -> 2, 4, 6,
"squared" -> 1, 4, 9
|>
list-manipulation associations neural-networks
add a comment |Â
up vote
2
down vote
favorite
For neuralnetworks mathematica likes 2 ways to structure trainingsets:
listFormatData = "Input" -> input2, "OutputKey1" -> OutputKey1Input2Output, ...
and
assocFormatData = <|
"Input" -> input1, input2, ...,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output, ...
, ...
|>
Is the a stock way to convert these 2 formats properly?
concrete examples:
listData =
<
and
assocData = <|
"Input" -> 1, 2, 3,
"double" -> 2, 4, 6,
"squared" -> 1, 4, 9
|>
list-manipulation associations neural-networks
What doesNormal[Transpose[Dataset[listData]]]return for you? (Also if you replacelistDatawithassocData?)
â J. M. is computer-lessâ¦
1 hour ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
For neuralnetworks mathematica likes 2 ways to structure trainingsets:
listFormatData = "Input" -> input2, "OutputKey1" -> OutputKey1Input2Output, ...
and
assocFormatData = <|
"Input" -> input1, input2, ...,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output, ...
, ...
|>
Is the a stock way to convert these 2 formats properly?
concrete examples:
listData =
<
and
assocData = <|
"Input" -> 1, 2, 3,
"double" -> 2, 4, 6,
"squared" -> 1, 4, 9
|>
list-manipulation associations neural-networks
For neuralnetworks mathematica likes 2 ways to structure trainingsets:
listFormatData = "Input" -> input2, "OutputKey1" -> OutputKey1Input2Output, ...
and
assocFormatData = <|
"Input" -> input1, input2, ...,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output, ...
, ...
|>
Is the a stock way to convert these 2 formats properly?
concrete examples:
listData =
<
and
assocData = <|
"Input" -> 1, 2, 3,
"double" -> 2, 4, 6,
"squared" -> 1, 4, 9
|>
list-manipulation associations neural-networks
list-manipulation associations neural-networks
asked 1 hour ago
Gladaed
1427
1427
What doesNormal[Transpose[Dataset[listData]]]return for you? (Also if you replacelistDatawithassocData?)
â J. M. is computer-lessâ¦
1 hour ago
add a comment |Â
What doesNormal[Transpose[Dataset[listData]]]return for you? (Also if you replacelistDatawithassocData?)
â J. M. is computer-lessâ¦
1 hour ago
What does
Normal[Transpose[Dataset[listData]]] return for you? (Also if you replace listData with assocData?)â J. M. is computer-lessâ¦
1 hour ago
What does
Normal[Transpose[Dataset[listData]]] return for you? (Also if you replace listData with assocData?)â J. M. is computer-lessâ¦
1 hour ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
Merge[listData, Identity]
<|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>
listFormatData = >,
<;
Merge[listFormatData , Identity]
<|"Input" -> input1, input2,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output|>
add a comment |Â
up vote
1
down vote
A function that is of great use here, is AssociationTranspose in the GeneralUtilities package. It does the same thing as regular transpose, but works with List and Associations alike (and mixtures of the two):
listData = >,
<;
assocData = <|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>;
GeneralUtilities`AssociationTranspose[listData] === assocData
GeneralUtilities`AssociationTranspose[assocData] === listData
Out[11]= True
Out[12]= True
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Merge[listData, Identity]
<|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>
listFormatData = >,
<;
Merge[listFormatData , Identity]
<|"Input" -> input1, input2,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output|>
add a comment |Â
up vote
3
down vote
Merge[listData, Identity]
<|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>
listFormatData = >,
<;
Merge[listFormatData , Identity]
<|"Input" -> input1, input2,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output|>
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Merge[listData, Identity]
<|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>
listFormatData = >,
<;
Merge[listFormatData , Identity]
<|"Input" -> input1, input2,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output|>
Merge[listData, Identity]
<|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>
listFormatData = >,
<;
Merge[listFormatData , Identity]
<|"Input" -> input1, input2,
"OutputKey1" -> OutputKey1Input1Output, OutputKey1Input2Output|>
answered 1 hour ago
kglr
166k8188389
166k8188389
add a comment |Â
add a comment |Â
up vote
1
down vote
A function that is of great use here, is AssociationTranspose in the GeneralUtilities package. It does the same thing as regular transpose, but works with List and Associations alike (and mixtures of the two):
listData = >,
<;
assocData = <|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>;
GeneralUtilities`AssociationTranspose[listData] === assocData
GeneralUtilities`AssociationTranspose[assocData] === listData
Out[11]= True
Out[12]= True
add a comment |Â
up vote
1
down vote
A function that is of great use here, is AssociationTranspose in the GeneralUtilities package. It does the same thing as regular transpose, but works with List and Associations alike (and mixtures of the two):
listData = >,
<;
assocData = <|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>;
GeneralUtilities`AssociationTranspose[listData] === assocData
GeneralUtilities`AssociationTranspose[assocData] === listData
Out[11]= True
Out[12]= True
add a comment |Â
up vote
1
down vote
up vote
1
down vote
A function that is of great use here, is AssociationTranspose in the GeneralUtilities package. It does the same thing as regular transpose, but works with List and Associations alike (and mixtures of the two):
listData = >,
<;
assocData = <|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>;
GeneralUtilities`AssociationTranspose[listData] === assocData
GeneralUtilities`AssociationTranspose[assocData] === listData
Out[11]= True
Out[12]= True
A function that is of great use here, is AssociationTranspose in the GeneralUtilities package. It does the same thing as regular transpose, but works with List and Associations alike (and mixtures of the two):
listData = >,
<;
assocData = <|"Input" -> 1, 2, 3, "double" -> 2, 4, 6, "squared" -> 1, 4, 9|>;
GeneralUtilities`AssociationTranspose[listData] === assocData
GeneralUtilities`AssociationTranspose[assocData] === listData
Out[11]= True
Out[12]= True
answered 21 mins ago
Sjoerd Smit
2,985715
2,985715
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184221%2fconvert-list-of-associations-into-association-of-lists%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password

What does
Normal[Transpose[Dataset[listData]]]return for you? (Also if you replacelistDatawithassocData?)â J. M. is computer-lessâ¦
1 hour ago